Edit in GitHubLog an issue

Add the required dependencies to your project by including them in the app's Gradle file.

Copied to your clipboard
implementation(platform("com.adobe.marketing.mobile:sdk-bom:3.+"))
implementation("com.adobe.marketing.mobile:core")
implementation("com.adobe.marketing.mobile:edgeidentity")
implementation("com.adobe.marketing.mobile:edge")
implementation("com.adobe.marketing.mobile:optimize")

Add the required dependencies to your project by including them in the app's Gradle file.

Copied to your clipboard
implementation platform('com.adobe.marketing.mobile:sdk-bom:3.+')
implementation 'com.adobe.marketing.mobile:core'
implementation 'com.adobe.marketing.mobile:edgeidentity'
implementation 'com.adobe.marketing.mobile:edge'
implementation 'com.adobe.marketing.mobile:optimize'

Add the required dependencies to your project using CocoaPods. Add following pods in your Podfile:

Copied to your clipboard
use_frameworks!
target 'YourAppTarget' do
pod 'AEPCore', '~> 5.0'
pod 'AEPEdge', '~> 5.0'
pod 'AEPEdgeIdentity', '~> 5.0'
pod 'AEPOptimize', '~> 5.0'
end

Java

Copied to your clipboard
final DecisionScope decisionScope = DecisionScope("xcore:offer-activity:1111111111111111", "xcore:offer-placement:1111111111111111", 3);

Swift

Copied to your clipboard
let decisionScope = DecisionScope(activityId: "xcore:offer-activity:1111111111111111",
placementId: "xcore:offer-placement:1111111111111111",
itemCount: 3)

Objective-C

Copied to your clipboard
AEPDecisionScope* decisionScope = [[AEPDecisionScope alloc] initWithActivityId:@"xcore:offer-activity:1111111111111111"
placementId:@"xcore:offer-placement:1111111111111111"
itemCount:3];

Java

Copied to your clipboard
final DecisionScope decisionScope = DecisionScope("eyJ4ZG06YWN0aXZpdHlJZCI6Inhjb3JlOm9mZmVyLWFjdGl2aXR5OjEyYmEyZjM4MWJjYTY3NWUiLCJ4ZG06cGxhY2VtZW50SWQiOiJ4Y29yZTpvZmZlci1wbGFjZW1lbnQ6MTJiOWEwMDA1NTUwNzM1NyIsICJ4ZG06aXRlbUNvdW50IjozfQ==");

Swift

Copied to your clipboard
let decisionScope = DecisionScope(name: "eyJ4ZG06YWN0aXZpdHlJZCI6Inhjb3JlOm9mZmVyLWFjdGl2aXR5OjEyYmEyZjM4MWJjYTY3NWUiLCJ4ZG06cGxhY2VtZW50SWQiOiJ4Y29yZTpvZmZlci1wbGFjZW1lbnQ6MTJiOWEwMDA1NTUwNzM1NyIsICJ4ZG06aXRlbUNvdW50IjozfQ==")

Objective-C

Copied to your clipboard
AEPDecisionScope* decisionScope = [[AEPDecisionScope alloc] initWithName:@"eyJ4ZG06YWN0aXZpdHlJZCI6Inhjb3JlOm9mZmVyLWFjdGl2aXR5OjEyYmEyZjM4MWJjYTY3NWUiLCJ4ZG06cGxhY2VtZW50SWQiOiJ4Y29yZTpvZmZlci1wbGFjZW1lbnQ6MTJiOWEwMDA1NTUwNzM1NyIsICJ4ZG06aXRlbUNvdW50IjozfQ=="];

Java

Copied to your clipboard
final DecisionScope decisionScope = DecisionScope("myTargetLocation");

Swift

Copied to your clipboard
let decisionScope = DecisionScope(name: "myTargetLocation")

Objective-C

Copied to your clipboard
AEPDecisionScope* decisionScope = [[AEPDecisionScope alloc] initWithName:@"myTargetLocation"];

Java

