Target API reference
clearPrefetchCache
This API clears the in-memory cache that contains the prefetched offers.
clickedLocation
This API sends a location click notification for an mbox to the configured Target server and can be invoked in the following cases:
- For a prefetched mbox, after the mbox content is retrieved using the
retrieveLocationContent
API. - For a regular mbox, where no previous prefetch request is made, and the mbox content is retrieved using the
retrieveLocationContent
API.
Java
Syntax
Copied to your clipboardpublic static void clickedLocation(final String mboxName, final TargetParameters parameters)
mboxName
: A string that contains the mbox location for which the click notification will be sent to Target.parameters
: ATargetParameters
object configured for the request.
Example
Copied to your clipboard// Mbox parametersMap<String, String> mboxParameters = new HashMap<>();mboxParameters.put("membership", "prime");// Product parametersTargetProduct targetProduct = new TargetProduct("CEDFJC", "Electronics");// Order parametersList<String> purchasedIds = new ArrayList<String>();purchasedIds.add("81");purchasedIds.add("123");purchasedIds.add("190");TargetOrder targetOrder = new TargetOrder("NJJICK", "650", purchasedIds);// Profile parametersMap<String, String> profileParameters = new HashMap<>();profileParameters.put("ageGroup", "20-32");// Create Target ParametersTargetParameters targetParameters = new TargetParameters.Builder(mboxParameters).profileParameters(profileParameters).order(targetOrder).product(targetProduct).build();Target.clickedLocation("cartLocation", targetParameters);
Swift
Syntax
Copied to your clipboardstatic func clickedLocation(_ name: String, targetParameters: TargetParameters?)
name
: A string that contains the mbox location for which the click notification will be sent to Target.targetParameters
: ATargetParameters
object configured for the request.
Example
Copied to your clipboardTarget.clickedLocation("aep-loc-1", targetParameters: TargetParameters(parameters: ["mbox_parameter_key": "mbox_parameter_value"], profileParameters: ["name": "Smith"], order: TargetOrder(id: "id1", total: 1.0, purchasedProductIds: ["ppId1"]), product: TargetProduct(productId: "pId1", categoryId: "cId1")))
Objective-C
Syntax
Copied to your clipboard+ (void) clickedLocation: (nonnull NSString*) name withTargetParameters: (nullable AEPTargetParameters* targetParameters
name
: A string that contains the mbox location for which the click notification will be sent to Target.targetParameters
: ATargetParameters
object configured for the request.
Example
Copied to your clipboardAEPTargetOrder *order = [[AEPTargetOrder alloc] initWithId:@"id1" total:1.0 purchasedProductIds:@[@"ppId1"]];AEPTargetProduct *product =[[AEPTargetProduct alloc] initWithProductId:@"pId1" categoryId:@"cId1"];AEPTargetParameters * targetParams = [[AEPTargetParameters alloc] initWithParameters:@{@"mbox_parameter_key":@"mbox_parameter_value"} profileParameters:@{@"name":@"Smith"} order:order product:product];[AEPMobileTarget clickedLocation:@"aep-loc-1" withTargetParameters:targetParams];
Java
Syntax
Copied to your clipboardpublic static void clickedLocation(final String mboxName, final TargetParameters parameters)
mboxName
: A string that contains the mbox location for which the click notification will be sent to Target.parameters
: ATargetParameters
object configured for the request.
Example
Copied to your clipboard// Mbox parametersMap<String, String> mboxParameters = new HashMap<>();mboxParameters.put("membership", "prime");// Product parametersTargetProduct targetProduct = new TargetProduct("CEDFJC", "Electronics");// Order parametersList<String> purchasedIds = new ArrayList<String>();purchasedIds.add("81");purchasedIds.add("123");purchasedIds.add("190");TargetOrder targetOrder = new TargetOrder("NJJICK", "650", purchasedIds);// Profile parametersMap<String, String> profileParameters = new HashMap<>();profileParameters.put("ageGroup", "20-32");// Create Target ParametersTargetParameters targetParameters = new TargetParameters.Builder(mboxParameters).profileParameters(profileParameters).order(targetOrder).product(targetProduct).build();Target.clickedLocation("cartLocation", targetParameters);
Swift
Syntax
Copied to your clipboardstatic func clickedLocation(_ name: String, targetParameters: TargetParameters?)
name
: A string that contains the mbox location for which the click notification will be sent to Target.targetParameters
: ATargetParameters
object configured for the request.
Example
Copied to your clipboardTarget.clickedLocation("aep-loc-1", targetParameters: TargetParameters(parameters: ["mbox_parameter_key": "mbox_parameter_value"], profileParameters: ["name": "Smith"], order: TargetOrder(id: "id1", total: 1.0, purchasedProductIds: ["ppId1"]), product: TargetProduct(productId: "pId1", categoryId: "cId1")))
Objective-C
Syntax
Copied to your clipboard+ (void) clickedLocation: (nonnull NSString*) name withTargetParameters: (nullable AEPTargetParameters* targetParameters
name
: A string that contains the mbox location for which the click notification will be sent to Target.targetParameters
: ATargetParameters
object configured for the request.
Example
Copied to your clipboardAEPTargetOrder *order = [[AEPTargetOrder alloc] initWithId:@"id1" total:1.0 purchasedProductIds:@[@"ppId1"]];AEPTargetProduct *product =[[AEPTargetProduct alloc] initWithProductId:@"pId1" categoryId:@"cId1"];AEPTargetParameters * targetParams = [[AEPTargetParameters alloc] initWithParameters:@{@"mbox_parameter_key":@"mbox_parameter_value"} profileParameters:@{@"name":@"Smith"} order:order product:product];[AEPMobileTarget clickedLocation:@"aep-loc-1" withTargetParameters:targetParams];
displayedLocations
This API sends a location display notification for an mbox to the configured Target server. The API should be invoked for a prefetched mbox after the mbox content is retrieved using the retrieveLocationContent
API. If no previous prefetch request is made, and the mbox content is retrieved using the retrieveLocationContent
API, calling this API does not trigger a notification request to the Target server.
Java
Syntax
Copied to your clipboardpublic static void displayedLocations(final List<String> mboxNames, final TargetParameters targetParameters)
mboxNames
: A list of the mbox locations for which the display notification will be sent to Target.targetParameters
: TheTargetParameters
object configured for the request.
Example
Copied to your clipboardList<String> purchasedProductIds = new ArrayList<String>();purchasedProductIds.add("34");purchasedProductIds.add("125");TargetOrder targetOrder = new TargetOrder("123", 567.89, purchasedProductIds);TargetProduct targetProduct = new TargetProduct("123", "Books");TargetParameters targetParameters = new TargetParameters.Builder().parameters(new HashMap<String, String>()).profileParameters(new HashMap<String, String>()).product(targetProduct).order(targetOrder).build();List<String> mboxList = new ArrayList<>();mboxList.add("mboxName1");Target.displayedLocations(mboxList, targetParameters);
Swift
Syntax
Copied to your clipboardstatic func displayedLocations(_ names: [String], targetParameters: TargetParameters?)
names
: An array of the mbox locations for which the display notification will be sent to Target.targetParameters
: ATargetParameters
object configured for the request.
Example
Copied to your clipboardTarget.displayedLocations(["mboxName1", "mboxName2"],targetParameters: TargetParameters(parameters: nil,profileParameters: nil,order: TargetOrder(id: "ADCKKBC", total: 400.50, purchasedProductIds: ["34", "125"]),product: TargetProduct(productId: "24D334", categoryId: "Stationary")))
Objective-C
Syntax
Copied to your clipboard+ (void) displayedLocations: (nonnull NSArray<NSString*>*) names withTargetParameters: (nullable AEPTargetParameters*) targetParameters
names
: An array of the mbox locations for which the display notification will be sent to Target.targetParameters
: ATargetParameters
object configured for the request.
Example
Copied to your clipboardAEPTargetOrder *order = [[AEPTargetOrder alloc] initWithId:@"ADCKKBC" total:400.50 purchasedProductIds:@[@"34", @"125"]];AEPTargetProduct *product =[[AEPTargetProduct alloc] initWithProductId:@"24D334" categoryId:@"Stationary"];AEPTargetParameters * targetParams = [[AEPTargetParameters alloc] initWithParameters:nil profileParameters:nil order:order product:product];[AEPMobileTarget displayedLocations:@[@"mboxName1", @"mboxName2"] withTargetParameters:targetParams];
Java
Syntax
Copied to your clipboardpublic static void displayedLocations(final List<String> mboxNames, final TargetParameters targetParameters)
mboxNames
: A list of the mbox locations for which the display notification will be sent to Target.targetParameters
: TheTargetParameters
object configured for the request.
Example
Copied to your clipboardList<String> purchasedProductIds = new ArrayList<String>();purchasedProductIds.add("34");purchasedProductIds.add("125");TargetOrder targetOrder = new TargetOrder("123", 567.89, purchasedProductIds);TargetProduct targetProduct = new TargetProduct("123", "Books");TargetParameters targetParameters = new TargetParameters.Builder().parameters(new HashMap<String, String>()).profileParameters(new HashMap<String, String>()).product(targetProduct).order(targetOrder).build();List<String> mboxList = new ArrayList<>();mboxList.add("mboxName1");Target.displayedLocations(mboxList, targetParameters);
Swift
Syntax
Copied to your clipboardstatic func displayedLocations(_ names: [String], targetParameters: TargetParameters?)
names
: An array of the mbox locations for which the display notification will be sent to Target.targetParameters
: ATargetParameters
object configured for the request.
Example
Copied to your clipboardTarget.displayedLocations(["mboxName1", "mboxName2"],targetParameters: TargetParameters(parameters: nil,profileParameters: nil,order: TargetOrder(id: "ADCKKBC", total: 400.50, purchasedProductIds: ["34", "125"]),product: TargetProduct(productId: "24D334", categoryId: "Stationary")))
Objective-C
Syntax
Copied to your clipboard+ (void) displayedLocations: (nonnull NSArray<NSString*>*) names withTargetParameters: (nullable AEPTargetParameters*) targetParameters
names
: An array of the mbox locations for which the display notification will be sent to Target.targetParameters
: ATargetParameters
object configured for the request.
Example
Copied to your clipboardAEPTargetOrder *order = [[AEPTargetOrder alloc] initWithId:@"ADCKKBC" total:400.50 purchasedProductIds:@[@"34", @"125"]];AEPTargetProduct *product =[[AEPTargetProduct alloc] initWithProductId:@"24D334" categoryId:@"Stationary"];AEPTargetParameters * targetParams = [[AEPTargetParameters alloc] initWithParameters:nil profileParameters:nil order:order product:product];[AEPMobileTarget displayedLocations:@[@"mboxName1", @"mboxName2"] withTargetParameters:targetParams];
extensionVersion
Returns the running version of the Target extension.
Swift
Syntax
Copied to your clipboardstatic var extensionVersion: String
Example
Copied to your clipboardlet targetVersion = Target.extensionVersion
Objective-C
Syntax
Copied to your clipboard+ (nonnull NSString*) extensionVersion
Example
Copied to your clipboardNSString *targetVersion = [AEPMobileTarget extensionVersion];
Java
Syntax
Copied to your clipboardpublic String extensionVersion()
Example
Copied to your clipboardTarget.extensionVersion();
Swift
Syntax
Copied to your clipboardstatic var extensionVersion: String
Example
Copied to your clipboardlet targetVersion = Target.extensionVersion
Objective-C
Syntax
Copied to your clipboard+ (nonnull NSString*) extensionVersion
Example
Copied to your clipboardNSString *targetVersion = [AEPMobileTarget extensionVersion];
getSessionId
This API gets the Target session identifier.
The session ID is generated locally in the SDK upon initial Target request and persisted for a period defined by target.sessionTimeout
configuration setting. If the session timeout happens upon a subsequent Target request, a new session ID will be generated for use in the request and persisted in the SDK.
Java
Syntax
Copied to your clipboardpublic static void getSessionId(final AdobeCallback<String> callback)
callback
: A callback that is invoked with thesessionId
value, ornull
if there was an error retrieving it.
Example
Copied to your clipboardTarget.getSessionId(new AdobeCallback<String>() {@Overridepublic void call(String sessionId) {// read Target sessionId}});
Swift
Syntax
Copied to your clipboardstatic func getSessionId(_ completion: @escaping (String?, Error?) -> Void)
completion
: A callback that is invoked with thesessionId
value, ornil
if there was an error retrieving it.
Example
Copied to your clipboardTarget.getSessionId { (id, err) in// read Target sessionId}
Objective-C
Syntax
Copied to your clipboard+ (void) getSessionId: (void (nonnull ^) (nullable NSString* sessionId, nullable NSError* error)) completion
completion
: A callback that is invoked with thesessionId
value, ornil
if there was an error retrieving it.
Example
Copied to your clipboard[AEPMobileTarget getSessionId:^(NSString *sessionId, NSError *error){// read Target sessionId}];
Java
Syntax
Copied to your clipboardpublic static void getSessionId(final AdobeCallback<String> callback)
callback
: A callback that is invoked with thesessionId
value, ornull
if there was an error retrieving it.
Example
Copied to your clipboardTarget.getSessionId(new AdobeCallback<String>() {@Overridepublic void call(String sessionId) {// read Target sessionId}});
Swift
Syntax
Copied to your clipboardstatic func getSessionId(_ completion: @escaping (String?, Error?) -> Void)
completion
: A callback that is invoked with thesessionId
value, ornil
if there was an error retrieving it.
Example
Copied to your clipboardTarget.getSessionId { (id, err) in// read Target sessionId}
Objective-C
Syntax
Copied to your clipboard+ (void) getSessionId: (void (nonnull ^) (nullable NSString* sessionId, nullable NSError* error)) completion
completion
: A callback that is invoked with thesessionId
value, ornil
if there was an error retrieving it.
Example
Copied to your clipboard[AEPMobileTarget getSessionId:^(NSString *sessionId, NSError *error){// read Target sessionId}];
getThirdPartyId
This API gets the custom visitor ID for Target. If no third-party
ID was previously set, or if the ID was reset by calling resetExperience API, it will have a nil
value.
Java
Syntax
Copied to your clipboardpublic static void getThirdPartyId(final AdobeCallback<String> callback)
callback
: A callback that is invoked with thethirdPartyId
value. If no third-party ID was set, this value will benull
.
Example
Copied to your clipboardTarget.getThirdPartyId(new AdobeCallback<String>() {@Overridepublic void call(String thirdPartyId) {// read Target thirdPartyId}});
Swift
Syntax
Copied to your clipboardstatic func getThirdPartyId(_ completion: @escaping (String?, Error?) -> Void)
completion
: A callback that is invoked with thethirdPartyId
value. If nothird-party
ID was set, this value will benil
.
Example
Copied to your clipboardTarget.getThirdPartyId { (id, err) in// read Target thirdPartyId}
Objective-C
Syntax
Copied to your clipboard+ (void) getThirdPartyId: (nonnull void (^) (nullable NSString* thirdPartyId, nullable NSError* error)) completion
completion
: A callback that is invoked with thethirdPartyId
value. If nothird-party
ID was set, this value will benil
.
Example
Copied to your clipboard[AEPMobileTarget getThirdPartyId:^(NSString *thirdPartyID, NSError *error){// read Target thirdPartyId}];
Java
Syntax
Copied to your clipboardpublic static void getThirdPartyId(final AdobeCallback<String> callback)
callback
: A callback that is invoked with thethirdPartyId
value. If no third-party ID was set, this value will benull
.
Example
Copied to your clipboardTarget.getThirdPartyId(new AdobeCallback<String>() {@Overridepublic void call(String thirdPartyId) {// read Target thirdPartyId}});
Swift
Syntax
Copied to your clipboardstatic func getThirdPartyId(_ completion: @escaping (String?, Error?) -> Void)
completion
: A callback that is invoked with thethirdPartyId
value. If nothird-party
ID was set, this value will benil
.
Example
Copied to your clipboardTarget.getThirdPartyId { (id, err) in// read Target thirdPartyId}
Objective-C
Syntax
Copied to your clipboard+ (void) getThirdPartyId: (nonnull void (^) (nullable NSString* thirdPartyId, nullable NSError* error)) completion
completion
: A callback that is invoked with thethirdPartyId
value. If nothird-party
ID was set, this value will benil
.
Example
Copied to your clipboard[AEPMobileTarget getThirdPartyId:^(NSString *thirdPartyID, NSError *error){// read Target thirdPartyId}];
getTntId
This API gets the Target user ID (also known as the tntId
) from the Target service. The tntId
is returned in the network response after a successful call to prefetchContent
or retrieveLocationContent
, which is then persisted in the SDK. This ID is preserved between app upgrades, is saved and restored during the standard application backup process, and is removed at uninstall or when the resetExperience
API is used.
Java
Syntax
Copied to your clipboardpublic static void getTntId(final AdobeCallback<String> callback)
callback
: A callabck that is invoked with thetntId
value, ornull
if there was an error retrieving it.
Example
Copied to your clipboardTarget.getTntId(new AdobeCallback<String>() {@Overridepublic void call(String tntId) {// read target's tntid}});
Swift
Syntax
Copied to your clipboardstatic func getTntId(_ completion: @escaping (String?, Error?) -> Void)
completion
: A callback that is invoked with thetntId
value. If no Target ID was set, this value will benil
.
Example
Copied to your clipboardTarget.getTntId({ (id, err) in// read target's tntId})
Objective-C
Syntax
Copied to your clipboard+ (void) getTntId: (void (nonnull ^) (nullable NSString* tntId, nullable NSError* error)) completion
completion
: A callback that is invoked with thetntId
value. If no Target ID was set, this value will benil
.
Example
Copied to your clipboard[AEPMobileTarget getTntId:^(NSString *tntID, NSError *error){// read target's tntId}];
Java
Syntax
Copied to your clipboardpublic static void getTntId(final AdobeCallback<String> callback)
callback
: A callabck that is invoked with thetntId
value, ornull
if there was an error retrieving it.
Example
Copied to your clipboardTarget.getTntId(new AdobeCallback<String>() {@Overridepublic void call(String tntId) {// read target's tntid}});
Swift
Syntax
Copied to your clipboardstatic func getTntId(_ completion: @escaping (String?, Error?) -> Void)
completion
: A callback that is invoked with thetntId
value. If no Target ID was set, this value will benil
.
Example
Copied to your clipboardTarget.getTntId({ (id, err) in// read target's tntId})
Objective-C
Syntax
Copied to your clipboard+ (void) getTntId: (void (nonnull ^) (nullable NSString* tntId, nullable NSError* error)) completion
completion
: A callback that is invoked with thetntId
value. If no Target ID was set, this value will benil
.
Example
Copied to your clipboard[AEPMobileTarget getTntId:^(NSString *tntID, NSError *error){// read target's tntId}];
prefetchContent
This API sends a prefetch request to your configured Target server. The prefetch request is sent with the prefetch objects array and the specified Target parameters.
Java
Syntax
Copied to your clipboardpublic static void prefetchContent(final List<TargetPrefetch> mboxPrefetchList, final TargetParameters parameters, final AdobeCallback<String> callback)
mboxPrefetchList
: A list ofTargetPrefetch
objects for various mbox locations.parameters
: ATargetParameters
object configured for the prefetch request.callback
: A callback that is invoked with anull
value if the prefetch is successful, or with an error message string otherwise.
Example
Copied to your clipboard// first prefetch requestMap<String, String> mboxParameters1 = new HashMap<>();mboxParameters1.put("status", "platinum");TargetParameters targetParameters1 = new TargetParameters.Builder().parameters(mboxParameters1).build();TargetPrefetch prefetchRequest1 = new TargetPrefetch("mboxName1", targetParameters1);// second prefetch requestMap<String, String> mboxParameters2 = new HashMap<>();mboxParameters2.put("userType", "paid");List<String> purchasedIds = new ArrayList<String>();purchasedIds.add("34");purchasedIds.add("125");TargetOrder targetOrder = new TargetOrder("ADCKKIM", 344.30, purchasedIds);TargetProduct targetProduct = new TargetProduct("24D3412", "Books");TargetParameters targetParameters2 = new TargetParameters.Builder().parameters(mboxParameters2).product(targetProduct).order(targetOrder).build();TargetPrefetch prefetchRequest2 = new TargetPrefetch("mboxName2", targetParameters2);List<TargetPrefetch> prefetchMboxesList = new ArrayList<>();prefetchMboxesList.add(prefetchRequest1);prefetchMboxesList.add(prefetchRequest2);// Call the prefetchContent API.TargetParamters targetParameters = null;Target.prefetchContent(prefetchMboxesList, targetParameters, prefetchStatusCallback);
Swift
Syntax
Copied to your clipboardstatic func prefetchContent(_ prefetchArray: [TargetPrefetch], with targetParameters: TargetParameters? = nil, _ completion: ((Error?) -> Void)?)
prefetchArray
: An array ofTargetPrefetch
objects for various mbox locations.targetParameters
: ATargetParameters
object configured for the prefetch request.completion
: A callback that is invoked with anil
value if the prefetch is successful, or with an error otherwise.
Example
Copied to your clipboardlet TargetParameters1 = TargetParameters(parameters: ["status": "platinum"],profileParameters: ["age": "20"],order: TargetOrder(id: "ADCKKIM", total: 344.30, purchasedProductIds: ["34", "125"]),product: TargetProduct(productId: "24D3412", categoryId:"Books"))let TargetParameters2 = TargetParameters(parameters: ["userType": "Paid"],profileParameters: nil,order: TargetOrder(id: "ADCKKIM", total: 344.30, purchasedProductIds: ["id1", "id2"]),product: TargetProduct(productId: "764334", categoryId:"Online"))let globalTargetParameters = TargetParameters(parameters: ["status": "progressive"],profileParameters: ["age": "20-32"],order: TargetOrder(id: "ADCKKBC", total: 400.50, purchasedProductIds: ["34", "125"]),product: TargetProduct(productId: "24D334", categoryId:"Stationary"))Target.prefetchContent([TargetPrefetch(name: "mboxName1", targetParameters: TargetParameters1),TargetPrefetch(name: "mboxName2", targetParameters: TargetParameters2),],with: globalTargetParameters){ error in// do something with the callback response}
Objective-C
Syntax
Copied to your clipboard+ (void) prefetchContent: (nonnull NSArray<AEPTargetPrefetchObject*>*) targetPrefetchObjectArraywithParameters: (nullable AEPTargetParameters*) targetParameterscallback: (nullable void (^) (nullable NSError* error)) completion
targetPrefetchObjectArray
: An array ofAEPTargetPrefetchObject
objects for various mbox locations.targetParameters
: AnAEPTargetParameters
object configured for the prefetch request.completion
: A callback that is invoked with anil
value if the prefetch is successful, or with an error otherwise.
Example
Copied to your clipboardNSDictionary *mboxParameters1 = @{@"status":@"platinum"};NSDictionary *profileParameters1 = @{@"age":@"20"};AEPTargetProduct *product1 = [[AEPTargetProduct alloc] initWithProductId:@"24D3412" categoryId:@"Books"];AEPTargetOrder *order1 = [[AEPTargetOrder alloc] initWithId:@"ADCKKIM" total:[@(344.30) doubleValue] purchasedProductIds:@[@"34", @"125"]];AEPTargetParameters *targetParameters1 = [[AEPTargetParameters alloc] initWithParameters:mboxParameters1 profileParameters:profileParameters1 order:order1 product:product1 ];NSDictionary *mboxParameters2 = @{@"userType":@"Paid"};AEPTargetProduct *product2 = [[AEPTargetProduct alloc] initWithProductId:@"764334" categoryId:@"Online"];AEPTargetOrder *order2 = [[AEPTargetOrder alloc] initWithId:@"ADCKKIM" total:[@(344.30) doubleValue] purchasedProductIds:@[@"id1",@"id2"]];AEPTargetParameters *targetParameters2 = [[AEPTargetParameters alloc] initWithParameters:mboxParameters2 profileParameters:nil order:order2 product:product2 ];// Creating Prefetch ObjectsAEPTargetPrefetchObject *prefetch1 = [[AEPTargetPrefetchObject alloc] initWithName: @"logo" targetParameters:targetParameters1];AEPTargetPrefetchObject *prefetch2 = [[AEPTargetPrefetchObject alloc] initWithName: @"buttonColor" targetParameters:targetParameters2];// Creating prefetch ArrayNSArray *prefetchArray = @[prefetch1,prefetch2];// Creating Target parametersNSDictionary *mboxParameters = @{@"status":@"progressive"};NSDictionary *profileParameters = @{@"age":@"20-32"};AEPTargetProduct *product = [[AEPTargetProduct alloc] initWithProductId:@"24D334" categoryId:@"Stationary"];AEPTargetOrder *order = [[AEPTargetOrder alloc] initWithId:@"ADCKKBC" total:[@(400.50) doubleValue] purchasedProductIds:@[@"34", @"125"]];AEPTargetParameters *targetParameters = [[AEPTargetParameters alloc] initWithParameters:mboxParametersprofileParameters:profileParametersorder:orderproduct:product];// Target API Call[AEPMobileTarget prefetchContent:prefetchArray withParameters:targetParameters callback:^(NSError * _Nullable error){// do something with the callback response}];
Java
Syntax
Copied to your clipboardpublic static void prefetchContent(final List<TargetPrefetch> mboxPrefetchList, final TargetParameters parameters, final AdobeCallback<String> callback)
mboxPrefetchList
: A list ofTargetPrefetch
objects for various mbox locations.parameters
: ATargetParameters
object configured for the prefetch request.callback
: A callback that is invoked with anull
value if the prefetch is successful, or with an error message string otherwise.
Example
Copied to your clipboard// first prefetch requestMap<String, String> mboxParameters1 = new HashMap<>();mboxParameters1.put("status", "platinum");TargetParameters targetParameters1 = new TargetParameters.Builder().parameters(mboxParameters1).build();TargetPrefetch prefetchRequest1 = new TargetPrefetch("mboxName1", targetParameters1);// second prefetch requestMap<String, String> mboxParameters2 = new HashMap<>();mboxParameters2.put("userType", "paid");List<String> purchasedIds = new ArrayList<String>();purchasedIds.add("34");purchasedIds.add("125");TargetOrder targetOrder = new TargetOrder("ADCKKIM", 344.30, purchasedIds);TargetProduct targetProduct = new TargetProduct("24D3412", "Books");TargetParameters targetParameters2 = new TargetParameters.Builder().parameters(mboxParameters2).product(targetProduct).order(targetOrder).build();TargetPrefetch prefetchRequest2 = new TargetPrefetch("mboxName2", targetParameters2);List<TargetPrefetch> prefetchMboxesList = new ArrayList<>();prefetchMboxesList.add(prefetchRequest1);prefetchMboxesList.add(prefetchRequest2);// Call the prefetchContent API.TargetParamters targetParameters = null;Target.prefetchContent(prefetchMboxesList, targetParameters, prefetchStatusCallback);
Swift
Syntax
Copied to your clipboardstatic func prefetchContent(_ prefetchArray: [TargetPrefetch], with targetParameters: TargetParameters? = nil, _ completion: ((Error?) -> Void)?)
prefetchArray
: An array ofTargetPrefetch
objects for various mbox locations.targetParameters
: ATargetParameters
object configured for the prefetch request.completion
: A callback that is invoked with anil
value if the prefetch is successful, or with an error otherwise.
Example
Copied to your clipboardlet TargetParameters1 = TargetParameters(parameters: ["status": "platinum"],profileParameters: ["age": "20"],order: TargetOrder(id: "ADCKKIM", total: 344.30, purchasedProductIds: ["34", "125"]),product: TargetProduct(productId: "24D3412", categoryId:"Books"))let TargetParameters2 = TargetParameters(parameters: ["userType": "Paid"],profileParameters: nil,order: TargetOrder(id: "ADCKKIM", total: 344.30, purchasedProductIds: ["id1", "id2"]),product: TargetProduct(productId: "764334", categoryId:"Online"))let globalTargetParameters = TargetParameters(parameters: ["status": "progressive"],profileParameters: ["age": "20-32"],order: TargetOrder(id: "ADCKKBC", total: 400.50, purchasedProductIds: ["34", "125"]),product: TargetProduct(productId: "24D334", categoryId:"Stationary"))Target.prefetchContent([TargetPrefetch(name: "mboxName1", targetParameters: TargetParameters1),TargetPrefetch(name: "mboxName2", targetParameters: TargetParameters2),],with: globalTargetParameters){ error in// do something with the callback response}
Objective-C
Syntax
Copied to your clipboard+ (void) prefetchContent: (nonnull NSArray<AEPTargetPrefetchObject*>*) targetPrefetchObjectArraywithParameters: (nullable AEPTargetParameters*) targetParameterscallback: (nullable void (^) (nullable NSError* error)) completion
targetPrefetchObjectArray
: An array ofAEPTargetPrefetchObject
objects for various mbox locations.targetParameters
: AnAEPTargetParameters
object configured for the prefetch request.completion
: A callback that is invoked with anil
value if the prefetch is successful, or with an error otherwise.
Example
Copied to your clipboardNSDictionary *mboxParameters1 = @{@"status":@"platinum"};NSDictionary *profileParameters1 = @{@"age":@"20"};AEPTargetProduct *product1 = [[AEPTargetProduct alloc] initWithProductId:@"24D3412" categoryId:@"Books"];AEPTargetOrder *order1 = [[AEPTargetOrder alloc] initWithId:@"ADCKKIM" total:[@(344.30) doubleValue] purchasedProductIds:@[@"34", @"125"]];AEPTargetParameters *targetParameters1 = [[AEPTargetParameters alloc] initWithParameters:mboxParameters1 profileParameters:profileParameters1 order:order1 product:product1 ];NSDictionary *mboxParameters2 = @{@"userType":@"Paid"};AEPTargetProduct *product2 = [[AEPTargetProduct alloc] initWithProductId:@"764334" categoryId:@"Online"];AEPTargetOrder *order2 = [[AEPTargetOrder alloc] initWithId:@"ADCKKIM" total:[@(344.30) doubleValue] purchasedProductIds:@[@"id1",@"id2"]];AEPTargetParameters *targetParameters2 = [[AEPTargetParameters alloc] initWithParameters:mboxParameters2 profileParameters:nil order:order2 product:product2 ];// Creating Prefetch ObjectsAEPTargetPrefetchObject *prefetch1 = [[AEPTargetPrefetchObject alloc] initWithName: @"logo" targetParameters:targetParameters1];AEPTargetPrefetchObject *prefetch2 = [[AEPTargetPrefetchObject alloc] initWithName: @"buttonColor" targetParameters:targetParameters2];// Creating prefetch ArrayNSArray *prefetchArray = @[prefetch1,prefetch2];// Creating Target parametersNSDictionary *mboxParameters = @{@"status":@"progressive"};NSDictionary *profileParameters = @{@"age":@"20-32"};AEPTargetProduct *product = [[AEPTargetProduct alloc] initWithProductId:@"24D334" categoryId:@"Stationary"];AEPTargetOrder *order = [[AEPTargetOrder alloc] initWithId:@"ADCKKBC" total:[@(400.50) doubleValue] purchasedProductIds:@[@"34", @"125"]];AEPTargetParameters *targetParameters = [[AEPTargetParameters alloc] initWithParameters:mboxParametersprofileParameters:profileParametersorder:orderproduct:product];// Target API Call[AEPMobileTarget prefetchContent:prefetchArray withParameters:targetParameters callback:^(NSError * _Nullable error){// do something with the callback response}];
registerExtension
This API has been deprecated starting in v2.0.0 and removed in v3.0.0 of the Android mobile extension.
Use MobileCore.registerExtensions()
API instead.
resetExperience
This API resets the user's experience by removing the visitor identifiers and resetting the Target session. Invoking this API also removes previously set Target user ID and custom visitor IDs, Target Edge Host, and the session information from persistent storage.
retrieveLocationContent
This API sends a batch request to the configured Target server for multiple mbox locations.
A request will be sent to the configured Target server for mbox locations in the requests array for Target requests that have not been previously prefetched. The content for the mbox locations that have been prefetched in a previous request are returned from the SDK, and no additional network request is made. Each Target request object in the list contains a callback function, which is invoked when content is available for its given mbox location.
When using contentWithData
callback to instantiate TargetRequest object, the following keys can be used to read response tokens and Analytics for Target (A4T) info from the data payload, if available in the Target response.
- responseTokens (Response tokens)
- analytics.payload (A4T payload)
- clickmetric.analytics.payload (Click tracking A4T payload)
Java
Syntax
Copied to your clipboardpublic static void retrieveLocationContent(final List<TargetRequest> targetRequestList, final TargetParameters parameters)
targetRequestList
: A list ofTargetRequest
objects for various mbox locations.parameters
: ATargetParameters
object configured for the retrieve location request.
Example
Copied to your clipboard// define parameters for first requestMap<String, String> mboxParameters1 = new HashMap<>();mboxParameters1.put("status", "platinum");TargetParameters parameters1 = new TargetParameters.Builder().parameters(mboxParameters1).build();TargetRequest request1 = new TargetRequest("mboxName1", parameters1, "defaultContent1",new AdobeCallback<String>() {@Overridepublic void call(String value) {// do something with target content.}});// define parameters for second requestMap<String, String> mboxParameters2 = new HashMap<>();mboxParameters2.put("userType", "paid");List<String> purchasedIds = new ArrayList<String>();purchasedIds.add("34");purchasedIds.add("125");TargetOrder targetOrder = new TargetOrder("ADCKKIM", 344.30, purchasedIds);TargetProduct targetProduct = new TargetProduct("24D3412", "Books");TargetParameters parameters2 = new TargetParameters.Builder().parameters(mboxParameters2).product(targetProduct).order(targetOrder).build();TargetRequest request2 = new TargetRequest("mboxName2", parameters2, "defaultContent2",new AdobeTargetDetailedCallback() {@Overridepublic void call(final String content, final Map<String, Object> data) {if (content != null && !content.isEmpty()) {// do something with the target content.}// Read the data Map containing one or more of response tokens, analytics payload// and click metric analytics payload, if availableif (data != null && !data.isEmpty()) {Map<String, Object> responseTokens = data.containsKey("responseTokens") ?(Map<String, Object>) data.get("responseTokens") :null;Map<String, String> analyticsPayload = data.containsKey("analytics.payload") ?(Map<String, String>) data.get("analytics.payload") :null;Map<String, String> clickMetricAnalyticsPayload = data.containsKey("clickmetric.analytics.payload") ?(Map<String, String>) data.get("clickmetric.analytics.payload") :null;...}}@Overridesvoid fail(final AdobeError error) {// take appropriate action upon error.}});// Creating Array of Request ObjectsList<TargetRequest> locationRequests = new ArrayList<>();locationRequests.add(request1);locationRequests.add(request2);// Define the profile parameters map.Map<String, String> profileParameters1 = new HashMap<>();profileParameters1.put("ageGroup", "20-32");TargetParameters parameters = new TargetParameters.Builder().profileParameters(profileParameters1).build();// Call the targetRetrieveLocationContent API.Target.retrieveLocationContent(locationRequests, parameters);
Swift
Syntax
Copied to your clipboardstatic func retrieveLocationContent(_ requestArray: [TargetRequest], with targetParameters: TargetParameters? = nil)
requestArray
: An array ofTargetRequest
objects to retrieve content.targetParameters
: ATargetParameters
object containing parameters for all locations in the requests array.
Example
Copied to your clipboardlet TargetParameters1 = TargetParameters(parameters: ["status": "platinum"],profileParameters: ["age": "20"],order: TargetOrder(id: "ADCKKIM", total: 344.30, purchasedProductIds: ["34", "125"]),product: TargetProduct(productId: "24D3412", categoryId: "Books"))let TargetParameters2 = TargetParameters(parameters: ["userType": "Paid"],profileParameters: nil,order: TargetOrder(id: "ADCKKIM", total: 344.30, purchasedProductIds: ["id1", "id2"]),product: TargetProduct(productId: "764334", categoryId: "Online"))let globalTargetParameters = TargetParameters(parameters: ["status": "progressive"],profileParameters: ["age": "20-32"],order: TargetOrder(id: "ADCKKBC", total: 400.50, purchasedProductIds: ["34", "125"]),product: TargetProduct(productId: "24D334", categoryId: "Stationary"))let request1 = TargetRequest(mboxName: "logo", defaultContent: "BlueWhale", targetParameters: TargetParameters1) { content inif let content = content {// do something with the target content.}}let request2 = TargetRequest(mboxName: "logo", defaultContent: "red", targetParameters: TargetParameters2) { content, data inif let content = content {// do something with the target content.}// Read the data dictionary containing one or more of response tokens, analytics payload and click-tracking analytics payload, if available.if let data = data {let responseTokens = data["responseTokens"] as? [String: Any] ?? [:]let analyticsPayload = data["analytics.payload"] as? [String: String] ?? [:]let clickMetricAnalyticsPayload = data["clickmetric.analytics.payload"] as? [String: String] ?? [:]...}}Target.retrieveLocationContent([request1, request2], with: globalTargetParameters)
Objective-C
Syntax
Copied to your clipboard+ (void) retrieveLocationContent: (nonnull NSArray<AEPTargetRequestObject*>*) requests withParameters: (nullable AEPTargetParameters*) parameters
requests
: An array ofTargetRequest
objects to retrieve content.parameters
: AnAEPTargetParameters
object containing parameters for all locations in the requests array.
Example
Copied to your clipboardNSDictionary *mboxParameters1 = @{@"status":@"platinum"};NSDictionary *profileParameters1 = @{@"age":@"20"};AEPTargetProduct *product1 = [[AEPTargetProduct alloc] initWithProductId:@"24D3412" categoryId:@"Books"];AEPTargetOrder *order1 = [[AEPTargetOrder alloc] initWithId:@"ADCKKIM" total:[@(344.30) doubleValue] purchasedProductIds:@[@"34", @"125"]];AEPTargetParameters *targetParameters1 = [[AEPTargetParameters alloc] initWithParameters:mboxParameters1 profileParameters:profileParameters1 order:order1 product:product1 ];NSDictionary *mboxParameters2 = @{@"userType":@"Paid"};AEPTargetProduct *product2 = [[AEPTargetProduct alloc] initWithProductId:@"764334" categoryId:@"Online"];AEPTargetOrder *order2 = [[AEPTargetOrder alloc] initWithId:@"ADCKKIM" total:[@(344.30) doubleValue] purchasedProductIds:@[@"id1",@"id2"]];AEPTargetParameters *targetParameters2 = [[AEPTargetParameters alloc] initWithParameters:mboxParameters2 profileParameters:nil order:order2 product:product2 ];AEPTargetRequestObject *request1 = [[AEPTargetRequestObject alloc] initWithMboxName: @"logo" defaultContent: @"BlueWhale" targetParameters: targetParameters1 contentCallback:^(NSString * _Nullable content) {// do something with the received contentNSString *targetContent = content ?: @"";}];AEPTargetRequestObject *request2 = [[AEPTargetRequestObject alloc] initWithMboxName: @"logo" defaultContent: @"red" targetParameters: targetParameters2 contentWithDataCallback:^(NSString * _Nullable content, NSDictionary<NSString *,id> * _Nullable data) {// do something with the target content.NSString *targetContent = content ?: @"";// Read the data dictionary containing one or more of response tokens, analytics payload and click-tracking analytics payload, if available.if ([data count] > 0) {if ([data objectForKey:@"responseTokens"]) {// read response tokens}if ([data objectForKey:@"analytics.payload"]) {// read analytics payload}if ([data objectForKey:@"clickmetric.analytics.payload"]) {// read click-tracking analytics payload}}}];// Create request object arrayNSArray *requestArray = @[request1,request2];// Creating Target parametersNSDictionary *mboxParameters = @{@"status":@"progressive"};NSDictionary *profileParameters = @{@"age":@"20-32"};AEPTargetProduct *product = [[AEPTargetProduct alloc] initWithProductId:@"24D334" categoryId:@"Stationary"];AEPTargetOrder *order = [[AEPTargetOrder alloc] initWithId:@"ADCKKBC" total:[@(400.50) doubleValue] purchasedProductIds:@[@"34", @"125"]];AEPTargetParameters *targetParameters = [[AEPTargetParameters alloc] initWithParameters:mboxParametersprofileParameters:profileParametersorder:orderproduct:product];[AEPMobileTarget retrieveLocationContent: requestArray withParameters: targetParameters];
Java
Syntax
Copied to your clipboardpublic static void retrieveLocationContent(final List<TargetRequest> targetRequestList, final TargetParameters parameters)
targetRequestList
: A list ofTargetRequest
objects for various mbox locations.parameters
: ATargetParameters
object configured for the retrieve location request.
Example
Copied to your clipboard// define parameters for first requestMap<String, String> mboxParameters1 = new HashMap<>();mboxParameters1.put("status", "platinum");TargetParameters parameters1 = new TargetParameters.Builder().parameters(mboxParameters1).build();TargetRequest request1 = new TargetRequest("mboxName1", parameters1, "defaultContent1",new AdobeCallback<String>() {@Overridepublic void call(String value) {// do something with target content.}});// define parameters for second requestMap<String, String> mboxParameters2 = new HashMap<>();mboxParameters2.put("userType", "paid");List<String> purchasedIds = new ArrayList<String>();purchasedIds.add("34");purchasedIds.add("125");TargetOrder targetOrder = new TargetOrder("ADCKKIM", 344.30, purchasedIds);TargetProduct targetProduct = new TargetProduct("24D3412", "Books");TargetParameters parameters2 = new TargetParameters.Builder().parameters(mboxParameters2).product(targetProduct).order(targetOrder).build();TargetRequest request2 = new TargetRequest("mboxName2", parameters2, "defaultContent2",new AdobeTargetDetailedCallback() {@Overridepublic void call(final String content, final Map<String, Object> data) {if (content != null && !content.isEmpty()) {// do something with the target content.}// Read the data Map containing one or more of response tokens, analytics payload// and click metric analytics payload, if availableif (data != null && !data.isEmpty()) {Map<String, Object> responseTokens = data.containsKey("responseTokens") ?(Map<String, Object>) data.get("responseTokens") :null;Map<String, String> analyticsPayload = data.containsKey("analytics.payload") ?(Map<String, String>) data.get("analytics.payload") :null;Map<String, String> clickMetricAnalyticsPayload = data.containsKey("clickmetric.analytics.payload") ?(Map<String, String>) data.get("clickmetric.analytics.payload") :null;...}}@Overridesvoid fail(final AdobeError error) {// take appropriate action upon error.}});// Creating Array of Request ObjectsList<TargetRequest> locationRequests = new ArrayList<>();locationRequests.add(request1);locationRequests.add(request2);// Define the profile parameters map.Map<String, String> profileParameters1 = new HashMap<>();profileParameters1.put("ageGroup", "20-32");TargetParameters parameters = new TargetParameters.Builder().profileParameters(profileParameters1).build();// Call the targetRetrieveLocationContent API.Target.retrieveLocationContent(locationRequests, parameters);
Swift
Syntax
Copied to your clipboardstatic func retrieveLocationContent(_ requestArray: [TargetRequest], with targetParameters: TargetParameters? = nil)
requestArray
: An array ofTargetRequest
objects to retrieve content.targetParameters
: ATargetParameters
object containing parameters for all locations in the requests array.
Example
Copied to your clipboardlet TargetParameters1 = TargetParameters(parameters: ["status": "platinum"],profileParameters: ["age": "20"],order: TargetOrder(id: "ADCKKIM", total: 344.30, purchasedProductIds: ["34", "125"]),product: TargetProduct(productId: "24D3412", categoryId: "Books"))let TargetParameters2 = TargetParameters(parameters: ["userType": "Paid"],profileParameters: nil,order: TargetOrder(id: "ADCKKIM", total: 344.30, purchasedProductIds: ["id1", "id2"]),product: TargetProduct(productId: "764334", categoryId: "Online"))let globalTargetParameters = TargetParameters(parameters: ["status": "progressive"],profileParameters: ["age": "20-32"],order: TargetOrder(id: "ADCKKBC", total: 400.50, purchasedProductIds: ["34", "125"]),product: TargetProduct(productId: "24D334", categoryId: "Stationary"))let request1 = TargetRequest(mboxName: "logo", defaultContent: "BlueWhale", targetParameters: TargetParameters1) { content inif let content = content {// do something with the target content.}}let request2 = TargetRequest(mboxName: "logo", defaultContent: "red", targetParameters: TargetParameters2) { content, data inif let content = content {// do something with the target content.}// Read the data dictionary containing one or more of response tokens, analytics payload and click-tracking analytics payload, if available.if let data = data {let responseTokens = data["responseTokens"] as? [String: Any] ?? [:]let analyticsPayload = data["analytics.payload"] as? [String: String] ?? [:]let clickMetricAnalyticsPayload = data["clickmetric.analytics.payload"] as? [String: String] ?? [:]...}}Target.retrieveLocationContent([request1, request2], with: globalTargetParameters)
Objective-C
Syntax
Copied to your clipboard+ (void) retrieveLocationContent: (nonnull NSArray<AEPTargetRequestObject*>*) requests withParameters: (nullable AEPTargetParameters*) parameters
requests
: An array ofTargetRequest
objects to retrieve content.parameters
: AnAEPTargetParameters
object containing parameters for all locations in the requests array.
Example
Copied to your clipboardNSDictionary *mboxParameters1 = @{@"status":@"platinum"};NSDictionary *profileParameters1 = @{@"age":@"20"};AEPTargetProduct *product1 = [[AEPTargetProduct alloc] initWithProductId:@"24D3412" categoryId:@"Books"];AEPTargetOrder *order1 = [[AEPTargetOrder alloc] initWithId:@"ADCKKIM" total:[@(344.30) doubleValue] purchasedProductIds:@[@"34", @"125"]];AEPTargetParameters *targetParameters1 = [[AEPTargetParameters alloc] initWithParameters:mboxParameters1 profileParameters:profileParameters1 order:order1 product:product1 ];NSDictionary *mboxParameters2 = @{@"userType":@"Paid"};AEPTargetProduct *product2 = [[AEPTargetProduct alloc] initWithProductId:@"764334" categoryId:@"Online"];AEPTargetOrder *order2 = [[AEPTargetOrder alloc] initWithId:@"ADCKKIM" total:[@(344.30) doubleValue] purchasedProductIds:@[@"id1",@"id2"]];AEPTargetParameters *targetParameters2 = [[AEPTargetParameters alloc] initWithParameters:mboxParameters2 profileParameters:nil order:order2 product:product2 ];AEPTargetRequestObject *request1 = [[AEPTargetRequestObject alloc] initWithMboxName: @"logo" defaultContent: @"BlueWhale" targetParameters: targetParameters1 contentCallback:^(NSString * _Nullable content) {// do something with the received contentNSString *targetContent = content ?: @"";}];AEPTargetRequestObject *request2 = [[AEPTargetRequestObject alloc] initWithMboxName: @"logo" defaultContent: @"red" targetParameters: targetParameters2 contentWithDataCallback:^(NSString * _Nullable content, NSDictionary<NSString *,id> * _Nullable data) {// do something with the target content.NSString *targetContent = content ?: @"";// Read the data dictionary containing one or more of response tokens, analytics payload and click-tracking analytics payload, if available.if ([data count] > 0) {if ([data objectForKey:@"responseTokens"]) {// read response tokens}if ([data objectForKey:@"analytics.payload"]) {// read analytics payload}if ([data objectForKey:@"clickmetric.analytics.payload"]) {// read click-tracking analytics payload}}}];// Create request object arrayNSArray *requestArray = @[request1,request2];// Creating Target parametersNSDictionary *mboxParameters = @{@"status":@"progressive"};NSDictionary *profileParameters = @{@"age":@"20-32"};AEPTargetProduct *product = [[AEPTargetProduct alloc] initWithProductId:@"24D334" categoryId:@"Stationary"];AEPTargetOrder *order = [[AEPTargetOrder alloc] initWithId:@"ADCKKBC" total:[@(400.50) doubleValue] purchasedProductIds:@[@"34", @"125"]];AEPTargetParameters *targetParameters = [[AEPTargetParameters alloc] initWithParameters:mboxParametersprofileParameters:profileParametersorder:orderproduct:product];[AEPMobileTarget retrieveLocationContent: requestArray withParameters: targetParameters];
setPreviewRestartDeepLink
This API sets a specific location in the app to be displayed when preview mode selections have been confirmed.
Swift
Syntax
Copied to your clipboardstatic func setPreviewRestartDeepLink(_ deeplink: URL)
deeplink
: A URL that contains the preview restart deeplink.
Example
Copied to your clipboardif let url = URL(string: "myapp://HomePage") {Target.setPreviewRestartDeepLink(url)}
Objective-C
Syntax
Copied to your clipboard+ (void) setPreviewRestartDeeplink: (nonnull NSURL*) deeplink
deeplink
: A URL that contains the preview restart deeplink.
Example
Copied to your clipboard[AEPMobileTarget setPreviewRestartDeepLink:@"myapp://HomePage"];
Java
Syntax
Copied to your clipboardpublic static void setPreviewRestartDeepLink(final Uri deepLink)
deeplink
: A URL that contains the preview restart deeplink.
Example
Copied to your clipboardTarget.setPreviewRestartDeepLink("myapp://HomePage");
Swift
Syntax
Copied to your clipboardstatic func setPreviewRestartDeepLink(_ deeplink: URL)
deeplink
: A URL that contains the preview restart deeplink.
Example
Copied to your clipboardif let url = URL(string: "myapp://HomePage") {Target.setPreviewRestartDeepLink(url)}
Objective-C
Syntax
Copied to your clipboard+ (void) setPreviewRestartDeeplink: (nonnull NSURL*) deeplink
deeplink
: A URL that contains the preview restart deeplink.
Example
Copied to your clipboard[AEPMobileTarget setPreviewRestartDeepLink:@"myapp://HomePage"];
setSessionId
This API sets the Target session identifier.
The provided session ID is persisted in the SDK for a period defined by target.sessionTimeout
configuration setting. If the provided session ID is nil/null or empty, or if the privacy status is opted out, the SDK will remove the session ID value from the persistence.
This ID is preserved between app upgrades, is saved and restored during the standard application backup process, and is removed at uninstall, upon privacy status update to opted out, or when the resetExperience API is used.
Swift
Syntax
Copied to your clipboardstatic func setSessionId(_ id: String?)
id
: A string that contains the Target session identifier to be set in the SDK.
Example
Copied to your clipboardTarget.setSessionId("3f24b997-ea74-420c-81f8-96a8b92c3961")
Objective-C
Syntax
Copied to your clipboard+ (void) setSessionId: (nullable NSString*) id
id
: A string that contains the Target session identifier to be set in the SDK.
Example
Copied to your clipboard[AEPMobileTarget setSessionId:@"3f24b997-ea74-420c-81f8-96a8b92c3961"]
Java
Syntax
Copied to your clipboardpublic static void setSessionId(final String sessionId)
sessionId
: A string that contains the Target session identifier to be set in the SDK.
Example
Copied to your clipboardTarget.setSessionId("3f24b997-ea74-420c-81f8-96a8b92c3961");
Swift
Syntax
Copied to your clipboardstatic func setSessionId(_ id: String?)
id
: A string that contains the Target session identifier to be set in the SDK.
Example
Copied to your clipboardTarget.setSessionId("3f24b997-ea74-420c-81f8-96a8b92c3961")
Objective-C
Syntax
Copied to your clipboard+ (void) setSessionId: (nullable NSString*) id
id
: A string that contains the Target session identifier to be set in the SDK.
Example
Copied to your clipboard[AEPMobileTarget setSessionId:@"3f24b997-ea74-420c-81f8-96a8b92c3961"]
setThirdPartyId
This API sets the custom visitor ID for Target. This ID is preserved between app upgrades, is saved and restored during the standard application backup process, and is removed at uninstall or when the resetExperience API is used.
Swift
Syntax
Copied to your clipboardstatic func setThirdPartyId(_ id: String)
id
: A string that contains the custom visitor ID to be set in Target.
Example
Copied to your clipboardTarget.setThirdPartyId("third-party-id")
Objective-C
Syntax
Copied to your clipboard+ (void) setThirdPartyId: (nullable NSString*) thirdPartyId
id
: A string that contains the custom visitor ID to be set in Target.
Example
Copied to your clipboard[AEPMobileTarget setThirdPartyId:@"third-party-id"]
Java
Syntax
Copied to your clipboardpublic static void setThirdPartyId(final String thirdPartyId)
thirdPartyId
: A string that contains the custom visitor ID to be set in Target.
Example
Copied to your clipboardTarget.setThirdPartyId("third-party-id");
Swift
Syntax
Copied to your clipboardstatic func setThirdPartyId(_ id: String)
id
: A string that contains the custom visitor ID to be set in Target.
Example
Copied to your clipboardTarget.setThirdPartyId("third-party-id")
Objective-C
Syntax
Copied to your clipboard+ (void) setThirdPartyId: (nullable NSString*) thirdPartyId
id
: A string that contains the custom visitor ID to be set in Target.
Example
Copied to your clipboard[AEPMobileTarget setThirdPartyId:@"third-party-id"]
setTntId
This API sets the Target user identifier.
The provided tnt ID is persisted in the SDK and attached to subsequent Target requests. It is used to derive the edge host value in the SDK, which is also persisted and used in future Target requests. If the provided tnt ID is nil/null or empty, or if the privacy status is opted out, the SDK will remove the tnt ID and edge host values from the persistence.
This ID is preserved between app upgrades, is saved and restored during the standard application backup process, and is removed at uninstall, upon privacy status update to opted out, or when the resetExperience
API is used.
Swift
Syntax
Copied to your clipboardstatic func setTntId(_ id: String?)
id
: A string that contains the Target user identifier to be set in the SDK.
Example
Copied to your clipboardTarget.setTntId("f741a5d5-09c0-4931-bf53-b9e568c5f782.35_0")
Objective-C
Syntax
Copied to your clipboard+ (void) setTntId: (nullable NSString*) id
id
: A string that contains the Target user identifier to be set in the SDK.
Example
Copied to your clipboard[AEPMobileTarget setTntId:@"f741a5d5-09c0-4931-bf53-b9e568c5f782.35_0"]
Java
Syntax
Copied to your clipboardpublic static void setTntId(final String tntId)
tntId
: A string that contains the Target user identifier to be set in the SDK.
Example
Copied to your clipboardTarget.setTntId("f741a5d5-09c0-4931-bf53-b9e568c5f782.35_0");
Swift
Syntax
Copied to your clipboardstatic func setTntId(_ id: String?)
id
: A string that contains the Target user identifier to be set in the SDK.
Example
Copied to your clipboardTarget.setTntId("f741a5d5-09c0-4931-bf53-b9e568c5f782.35_0")
Objective-C
Syntax
Copied to your clipboard+ (void) setTntId: (nullable NSString*) id
id
: A string that contains the Target user identifier to be set in the SDK.
Example
Copied to your clipboard[AEPMobileTarget setTntId:@"f741a5d5-09c0-4931-bf53-b9e568c5f782.35_0"]
Visual preview
Target visual preview mode allows you to easily perform end-to-end QA activities by enrolling and previewing these activities on your device. This mode does not require a specialized testing set up. To get started, set up a URL scheme and generate the preview links.
On Android, when the application is launched as a result of a deep link, the Mobile Core's collectLaunchInfo API is internally invoked, and the Target activity and deep link information is extracted from the Intent extras.
The SDK can only collect information from the launching Activity if setApplication
API has been called. Setting the Application is only necessary on an Activity that is also an entry point for your application. However, setting the Application on each Activity has no negative impact and ensures that the SDK always has the necessary reference to your Application. We recommend that you call setApplication
API in each of your Activities.
To enter the visual preview mode, use the Mobile Core's collectLaunchInfo API to enable the mode, and select the red floating button that appears on the app screen.
Swift
Example
Copied to your clipboardMobileCore.collectLaunchInfo(["adb_deeplink" : "com.adobe.targetpreview://app.adobetarget.com?at_preview_token=tokenFromTarget"])
Objective-C
Example
Copied to your clipboard[AEPMobileCore collectLaunchInfo:@{@"adb_deeplink" : @"com.adobe.targetpreview://app.adobetarget.com?at_preview_token=tokenFromTarget"}];
On Android, when the application is launched as a result of a deep link, the Mobile Core's collectLaunchInfo API is internally invoked, and the Target activity and deep link information is extracted from the Intent extras.
The SDK can only collect information from the launching Activity if setApplication
API has been called. Setting the Application is only necessary on an Activity that is also an entry point for your application. However, setting the Application on each Activity has no negative impact and ensures that the SDK always has the necessary reference to your Application. We recommend that you call setApplication
API in each of your Activities.
To enter the visual preview mode, use the Mobile Core's collectLaunchInfo API to enable the mode, and select the red floating button that appears on the app screen.
Swift
Example
Copied to your clipboardMobileCore.collectLaunchInfo(["adb_deeplink" : "com.adobe.targetpreview://app.adobetarget.com?at_preview_token=tokenFromTarget"])
Objective-C
Example
Copied to your clipboard[AEPMobileCore collectLaunchInfo:@{@"adb_deeplink" : @"com.adobe.targetpreview://app.adobetarget.com?at_preview_token=tokenFromTarget"}];
Public classes
The following is a list of all the public classes available when using the Adobe Target extension.
Target request
Java
Syntax
Copied to your clipboardpublic class TargetRequest extends TargetObject {/*** Instantiate a TargetRequest object* @param mboxName String mbox name for this request* @param targetParameters TargetParameters for this request* @param defaultContent String default content for this request* @param contentCallback AdobeCallback<String> which will get called with Target mbox content*/public TargetRequest(final String mboxName,final TargetParameters targetParameters,final String defaultContent,final AdobeCallback<String> contentCallback);/*** Instantiate a TargetRequest object.** @param mboxName String mbox name for this request.* @param targetParameters TargetParameters for this request.* @param defaultContent String default content for this request.* @param contentWithDataCallback AdobeTargetDetailedCallback which will get called with Target mbox content and other optional data such as Target response tokens, analytics payload, click metric analytics payload if available.*/public TargetRequest(final String mboxName,final TargetParameters targetParameters,final String defaultContent,final AdobeTargetDetailedCallback contentWithDataCallback);}
Swift
Syntax
Copied to your clipboard@objc(AEPTargetRequestObject)public class TargetRequest: NSObject, Codable {@objc public let name: String@objc public let defaultContent: String@objc public let targetParameters: TargetParameters?@objc let responsePairId: String@objc var contentCallback: ((String?) -> Void)?/// Instantiate a `TargetRequest` object/// - Parameters:/// - name: `String` mbox name for this request/// - defaultContent: `String` default content for this request/// - targetParameters: `TargetParameters` for this request/// - contentCallback: which will get called with target mbox content@objc public init(mboxName: String, defaultContent: String, targetParameters: TargetParameters? = nil, contentCallback: ((String?) -> Void)? = nil) {name = mboxNameself.defaultContent = defaultContentself.targetParameters = targetParametersself.contentCallback = contentCallbackcontentWithDataCallback = nilresponsePairId = UUID().uuidString}/// Instantiate a `TargetRequest` object/// - Parameters:/// - name: `String` mbox name for this request/// - defaultContent: `String` default content for this request/// - targetParameters: `TargetParameters` for this request/// - contentWithDataCallback: which will get called with target mbox content, and an optional dictionary containing one or more of response tokens, analytics payload, and click metric analytics payload, if available.@objc public init(mboxName: String, defaultContent: String, targetParameters: TargetParameters? = nil, contentWithDataCallback: ((String?, [String: Any]?) -> Void)? = nil) {name = mboxNameself.defaultContent = defaultContentself.targetParameters = targetParametersself.contentWithDataCallback = contentWithDataCallbackcontentCallback = nilresponsePairId = UUID().uuidString}}
Example
The following example shows how to create an instance of a TargetRequest object that might be used to make a batch request to the configured Target server to fetch content for mbox locations.
Copied to your clipboardlet request1 = TargetRequest(mboxName: "mboxName", defaultContent: "default content", targetParameters: nil, contentCallback: { content inprint(content ?? "")})let request2 = TargetRequest(mboxName: "mboxName", defaultContent: "default content", targetParameters: nil, contentwithDataCallback: { content, data inprint(content ?? "")if let data = data {// read response tokenslet responseTokens = data["responseTokens"] as? [String: String] ?? [:]// read analytics payloadlet analyticsPayload = data["analytics.payload"] as? [String: String] ?? [:]// read click-tracking analytics payloadlet clickMetricAnalyticsPayload = data["clickmetric.analytics.payload"] as? [String: String] ?? [:]}})
Objective-C
Example
The following example shows how to create an instance of a TargetRequest object that might be used to make a batch request to the configured Target server to fetch content for mbox locations.
Copied to your clipboardAEPTargetRequestObject *request1 = [[AEPTargetRequestObject alloc] initWithMboxName:@"mboxName" defaultContent:@"defaultContent" targetParameters:nil contentCallback:^(NSString * _Nullable content) {NSLog(@"%@", content ?: @"");}];AEPTargetRequestObject *request2 = [[AEPTargetRequestObject alloc] initWithMboxName: @"logo" defaultContent: @"red" targetParameters: targetParameters2 contentWithDataCallback:^(NSString * _Nullable content, NSDictionary<NSString *,id> * _Nullable data) {NSLog(@"%@", content ?: @"");if ([data count] > 0) {if ([data objectForKey:@"responseTokens"]) {// read response tokens}if ([data objectForKey:@"analytics.payload"]) {// read analytics payload}if ([data objectForKey:@"clickmetric.analytics.payload"]) {// read click-tracking analytics payload}}}];
Java
Syntax
Copied to your clipboardpublic class TargetRequest extends TargetObject {/*** Instantiate a TargetRequest object* @param mboxName String mbox name for this request* @param targetParameters TargetParameters for this request* @param defaultContent String default content for this request* @param contentCallback AdobeCallback<String> which will get called with Target mbox content*/public TargetRequest(final String mboxName,final TargetParameters targetParameters,final String defaultContent,final AdobeCallback<String> contentCallback);/*** Instantiate a TargetRequest object.** @param mboxName String mbox name for this request.* @param targetParameters TargetParameters for this request.* @param defaultContent String default content for this request.* @param contentWithDataCallback AdobeTargetDetailedCallback which will get called with Target mbox content and other optional data such as Target response tokens, analytics payload, click metric analytics payload if available.*/public TargetRequest(final String mboxName,final TargetParameters targetParameters,final String defaultContent,final AdobeTargetDetailedCallback contentWithDataCallback);}
Swift
Syntax
Copied to your clipboard@objc(AEPTargetRequestObject)public class TargetRequest: NSObject, Codable {@objc public let name: String@objc public let defaultContent: String@objc public let targetParameters: TargetParameters?@objc let responsePairId: String@objc var contentCallback: ((String?) -> Void)?/// Instantiate a `TargetRequest` object/// - Parameters:/// - name: `String` mbox name for this request/// - defaultContent: `String` default content for this request/// - targetParameters: `TargetParameters` for this request/// - contentCallback: which will get called with target mbox content@objc public init(mboxName: String, defaultContent: String, targetParameters: TargetParameters? = nil, contentCallback: ((String?) -> Void)? = nil) {name = mboxNameself.defaultContent = defaultContentself.targetParameters = targetParametersself.contentCallback = contentCallbackcontentWithDataCallback = nilresponsePairId = UUID().uuidString}/// Instantiate a `TargetRequest` object/// - Parameters:/// - name: `String` mbox name for this request/// - defaultContent: `String` default content for this request/// - targetParameters: `TargetParameters` for this request/// - contentWithDataCallback: which will get called with target mbox content, and an optional dictionary containing one or more of response tokens, analytics payload, and click metric analytics payload, if available.@objc public init(mboxName: String, defaultContent: String, targetParameters: TargetParameters? = nil, contentWithDataCallback: ((String?, [String: Any]?) -> Void)? = nil) {name = mboxNameself.defaultContent = defaultContentself.targetParameters = targetParametersself.contentWithDataCallback = contentWithDataCallbackcontentCallback = nilresponsePairId = UUID().uuidString}}
Example
The following example shows how to create an instance of a TargetRequest object that might be used to make a batch request to the configured Target server to fetch content for mbox locations.
Copied to your clipboardlet request1 = TargetRequest(mboxName: "mboxName", defaultContent: "default content", targetParameters: nil, contentCallback: { content inprint(content ?? "")})let request2 = TargetRequest(mboxName: "mboxName", defaultContent: "default content", targetParameters: nil, contentwithDataCallback: { content, data inprint(content ?? "")if let data = data {// read response tokenslet responseTokens = data["responseTokens"] as? [String: String] ?? [:]// read analytics payloadlet analyticsPayload = data["analytics.payload"] as? [String: String] ?? [:]// read click-tracking analytics payloadlet clickMetricAnalyticsPayload = data["clickmetric.analytics.payload"] as? [String: String] ?? [:]}})
Objective-C
Example
The following example shows how to create an instance of a TargetRequest object that might be used to make a batch request to the configured Target server to fetch content for mbox locations.
Copied to your clipboardAEPTargetRequestObject *request1 = [[AEPTargetRequestObject alloc] initWithMboxName:@"mboxName" defaultContent:@"defaultContent" targetParameters:nil contentCallback:^(NSString * _Nullable content) {NSLog(@"%@", content ?: @"");}];AEPTargetRequestObject *request2 = [[AEPTargetRequestObject alloc] initWithMboxName: @"logo" defaultContent: @"red" targetParameters: targetParameters2 contentWithDataCallback:^(NSString * _Nullable content, NSDictionary<NSString *,id> * _Nullable data) {NSLog(@"%@", content ?: @"");if ([data count] > 0) {if ([data objectForKey:@"responseTokens"]) {// read response tokens}if ([data objectForKey:@"analytics.payload"]) {// read analytics payload}if ([data objectForKey:@"clickmetric.analytics.payload"]) {// read click-tracking analytics payload}}}];
Target prefetch
This class contains the name of the Target location/mbox and target parameters to be used in a prefetch request.
Java
Syntax
Copied to your clipboardpublic class TargetPrefetch extends TargetObject {/*** Instantiate a TargetPrefetch object* @param mboxName String mbox name for this prefetch request* @param targetParameters TargetParameters for this prefetch request*/public TargetPrefetch(final String mboxName, final TargetParameters targetParameters)}
Swift
Syntax
Copied to your clipboard/// `TargetPrefetch` class, used for specifying a mbox location.@objc(AEPTargetPrefetchObject)public class TargetPrefetch: NSObject, Codable {@objc public let name: String@objc public let targetParameters: TargetParameters?/// Instantiate a `TargetPrefetch` object/// - Parameters:/// - name: `String` mbox name for this prefetch/// - targetParameters: `TargetParameters` for this prefetch@objc public init(name: String, targetParameters: TargetParameters? = nil) {self.name = nameself.targetParameters = targetParameters}}
Example
The following example can be used to create an instance of a TargetPrefetch object that might be used to make a prefetch request to the configured Target server to prefetch content for mbox locations.
Copied to your clipboardlet prefetch = TargetPrefetch(name: "mboxName", targetParameters: nil)
Objective-C
Example
The following example can be used to create an instance of a TargetPrefetch object that might be used to make a prefetch request to the configured Target server to prefetch content for mbox locations.
Copied to your clipboardAEPTargetPrefetchObject *prefetch = [[AEPTargetPrefetchObject alloc] initWithName:@"mboxName" targetParameters:nil];
Java
Syntax
Copied to your clipboardpublic class TargetPrefetch extends TargetObject {/*** Instantiate a TargetPrefetch object* @param mboxName String mbox name for this prefetch request* @param targetParameters TargetParameters for this prefetch request*/public TargetPrefetch(final String mboxName, final TargetParameters targetParameters)}
Swift
Syntax
Copied to your clipboard/// `TargetPrefetch` class, used for specifying a mbox location.@objc(AEPTargetPrefetchObject)public class TargetPrefetch: NSObject, Codable {@objc public let name: String@objc public let targetParameters: TargetParameters?/// Instantiate a `TargetPrefetch` object/// - Parameters:/// - name: `String` mbox name for this prefetch/// - targetParameters: `TargetParameters` for this prefetch@objc public init(name: String, targetParameters: TargetParameters? = nil) {self.name = nameself.targetParameters = targetParameters}}
Example
The following example can be used to create an instance of a TargetPrefetch object that might be used to make a prefetch request to the configured Target server to prefetch content for mbox locations.
Copied to your clipboardlet prefetch = TargetPrefetch(name: "mboxName", targetParameters: nil)
Objective-C
Example
The following example can be used to create an instance of a TargetPrefetch object that might be used to make a prefetch request to the configured Target server to prefetch content for mbox locations.
Copied to your clipboardAEPTargetPrefetchObject *prefetch = [[AEPTargetPrefetchObject alloc] initWithName:@"mboxName" targetParameters:nil];
Target parameters
This class may optionally contain the mbox parameters dictionary, the profile parameters dictionary, the TargetOrder object, as well as the TargetProduct object.
Java
Syntax
Copied to your clipboardpublic class TargetParameters {private TargetParameters() {}/*** Builder used to construct a TargetParameters object*/public static class Builder {private Map<String, String> parameters;private Map<String, String> profileParameters;private TargetProduct product;private TargetOrder order;/*** Create a TargetParameters object Builder*/public Builder() {}/*** Create a TargetParameters object Builder** @param parameters mbox parameters for the built TargetParameters*/public Builder(final Map<String, String> parameters);/*** Set mbox parameters on the built TargetParameters** @param parameters mbox parameters map* @return this builder*/public Builder parameters(final Map<String, String> parameters);/*** Set profile parameters on the built TargetParameters** @param profileParameters profile parameters map* @return this builder*/public Builder profileParameters(final Map<String, String> profileParameters);/*** Set product parameters on the built TargetParameters** @param product product parameters* @return this builder*/public Builder product(final TargetProduct product);/*** Set order parameters on the built TargetParameters** @param order order parameters* @return this builder*/public Builder order(final TargetOrder order);/*** Build the TargetParameters object** @return the built TargetParameters object*/public TargetParameters build();}}
Swift
Syntax
Copied to your clipboard/// Target parameter class, used for specifying custom parameters to be sent in Target requests,/// such as location (former mbox) parameters, profile parameters, order/product parameters.@objc(AEPTargetParameters)public class TargetParameters: NSObject, Codable {@objc public let parameters: [String: String]?@objc public let profileParameters: [String: String]?@objc public let order: TargetOrder?@objc public let product: TargetProduct?/// Initialize a `TargetParameters` with the mbox parameters, the profile parameters, the order parameters and the product parameters./// - Parameters:/// - parameters: the mbox parameters/// - profileParameters: the profile parameters/// - order: the order parameters/// - product: the product parameters@objc public init(parameters: [String: String]? = nil, profileParameters: [String: String]? = nil, order: TargetOrder? = nil, product: TargetProduct? = nil) {self.parameters = parametersself.profileParameters = profileParametersself.order = orderself.product = product}}
Examples for creating instances of TargetParameters can be seen in the Target overview.
Java
Syntax
Copied to your clipboardpublic class TargetParameters {private TargetParameters() {}/*** Builder used to construct a TargetParameters object*/public static class Builder {private Map<String, String> parameters;private Map<String, String> profileParameters;private TargetProduct product;private TargetOrder order;/*** Create a TargetParameters object Builder*/public Builder() {}/*** Create a TargetParameters object Builder** @param parameters mbox parameters for the built TargetParameters*/public Builder(final Map<String, String> parameters);/*** Set mbox parameters on the built TargetParameters** @param parameters mbox parameters map* @return this builder*/public Builder parameters(final Map<String, String> parameters);/*** Set profile parameters on the built TargetParameters** @param profileParameters profile parameters map* @return this builder*/public Builder profileParameters(final Map<String, String> profileParameters);/*** Set product parameters on the built TargetParameters** @param product product parameters* @return this builder*/public Builder product(final TargetProduct product);/*** Set order parameters on the built TargetParameters** @param order order parameters* @return this builder*/public Builder order(final TargetOrder order);/*** Build the TargetParameters object** @return the built TargetParameters object*/public TargetParameters build();}}
Swift
Syntax
Copied to your clipboard/// Target parameter class, used for specifying custom parameters to be sent in Target requests,/// such as location (former mbox) parameters, profile parameters, order/product parameters.@objc(AEPTargetParameters)public class TargetParameters: NSObject, Codable {@objc public let parameters: [String: String]?@objc public let profileParameters: [String: String]?@objc public let order: TargetOrder?@objc public let product: TargetProduct?/// Initialize a `TargetParameters` with the mbox parameters, the profile parameters, the order parameters and the product parameters./// - Parameters:/// - parameters: the mbox parameters/// - profileParameters: the profile parameters/// - order: the order parameters/// - product: the product parameters@objc public init(parameters: [String: String]? = nil, profileParameters: [String: String]? = nil, order: TargetOrder? = nil, product: TargetProduct? = nil) {self.parameters = parametersself.profileParameters = profileParametersself.order = orderself.product = product}}
Examples for creating instances of TargetParameters can be seen in the Target overview.
Target order
This class contains an orderId, an order total, and an array for purchasedProductIds.
Java
Syntax
Copied to your clipboardpublic class TargetOrder {/*** Initialize a TargetOrder with an order id, order total and a list of purchasedProductIds** @param id String order id* @param total double order total amount* @param purchasedProductIds a list of purchased product ids*/public TargetOrder(final String id, final double total, final List<String> purchasedProductIds);/*** Get the order id** @return order id*/public String getId();/*** Get the order total** @return order total*/public double getTotal();/*** Get the order purchasedProductIds** @return a list of this order's purchased product ids*/public List<String> getPurchasedProductIds();}
Swift
Syntax
Copied to your clipboard/// Class for specifying Target order parameters@objc(AEPTargetOrder)public class TargetOrder: NSObject, Codable {@objc public let orderId: String@objc public let total: Double@objc public let purchasedProductIds: [String]?/// Initialize a `TargetOrder` with an order `id`, order `total` and a list of `purchasedProductIds`/// - Parameters:/// - id: `String` order id/// - total: `Double` order total amount/// - purchasedProductIds: a list of purchased product ids@objc public init(id: String, total: Double = 0, purchasedProductIds: [String]? = nil) {orderId = idself.total = totalself.purchasedProductIds = purchasedProductIds}}
Examples for creating instances of TargetOrder can be seen in the Target overview.
Java
Syntax
Copied to your clipboardpublic class TargetOrder {/*** Initialize a TargetOrder with an order id, order total and a list of purchasedProductIds** @param id String order id* @param total double order total amount* @param purchasedProductIds a list of purchased product ids*/public TargetOrder(final String id, final double total, final List<String> purchasedProductIds);/*** Get the order id** @return order id*/public String getId();/*** Get the order total** @return order total*/public double getTotal();/*** Get the order purchasedProductIds** @return a list of this order's purchased product ids*/public List<String> getPurchasedProductIds();}
Swift
Syntax
Copied to your clipboard/// Class for specifying Target order parameters@objc(AEPTargetOrder)public class TargetOrder: NSObject, Codable {@objc public let orderId: String@objc public let total: Double@objc public let purchasedProductIds: [String]?/// Initialize a `TargetOrder` with an order `id`, order `total` and a list of `purchasedProductIds`/// - Parameters:/// - id: `String` order id/// - total: `Double` order total amount/// - purchasedProductIds: a list of purchased product ids@objc public init(id: String, total: Double = 0, purchasedProductIds: [String]? = nil) {orderId = idself.total = totalself.purchasedProductIds = purchasedProductIds}}
Examples for creating instances of TargetOrder can be seen in the Target overview.
Target product
This class contains the productId and categoryId.
Java
Syntax
Copied to your clipboardpublic class TargetProduct {/*** Initialize a TargetProduct with a product id and a productCategoryId categoryId** @param id String product id* @param categoryId String product category id*/public TargetProduct(final String id, final String categoryId);/*** Get the product id** @return product id*/public String getId();/*** Get the product categoryId** @return product category id*/public String getCategoryId();}
Swift
Syntax
Copied to your clipboard/// Class for specifying Target product parameters@objc(AEPTargetProduct)public class TargetProduct: NSObject, Codable {@objc public let productId: String@objc public let categoryId: String?/// Initialize a `TargetProduct` with a product id and a productCategoryId./// - Parameters:/// - productId: product id/// - categoryId: product category id@objc public init(productId: String, categoryId: String? = nil) {self.productId = productIdself.categoryId = categoryId}}
Examples for creating instances of TargetProduct can be seen in the Target overview
Java
Syntax
Copied to your clipboardpublic class TargetProduct {/*** Initialize a TargetProduct with a product id and a productCategoryId categoryId** @param id String product id* @param categoryId String product category id*/public TargetProduct(final String id, final String categoryId);/*** Get the product id** @return product id*/public String getId();/*** Get the product categoryId** @return product category id*/public String getCategoryId();}
Swift
Syntax
Copied to your clipboard/// Class for specifying Target product parameters@objc(AEPTargetProduct)public class TargetProduct: NSObject, Codable {@objc public let productId: String@objc public let categoryId: String?/// Initialize a `TargetProduct` with a product id and a productCategoryId./// - Parameters:/// - productId: product id/// - categoryId: product category id@objc public init(productId: String, categoryId: String? = nil) {self.productId = productIdself.categoryId = categoryId}}
Examples for creating instances of TargetProduct can be seen in the Target overview
Target callback
Android
Java
Syntax
Copied to your clipboardpublic interface AdobeTargetDetailedCallback {/*** Callback function to pass the mbox content and other mbox payload values.** @param content {@code String} mox content* @param data A {@code Map<String, Object>} of mbox payload values. It will be null if neither response tokens nor analytics payload is available.*/void call(final String content, final Map<String, Object> data);/*** Callback function for notifying about the internal error in getting mbox details.** @param error {@link AdobeError} represents the internal error occurred.*/void fail(final AdobeError error);}
Java
Syntax
Copied to your clipboardpublic interface AdobeTargetDetailedCallback {/*** Callback function to pass the mbox content and other mbox payload values.** @param content {@code String} mox content* @param data A {@code Map<String, Object>} of mbox payload values. It will be null if neither response tokens nor analytics payload is available.*/void call(final String content, final Map<String, Object> data);/*** Callback function for notifying about the internal error in getting mbox details.** @param error {@link AdobeError} represents the internal error occurred.*/void fail(final AdobeError error);}