Copied to your clipboard
final Map<String, Object> data = new HashMap<>();
final Map<String, String> targetParameters = new HashMap<>();
// Add mbox parameters
targetParameters.put("someKey", "someValue");
// Add profile parameters - prefix with profile.
targetParameters.put("profile.membershipLevel", "platinum");
// Add product parameters
targetParameters.put("productId", "111");
targetParameters.put("categoryId", "Books");
// Add order parameters
targetParameters.put("orderId", "10");
targetParameters.put("orderTotal", "110.56");
targetParameters.put("purchasedProductIds", "111");
data.put("__adobe", new HashMap<String, Object>() {
{
put("target", targetParameters);
}
});
final DecisionScope decisionScope = DecisionScope("myTargetLocation") // Target location (or mbox)
final List<DecisionScope> decisionScopes = new ArrayList<>();
decisionScopes.add(decisionScope);
Optimize.updatePropositions(decisionScopes, null, data);

Swift

Copied to your clipboard
var data: [String: Any] = [:]
var targetParameters: [String: String] = [:]
// Add mbox parameters
targetParameters["someKey"] = "someValue"
// Add profile parameters - prefix with profile.
targetParameters["profile.membershipLevel"] = "platinum"
// Add product parameters
targetParameters["productId"] = "111"
targetParameters["categoryId"] = "Books"
// Add order parameters
targetParameters["orderId"] = "10"
targetParameters["orderTotal"] = "110.56"
targetParameters["purchasedProductIds"] = "111"
data["__adobe"] = [
"target": targetParameters
]
let decisionScope = DecisionScope(name: "myTargetLocation") // Target location (or mbox)
Optimize.updatePropositions(for: [decisionScope] withXdm: nil andData: data)

Objective-C

Copied to your clipboard
NSMutableDictionary* data = [NSMutableDictionary dictionary];
NSMutableDictionary* targetParameters = [NSMutableDictionary dictionary];
// Add mbox parameters
targetParameters[@"someKey"] = @"someValue";
// Add profile parameters - prefix with profile.
targetParameters[@"profile.membershipLevel"] = @"platinum";
// Add product parameters
targetParameters[@"productId"] = @"111";
targetParameters[@"categoryId"] = @"Books";
// Add order parameters
targetParameters[@"orderId"] = @"10";
targetParameters[@"orderTotal"] = @"110.56";
targetParameters[@"purchasedProductIds"] = @"111";
[data setObject:[NSDictionary dictionaryWithObject:targetParameters forKey:@"target"] forKey:@"__adobe"];
AEPDecisionScope* decisionScope = [[AEPDecisionScope alloc] initWithName:@"myTargetLocation"]; // Target location (or mbox)
[AEPMobileOptimize updatePropositions:@[decisionScope] withXdm:nil andData:data];

Java

Copied to your clipboard
final IdentityItem item = new IdentityItem("1111", AuthenticatedState.AUTHENTICATED, true);
final IdentityMap identityMap = new IdentityMap();
identityMap.addItem(item, "userCRMID") // userCRMID being used as Third Party ID
Identity.updateIdentities(identityMap);

Swift

Copied to your clipboard
let identityMap = IdentityMap()
identityMap.add(item: IdentityItem(id: "1111", authenticatedState: AuthenticatedState.authenticated, primary: true),
withNamespace: "userCRMID") // userCRMID being used as Third Party ID
Identity.updateIdentities(with: identityMap)

Objective-C

Copied to your clipboard
AEPIdentityItem *item = [[AEPIdentityItem alloc] initWithId:@"1111" authenticatedState:AEPAuthenticatedStateAuthenticated primary:true];
AEPIdentityMap *identityMap = [[AEPIdentityMap alloc] init];
[identityMap addItem:item withNamespace:@"userCRMID"]; // userCRMID being used as Third Party ID
[AEPMobileEdgeIdentity updateIdentities:identityMap];

Java

Copied to your clipboard
public class Offer {
...
/**
* Dispatches an event for the Edge network extension to send an Experience Event to the Edge network with the display interaction data for the
* given {@code Proposition} offer.
*/
public void displayed() {...}
/**
* Dispatches an event for the Edge network extension to send an Experience Event to the Edge network with the tap interaction data for the
* given {@code Proposition} offer.
*/
public void tapped() {...}
}

Swift

Copied to your clipboard
public extension Offer {
/// Dispatches an event for the Edge extension to send an Experience Event to the Edge network with the display interaction data for the given proposition item.
func displayed() {...}
/// Dispatches an event for the Edge extension to send an Experience Event to the Edge network with the tap interaction data for the given proposition item.
func tapped() {...}
}
Copied to your clipboard
offer.displayed(); // Sends an Offer display notification to Edge network
Copied to your clipboard
offer.displayed() // Sends an Offer display notification to Edge network
Copied to your clipboard
offer.displayed() // Sends an Offer display notification to Edge network
Copied to your clipboard
[offer displayed]; // Sends an Offer display notification to Edge network

Java

Copied to your clipboard
public class Offer {
...
/**
* Generates a map containing XDM formatted data for {@code Experience Event - Proposition Interactions} field group from this {@code Proposition} item.
*
* The returned XDM data does contain the {@code eventType} for the Experience Event with value {@code decisioning.propositionDisplay}.
*
* Note: The Edge sendEvent API can be used to dispatch this data in an Experience Event along with any additional XDM, free-form data, and override
* dataset identifier.
*
* @return {@code Map<String, Object>} containing the XDM data for the proposition interaction.
*/
public Map<String, Object> generateDisplayInteractionXdm() {...}
/**
* Generates a map containing XDM formatted data for {@code Experience Event - Proposition Interactions} field group from this {@code Proposition} offer.
*
* The returned XDM data contains the {@code eventType} for the Experience Event with value {@code decisioning.propositionInteract}.
*
* Note: The Edge sendEvent API can be used to dispatch this data in an Experience Event along with any additional XDM, free-form data, and override
* dataset identifier.
*
* @return {@code Map<String, Object>} containing the XDM data for the proposition interaction.
*/
public Map<String, Object> generateTapInteractionXdm() {...}
}

Swift

Copied to your clipboard
public extension Offer {
/// Creates a dictionary containing XDM formatted data for `Experience Event - Proposition Interactions` field group from the given proposition option.
///
/// The Edge `sendEvent(experienceEvent:_:)` API can be used to dispatch this data in an Experience Event along with any additional XDM, free-form data, or override dataset identifier.
///
/// - Note: The returned XDM data also contains the `eventType` for the Experience Event with value `decisioning.propositionDisplay`.
/// - Returns A dictionary containing XDM data for the proposition interactions.
func generateDisplayInteractionXdm() -> [String: Any] {...}
/// Creates a dictionary containing XDM formatted data for `Experience Event - Proposition Interactions` field group from the given proposition option.
///
/// The Edge `sendEvent(experienceEvent:_:)` API can be used to dispatch this data in an Experience Event along with any additional XDM, free-form data, or override dataset identifier.
///
/// - Note: The returned XDM data also contains the `eventType` for the Experience Event with value `decisioning.propositionInteract`.
/// - Returns A dictionary containing XDM data for the proposition interactions.
func generateTapInteractionXdm() -> [String: Any] {...}
}
Copied to your clipboard
// When a proposition is retrieved using getPropositions API or onUpdatePropositions API callback
// and the corresponding offer is displayed, invoke method on Offer object to get the XDM data.
val displayInteractionXdm = offer.generateDisplayInteractionXdm() // Offer display tracking XDM
val additionalData = mapOf("someDataKey" to "someDataValue")
val experienceEvent = ExperienceEvent.Builder()
.setXdmSchema(displayInteractionXdm)
.setData(additionalData)
.build()
Edge.sendEvent(experienceEvent, null)
Copied to your clipboard
// When a proposition is retrieved using getPropositions API or onUpdatePropositions API callback
// and the corresponding offer is displayed, invoke method on Offer object to get the XDM data.
final Map<String, Object> displayInteractionXdm = offer.generateDisplayInteractionXdm() // Offer display tracking XDM
final Map<String, Object> additionalData = new HashMap<>();
additionalData.put("someDataKey", "someDataValue");
final ExperienceEvent experienceEvent = new ExperienceEvent.Builder().setXdmSchema(displayInteractionXdm).setData(additionalData).build();
Edge.sendEvent(experienceEvent, null)
Copied to your clipboard
// When a proposition is retrieved using getPropositions API or onUpdatePropositions API callback
// and the corresponding offer is displayed, invoke method on Offer object to get the XDM data.
let displayInteractionXdm = offer.generateDisplayInteractionXdm() // Offer display tracking XDM
let additionalData: [String: Any] = ["someDataKey": "someDataValue"]
let experienceEvent = ExperienceEvent(xdm: displayInteractionXdm, data: additionalData)
Edge.sendEvent(experienceEvent)
Copied to your clipboard
// When a proposition is retrieved using getPropositions API or onUpdatePropositions API callback
// and the corresponding offer is displayed, invoke method on Offer object to get the XDM data.
NSDictionary* displayInteractionXdm = [offer generateDisplayInteractionXdm];
NSDictionary* additionalData = @{@"someDataKey": @"someDataValue"};
AEPExperienceEvent* experienceEvent = [[AEPExperienceEvent alloc] initWithXdm:displayInteractionXdm data:additionalData datasetIdentifier:nil];
[AEPMobileEdge sendExperienceEvent:event completion:nil];
Copied to your clipboard
// Create a list of offers from different propositions
final List<Offer> offersToDisplay = new ArrayList<>();
offersToDisplay.add(proposition1.getOffers().get(0));
offersToDisplay.add(proposition2.getOffers().get(0));
// Send list of offers to multiple offers display track public API
OfferUtils.displayed(offersToDisplay);
Copied to your clipboard
// Create a list of offers from different propositions
val offersToDisplay = listOf(
proposition1.offers[0],
proposition2.offers[0]
)
// Send list of offers to multiple offers display track public API
offersToDisplay.displayed()
Copied to your clipboard
// Create an array of offers from different propositions
let offersToDisplay = [
proposition1.offers[0],
proposition2.offers[0]
]
// Send array of offers to multiple offers display track public API
Optimize.displayed(offersToDisplay)
Copied to your clipboard
// Create an array of offers from different propositions
NSArray<AEPOffer *> *offersToDisplay = @[
proposition1.offers[0],
proposition2.offers[0]
];
// Send array of offers to multiple offers display track public API
[AEPMobileOptimize displayed: offersToDisplay];
Copied to your clipboard
// When propositions are retrieved using getPropositions API or onUpdatePropositions API callback
// and the corresponding offers are displayed, invoke method on List<Offer> to get the XDM data.
final Map<String, Object> displayInteractionXdm = offers.generateDisplayInteractionXdm() // Offers display tracking XDM
final Map<String, Object> additionalData = new HashMap<>();
additionalData.put("someDataKey", "someDataValue");
final ExperienceEvent experienceEvent = new ExperienceEvent.Builder().setXdmSchema(displayInteractionXdm).setData(additionalData).build();
Edge.sendEvent(experienceEvent, null)

Parameters

  • offers - A List<Offer> that may or may not belong to the same proposition. The associated proposition(s) need to be tracked.
Copied to your clipboard
// When propositions are retrieved using getPropositions API or onUpdatePropositions API callback
// and the corresponding offers are displayed, invoke method on List<Offer> to get the XDM data.
val displayInteractionXdm = offers.generateDisplayInteractionXdm() // Offers display tracking XDM
val additionalData = mapOf("someDataKey" to "someDataValue")
val experienceEvent = ExperienceEvent.Builder()
.setXdmSchema(displayInteractionXdm)
.setData(additionalData)
.build()
Edge.sendEvent(experienceEvent, null)

Parameters

  • offers - A [Offer] that may or may not belong to the same proposition. The associated proposition(s) need to be tracked.
Copied to your clipboard
// When propositions are retrieved using getPropositions API or onUpdatePropositions API callback
// and the corresponding offers are displayed, invoke method on [Offer] to get the XDM data.
let displayInteractionXdm = offers.generateDisplayInteractionXdm() // Offers display tracking XDM
let additionalData: [String: Any] = ["someDataKey": "someDataValue"]
let experienceEvent = ExperienceEvent(xdm: displayInteractionXdm, data: additionalData)
Edge.sendEvent(experienceEvent)

Parameters

  • offers - A [Offer] that may or may not belong to the same proposition. The associated proposition(s) need to be tracked.
Copied to your clipboard
// When propositions are retrieved using getPropositions API or onUpdatePropositions API callback
// and the corresponding offers are displayed, invoke method on NSArray<AEPOffer *> to get the XDM data.
NSDictionary* displayInteractionXdm = [offers generateDisplayInteractionXdm];
NSDictionary* additionalData = @{@"someDataKey": @"someDataValue"};
AEPExperienceEvent* experienceEvent = [[AEPExperienceEvent alloc] initWithXdm:displayInteractionXdm data:additionalData datasetIdentifier:nil];
[AEPMobileEdge sendExperienceEvent:event completion:nil];

Parameters

  • offers - A List<Offer> that may or may not belong to the same proposition. The associated proposition(s) need to be tracked.

Kotlin

Copied to your clipboard
object OfferUtils {
/**
* Dispatches an event for the Edge network extension to send an Experience Event to the Edge
* network with the display interaction data for the given list of [Offer]s.
*
* This function extracts unique [OptimizeProposition]s from the list of offers based on their
* proposition ID and dispatches an event with multiple propositions.
*
* @see XDMUtils.trackWithData
*/
@JvmStatic
fun List<Offer>.displayed() {...}
}

Swift

Copied to your clipboard
@objc
public extension Optimize {
/// This API dispatches an event for the Edge extension to send an Experience Event to the Edge network with the display interaction data for list of offers passed.
///
/// - Parameter offers: An array of offer.
@objc(displayed:)
static func displayed(for offers: [Offer]) {...}
}

Kotlin

Copied to your clipboard
object OfferUtils {
/**
* Generates a map containing XDM formatted data for `Experience Event - OptimizeProposition
* Interactions` field group from the given list of [Offer]s.
*
* This function extracts unique [OptimizeProposition]s from the list of offers based on their
* proposition ID and generates XDM data for the interaction.
*
* @return [Map] containing the XDM data for the proposition interaction, or null if the list is empty
* or no valid propositions are found
*/
@JvmStatic
fun List<Offer>.generateDisplayInteractionXdm(): Map<String, Any>? {...}
}

Swift

Copied to your clipboard
@objc
public extension Optimize {
/// This API returns a dictionary containing XDM formatted data for Experience Event - Proposition Interactions field group for the list of offers
///
/// The Edge sendEvent(experienceEvent:_:) API can be used to dispatch this data in an Experience Event along with any additional XDM, free-form data, or override dataset identifier.
///
/// - Parameter offers: An array of offer.
/// - Note: The returned XDM data also contains the eventType for the Experience Event with value decisioning.propositionInteract.
/// - Returns A dictionary containing XDM data for the propositon interactions.
/// - SeeAlso: interactionXdm(for:)
@objc(generateDisplayInteractionXdm:)
static func generateDisplayInteractionXdm(for offers: [Offer]) -> [String: Any]?{...}
}
Copied to your clipboard
import com.google.gson.Gson
import java.nio.charset.StandardCharsets
fun calculateJsonSizeInKB(jsonMap: Map<String, Any>) {
val gson = Gson()
val jsonString = gson.toJson(jsonMap)
val byteArray = jsonString.toByteArray(StandardCharsets.UTF_8)
val sizeInKB = byteArray.size / 1024.0
println("JSON size: %.2f KB".format(sizeInKB))
}
Copied to your clipboard
import Foundation
func calculateJsonSizeInKB(jsonMap: [String: Any]) {
do {
let jsonData = try JSONSerialization.data(withJSONObject: jsonMap)
let sizeInKB = Double(jsonData.count) / 1024.0
print(String(format: "JSON size: %.2f KB", sizeInKB))
} catch {
print("Error calculating JSON size: \(error)")
}
}
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2025 Adobe. All rights reserved.