Java
Syntax
Copied to your clipboardpublic static void clearPrefetchCache()
Example
Copied to your clipboardTarget.clearPrefetchCache();
Syntax
Copied to your clipboard+ (void) clearPrefetchCache;
Example
Swift
Copied to your clipboardACPTarget.clearPrefetchCache
Objective-C
Copied to your clipboard[ACPTarget clearPrefetchCache];
React Native
Syntax
Copied to your clipboardclearPrefetchCache();
Example
Copied to your clipboardACPTarget.clearPrefetchCache();
Java
Syntax
Copied to your clipboardpublic String extensionVersion()
Example
Copied to your clipboardTarget.extensionVersion();
Syntax
Copied to your clipboard+ (nonnull NSString*) extensionVersion;
Example
Swift
Copied to your clipboardlet targetVersion = ACPTarget.extensionVersion()
Objective-C
Copied to your clipboardNSString *targetVersion = [ACPTarget extensionVersion];
JavaScript
Syntax
Copied to your clipboardextensionVersion(): Promise<string>
Example
Copied to your clipboardACPTarget.extensionVersion().then(version => {// read Target extension version});
Java
Syntax
Copied to your clipboardpublic static void getSessionId(final AdobeCallback<String> callback)
- callback is invoked with the
sessionId
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}});
Java
Syntax
Copied to your clipboardpublic static void getThirdPartyId(final AdobeCallback<String> callback)
- callback is invoked with the
thirdPartyId
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}});
Syntax
Copied to your clipboard+ (void) getThirdPartyId: (nonnull void (^) (NSString* __nullable thirdPartyId)) callback;
- callback is invoked with the
thirdPartyId
value. If no third-party ID was set, this value will benil
.
Example
Swift
Copied to your clipboardACPTarget.getThirdPartyId({thirdPartyID in// read Target thirdPartyId})
Objective-C
Copied to your clipboard[ACPTarget getThirdPartyId:^(NSString *thirdPartyId){// read Target thirdPartyId}];
JavaScript
Syntax
Copied to your clipboardgetThirdPartyId(): Promise<string>
- A Promise object is returned and is resolved with the
thirdPartyId
value.
Example
Copied to your clipboardACPTarget.getThirdPartyId().then(thirdPartyId => {// read Target thirdPartyId});
Java
Syntax
Copied to your clipboardpublic static void getTntId(final AdobeCallback<String> callback)
- callback is invoked with the
tntId
value. If no Target ID was set, this value will benull
.
Example
Copied to your clipboardTarget.getTntId(new AdobeCallback<String>() {@Overridepublic void call(String tntId) {// read target's tntid}});
Syntax
Copied to your clipboard+ (void) getTntId: (nonnull void (^) (NSString* __nullable tntId)) callback;
- callback is invoked with the
tntId
value. If no Target ID was set, this value will benil
.
Example
Swift
Copied to your clipboardACPTarget.getTntId({tntId in// read target's tntId})
Objective-C
Copied to your clipboard[ACPTarget getTntId:^(NSString *tntId){// read target's tntId}];
JavaScript
Syntax
Copied to your clipboardgetTntId(): Promise<string>
- A Promise object is returned and is resolved with the
thirdPartyId
value.
Example
Copied to your clipboardACPTarget.getTntId().then(tntId => {// read target's tntId});
Java
Syntax
Copied to your clipboardpublic static void locationClicked(final String mboxName, final TargetParameters parameters)
- mboxName is a String that contains the mbox location for which the click notification will be sent to Target.
- parameters is the configured
TargetParameters
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.locationClicked("cartLocation", targetParameters);
Syntax
Copied to your clipboard+ (void) locationClickedWithName: (nonnull NSString*) name targetParameters: (nullable ACPTargetParameters*) parameters;
- name is an NSString that contains the mbox location for which the click notification will be sent to Target.
- parameters is the configured
ACPTargetParameters
for the request.
Example
Swift
Copied to your clipboard// Mbox parameterslet mboxParameters = ["membership": "prime"]// Product parameterslet productParameters = ["id": "CEDFJC","categoryId": "Electronics"]// Order parameterslet orderParameters = ["id": "NJJICK","total": "650","purchasedProductIds": "81, 123, 190"]// Profile parameterslet profileParameters = ["ageGroup": "20-32"]// Create Target parameterslet product = ACPTargetProduct(id: "24D334", categoryId: "Stationary")let order = ACPTargetOrder(id: "ADCKKBC", total: NSNumber(value: 400.50), purchasedProductIds: ["34", "125"])let targetParameters = ACPTargetParameters(parameters: nil, profileParameters: nil, product: product, order: order)ACPTarget.locationClicked(withName: "cartLocation", targetParameters: targetParameters)
Objective-C
Copied to your clipboard// Mbox parametersNSDictionary *mboxParameters = @{@"membership":@"prime"};// Product parametersNSDictionary *productParameters = @{@"id":@"CEDFJC",@"categoryId":@"Electronics"};// Order parametersNSDictionary *orderParameters = @{@"id":@"NJJICK",@"total":@"650",@"purchasedProductIds":@"81, 123, 190"};// Profile parametersNSDictionary *profileParameters = @{@"ageGroup":@"20-32"};// Create Target parametersACPTargetProduct *product = [ACPTargetProduct targetProductWithId:@"24D334" categoryId:@"Stationary"];ACPTargetOrder *order = [ACPTargetOrder targetOrderWithId:@"ADCKKBC" total:@(400.50) purchasedProductIds:@[@"34", @"125"]];ACPTargetParameters *targetParameters = [ACPTargetParameters targetParametersWithParameters:nilprofileParameters:nilproduct:productorder:order];[ACPTarget locationClickedWithName:@"cartLocation" targetParameters:targetParameters];
JavaScript
Syntax
Copied to your clipboardlocationClickedWithName(name: string, parameters?: ACPTargetParameters)
- name is a string that contains the mbox location for which the click notification will be sent to Target.
- parameters is the configured
ACPTargetParameters
for the request.
Example
Copied to your clipboard// Mbox parametersvar mboxParameters = {"membership": "prime"};// Product parametersvar productParameters = new ACPTargetProduct("CEDFJC", "Electronics");// Order parametersvar orderParameters = new ACPTargetOrder("NJJICK", 650, ["81","123","190"]);// Profile parametersvar profileParameters = {"ageGroup": "20-32"};// Create Target parametersvar product = new ACPTargetProduct("24D334", "Stationary");var order = new ACPTargetOrder("ADCKKBC", 400.50, ["34","125"]);var targetParameters = new ACPTargetParameters(null, null, product, order);ACPTarget.locationClickedWithName("cartLocation", targetParameters);
Java
Syntax
Copied to your clipboardpublic static void locationsDisplayed(final List<String> mboxNames, final TargetParameters targetParameters)
- mboxNames is a list of the mbox locations for which the display notification will be sent to Target.
- targetParameters is the configured
TargetParameters
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.locationsDisplayed(mboxList, targetParameters);
Syntax
Copied to your clipboard+ (void) locationsDisplayed: (nonnull NSArray<NSString*>*) mboxNameswithTargetParameters: (nullable ACPTargetParameters*) targetParameters;
- mboxNames is an NSArray of the mbox locations for which the display notification will be sent to Target.
- targetParameters is the configured
ACPTargetParameters
for the request.
Example
Swift
Copied to your clipboardlet product = ACPTargetProduct(id: "24D334", categoryId: "Stationary")let order = ACPTargetOrder(id: "ADCKKBC", total: NSNumber(value: 400.50), purchasedProductIds: ["34", "125"])let targetParameters = ACPTargetParameters(parameters: nil, profileParameters: nil, product: product, order: order)ACPTarget.locationsDisplayed(["mboxName1", "mboxName2"], with: targetParameters)
Objective-C
Copied to your clipboardACPTargetProduct *product = [ACPTargetProduct targetProductWithId:@"24D334" categoryId:@"Stationary"];ACPTargetOrder *order = [ACPTargetOrder targetOrderWithId:@"ADCKKBC" total:@(400.50) purchasedProductIds:@[@"34", @"125"]];ACPTargetParameters *targetParameters = [ACPTargetParameters targetParametersWithParameters:nilprofileParameters:nilproduct:productorder:order];[ACPTarget locationsDisplayed:@[@"mboxName1", @"mboxName2"] withTargetParameters:targetParameters];
JavaScript
Syntax
Copied to your clipboardlocationsDisplayed(mboxNames: Array<string>, parameters?: ACPTargetParameters)
- mboxNames is an Array of the mbox locations for which the display notification will be sent to Target.
- targetParameters is the configured
ACPTargetParameters
for the request.
Example
Copied to your clipboardvar product = new ACPTargetProduct("24D334", "Stationary");var order = new ACPTargetOrder("ADCKKBC", 400.50, ["34", "125"]);var targetParameters = new ACPTargetParameters(null, null, product, order);ACPTarget.locationsDisplayed(["mboxName1", "mboxName2"], targetParameters);
Java
Syntax
Copied to your clipboardpublic static void prefetchContent(final List<TargetPrefetch> mboxPrefetchList, final TargetParameters parameters, final AdobeCallback<String> callback)
- mboxPrefetchList is a list of
TargetPrefetch
objects for various mbox locations. - parameters is the configured
TargetParameters
for the prefetch request. - If the prefetch is successful, callback is invoked with a
null
value. If the prefetch is not successful, an error message is returned.
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);
Syntax
Copied to your clipboard+ (void) prefetchContent: (nonnull NSArray<ACPTargetPrefetchObject*>*) prefetchObjectArraywithParameters: (nullable ACPTargetParameters*) parameterscallback: (nullable void (^) (NSError* _Nullable error)) callback;
Example
Swift
Copied to your clipboardlet mboxParameters1 = ["status": "platinum"]let profileParameters1 = ["age": "20"]let product1 = ACPTargetProduct(id: "24D3412", categoryId: "Books")let order1 = ACPTargetOrder(id: "ADCKKIM", total: NSNumber(value: 344.30), purchasedProductIds: ["34", "125"])let targetParameters1 = ACPTargetParameters(parameters: mboxParameters1, profileParameters: profileParameters1, product: product1, order: order1)let mboxParameters2 = ["userType": "Paid"]let product2 = ACPTargetProduct(id: "764334", categoryId: "Online")let order2 = ACPTargetOrder(id: "ADCKKIM", total: NSNumber(value: 344.30), purchasedProductIds: ["id1", "id2"])let targetParameters2 = ACPTargetParameters(parameters: mboxParameters2, profileParameters: nil, product: product2, order: order2)// Creating Prefetch Objectslet prefetch1 = ACPTargetPrefetchObject(name: "logo", targetParameters: targetParameters1)let prefetch2 = ACPTargetPrefetchObject(name: "buttonColor", targetParameters: targetParameters2)// Creating prefetch Arraylet prefetchArray = [prefetch1, prefetch2]// Creating Target parameterslet mboxParameters = ["status": "progressive"]let profileParameters = ["age": "20-32"]let product = ACPTargetProduct(id: "24D334", categoryId: "Stationary")let order = ACPTargetOrder(id: "ADCKKBC", total: NSNumber(value: 400.50), purchasedProductIds: ["34", "125"])let targetParameters = ACPTargetParameters(parameters: mboxParameters, profileParameters: profileParameters, product: product, order: order)// Target API CallACPTarget.prefetchContent(prefetchArray, with: targetParameters, callback: { error in// do something with the callback response})
Objective-C
Copied to your clipboardNSDictionary *mboxParameters1 = @{@"status":@"platinum"};NSDictionary *profileParameters1 = @{@"age":@"20"};ACPTargetProduct *product1 = [ACPTargetProduct targetProductWithId:@"24D3412" categoryId:@"Books"];ACPTargetOrder *order1 = [ACPTargetOrder targetOrderWithId:@"ADCKKIM" total:@(344.30) purchasedProductIds:@[@"34", @"125"]];ACPTargetParameters *targetParameters1 = [ACPTargetParameters targetParametersWithParameters:mboxParameters1profileParameters:profileParameters1product:product1order:order1];NSDictionary *mboxParameters2 = @{@"userType":@"Paid"};ACPTargetProduct *product2 = [ACPTargetProduct targetProductWithId:@"764334" categoryId:@"Online"];ACPTargetOrder *order2 = [ACPTargetOrder targetOrderWithId:@"ADCKKIM" total:@(344.30) purchasedProductIds:@[@"id1",@"id2"]];ACPTargetParameters *targetParameters2 = [ACPTargetParameters targetParametersWithParameters:mboxParameters2profileParameters:nilproduct:product2order:order2];// Creating Prefetch ObjectsACPTargetPrefetchObject *prefetch1 = [ACPTargetPrefetchObject targetPrefetchObjectWithName:@"logo"targetParameters:targetParameters1];ACPTargetPrefetchObject *prefetch2 = [ACPTargetPrefetchObject targetPrefetchObjectWithName:@"buttonColor"targetParameters:targetParameters2];// Creating prefetch ArrayNSArray *prefetchArray = @[prefetch1,prefetch2];// Creating Target parametersNSDictionary *mboxParameters = @{@"status":@"progressive"};NSDictionary *profileParameters = @{@"age":@"20-32"};ACPTargetProduct *product = [ACPTargetProduct targetProductWithId:@"24D334" categoryId:@"Stationary"];ACPTargetOrder *order = [ACPTargetOrder targetOrderWithId:@"ADCKKBC" total:@(400.50) purchasedProductIds:@[@"34", @"125"]];ACPTargetParameters *targetParameters = [ACPTargetParameters targetParametersWithParameters:mboxParametersprofileParameters:profileParametersproduct:productorder:order];// Target API Call[ACPTarget prefetchContent:prefetchArray withParameters:targetParameters callback:^(NSError * _Nullable error){// do something with the callback response}];
JavaScript
Syntax
Copied to your clipboardprefetchContent(prefetchObjectArray: Array<ACPTargetPrefetchObject>, parameters?: ACPTargetParameters): Promise<any>
- prefetchObjectArray is an Array of
ACPTargetPrefetchObject
objects for various mbox locations. - parameters is the configured
ACPTargetParameters
for the prefetch request. - A Promise object is returned and is resolved with true value or is rejected with the reason for the error.
Example
Copied to your clipboardvar mboxParameters1 = {"status": "platinum"};var profileParameters1 = {"age": "20"};var product1 = new ACPTargetProduct("24D3412", "Books");var order1 = new ACPTargetOrder("ADCKKIM", 344.30, ["34","125"]);var targetParameters1 = new ACPTargetParameters(mboxParameters1, profileParameters1, product1, order1);var mboxParameters2 = {"userType": "Paid"};var product2 = new ACPTargetProduct("764334", "Online");var order2 = new ACPTargetOrder("ADCKKIM", 344.30, ["id1","id2"]);var targetParameters2 = new ACPTargetParameters(mboxParameters2, null, product2, order2);// Creating Prefetch Objectsvar prefetch1 = new ACPTargetPrefetchObject("logo", targetParameters1);var prefetch2 = new ACPTargetPrefetchObject("buttonColor", targetParameters2);// Creating prefetch Arrayvar prefetchList = [prefetch1, prefetch2];// Creating Target parametersvar mboxParameters = {"status": "progressive"};var profileParameters = {"age": "20-32"};var product = new ACPTargetProduct("24D334", "Stationary");var order = new ACPTargetOrder("ADCKKBC", 400.50, ["34","125"]);var targetParameters = new ACPTargetParameters(mboxParameters, profileParameters, product, order);// Target API CallACPTarget.prefetchContent(prefetchList, targetParameters).then(success => console.log(success)).catch(err => console.log(err));
Java
Syntax
Copied to your clipboardpublic static void registerExtension()
Example
Copied to your clipboardTarget.registerExtension();
Syntax
Copied to your clipboard+ (void) registerExtension;
Example
Swift
Copied to your clipboardACPTarget.registerExtension()
Objective-C
Copied to your clipboard[ACPTarget registerExtension];
When using React Native, register the Target extension with Mobile Core in native code as shown on the Android and iOS tabs.
Java
Syntax
Copied to your clipboardpublic static void resetExperience()
Example
Copied to your clipboardTarget.resetExperience();
Syntax
Copied to your clipboard+ (void) resetExperience;
Example
Swift
Copied to your clipboardACPTarget.resetExperience()
Objective-C
Copied to your clipboard[ACPTarget resetExperience];
JavaScript
Syntax
Copied to your clipboardresetExperience()
Example
Copied to your clipboardACPTarget.resetExperience();
Java
Syntax
Copied to your clipboardpublic static void retrieveLocationContent(final List<TargetRequest> targetRequestList, final TargetParameters parameters)
- targetRequestList is a list of
TargetRequest
objects for various mbox locations. - parameters is the configured
TargetParameters
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, String> responseTokens = data.containsKey("responseTokens") ?(Map<String, String>) 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);
Syntax
Copied to your clipboard+ (void) retrieveLocationContent: (nonnull NSArray<ACPTargetRequestObject*>*) requestswithParameters: (nullable ACPTargetParameters*) parameters;
- requests is an NSArray of
ACPTargetRequestObject
objects for various mbox locations. - parameters is the configured
ACPTargetParameters
for the load request.
Example
Swift
Copied to your clipboardlet mboxParameters1 = ["status": "platinum"]let product1 = ACPTargetProduct(id: "24D3412", categoryId: "Books")let order1 = ACPTargetOrder(id: "ADCKKIM", total: NSNumber(value: 344.30), purchasedProductIds: ["a", "b"])let mboxParameters2 = ["userType": "Paid"]let product2 = ACPTargetProduct(id: "764334", categoryId: "Online")let order2 = ACPTargetOrder(id: "4t4uxksa", total: NSNumber(value: 54.90), purchasedProductIds: ["id1", "id2"])let params1 = ACPTargetParameters(parameters: mboxParameters1, profileParameters: nil, product: product1, order: order1)let request1 = ACPTargetRequestObject(name: "logo", targetParameters: params1, defaultContent: "BlueWhale", callback: { content in// do something with the received content})let params2 = ACPTargetParameters(parameters: mboxParameters2, profileParameters: nil, product: product2, order: order2)let request2 = ACPTargetRequestObject(name: "logo", targetParameters: params2, defaultContent: "red", callback: { content in// do something with the received content})// Create request object arraylet requestArray = [request1, request2]// Creating Target parameterslet mboxParameters = ["status": "progressive"]let profileParameters = ["age": "20-32"]let product = ACPTargetProduct(id: "24D334", categoryId: "Stationary")let order = ACPTargetOrder(id: "ADCKKBC", total: NSNumber(value: 400.50), purchasedProductIds: ["34", "125"])let targetParameters = ACPTargetParameters(parameters: mboxParameters, profileParameters: profileParameters, product: product, order: order)// Call the APIACPTarget.retrieveLocationContent(requestArray, with: targetParameters)
Objective-C
Copied to your clipboardNSDictionary *mboxParameters1 = @{@"status":@"platinum"};ACPTargetProduct *product1 = [ACPTargetProduct targetProductWithId:@"24D3412" categoryId:@"Books"];ACPTargetOrder *order1 = [ACPTargetOrder targetOrderWithId:@"ADCKKIM" total:@(344.30) purchasedProductIds:@[@"a", @"b"]];NSDictionary *mboxParameters2 = @{@"userType":@"Paid"};ACPTargetProduct *product2 = [ACPTargetProduct targetProductWithId:@"764334" categoryId:@"Online"];ACPTargetOrder *order2 = [ACPTargetOrder targetOrderWithId:@"4t4uxksa" total:@(54.90) purchasedProductIds:@[@"id1",@"id2"]];ACPTargetParameters *params1 = [ACPTargetParameters targetParametersWithParameters:mboxParameters1profileParameters:nilproduct:product1order:order1];ACPTargetRequestObject *request1 = [ACPTargetRequestObject targetRequestObjectWithName:@"logo" targetParameters:params1defaultContent:@"BlueWhale" callback:^(NSString * _Nullable content) {// do something with the received content}];ACPTargetParameters *params2 = [ACPTargetParameters targetParametersWithParameters:mboxParameters2profileParameters:nilproduct:product2order:order2];ACPTargetRequestObject *request2 = [ACPTargetRequestObject targetRequestObjectWithName:@"logo" targetParameters:params2defaultContent:@"red" callback:^(NSString * _Nullable content) {// do something with the received content}];// Create request object arrayNSArray *requestArray = @[request1,request2];// Creating Target parametersNSDictionary *mboxParameters = @{@"status":@"progressive"};NSDictionary *profileParameters = @{@"age":@"20-32"};ACPTargetProduct *product = [ACPTargetProduct targetProductWithId:@"24D334" categoryId:@"Stationary"];ACPTargetOrder *order = [ACPTargetOrder targetOrderWithId:@"ADCKKBC" total:@(400.50) purchasedProductIds:@[@"34", @"125"]];ACPTargetParameters *targetParameters = [ACPTargetParameters targetParametersWithParameters:mboxParametersprofileParameters:profileParametersproduct:productorder:order];// Call the API[ACPTarget retrieveLocationContent:requestArray withParameters:targetParameters];
JavaScript
Syntax
Copied to your clipboardretrieveLocationContent(requests: Array<ACPTargetRequestObject>, parameters?: ACPTargetParameters)
- requests is an Array of
ACPTargetRequestObject
objects for various mbox locations. - parameters is the configured
ACPTargetParameters
for the load request.
Example
Copied to your clipboardvar mboxParameters1 = {"status": "platinum"};var product1 = new ACPTargetProduct("24D3412", "Books");var order1 = new ACPTargetOrder("ADCKKIM", 344.30, ["a","b"]);var mboxParameters2 = {"userType": "Paid"};var product2 = new ACPTargetProduct("764334", "Online");var order2 = new ACPTargetOrder("4t4uxksa", 54.90, ["id1","id2"]);var params1 = new ACPTargetParameters(mboxParameters1, null, product1, order1);var request1 = new ACPTargetRequestObject("logo", params1, "BlueWhale", (error, content) => {if (error) {console.error(error);} else {console.log("Target content:" + content);}});var params2 = new ACPTargetParameters(mboxParameters2, null, product2, order2);var request2 = new ACPTargetRequestObject("logo", params1, "red", (error, content) => {if (error) {console.error(error);} else {console.log("Target content:" + content);}});// Create request object arraylet requestArray = [request1, request2]// Creating Target parametersvar mboxParameters = {"status": "progressive"};var profileParameters = {"age": "20-32"};var product = new ACPTargetProduct("24D334", "Stationary");var order = new ACPTargetOrder("ADCKKBC", 400.50, ["34","125"]);var targetParameters = new ACPTargetParameters(mboxParameters, profileParameters, product, order);// Target API CallACPTarget.retrieveLocationContent(requestArray, targetParameters);
Java
Syntax
Copied to your clipboardpublic static void setPreviewRestartDeepLink(final Uri deepLink)
- deeplink is a URI that contains the preview restart deeplink.
Example
Copied to your clipboardTarget.setPreviewRestartDeepLink("myapp://HomePage");
Syntax
Copied to your clipboard+ (void) setPreviewRestartDeeplink: (nonnull NSURL*) deeplink;
- deeplink is an NSURL that contains the preview restart deeplink.
Example
Swift
Copied to your clipboardACPTarget.setPreviewRestartDeepLink("myapp://HomePage")
Objective-C
Copied to your clipboard[ACPTarget setPreviewRestartDeepLink:@"myapp://HomePage"];
JavaScript
Syntax
Copied to your clipboardsetPreviewRestartDeeplink(deepLink: string)
- deepLink is a string that contains the preview restart deeplink.
Example
Copied to your clipboardACPTarget.setPreviewRestartDeeplink("myapp://HomePage");
Java
Syntax
Copied to your clipboardpublic static void setSessionId(final String sessionId)
- sessionId is 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");
Java
Syntax
Copied to your clipboardpublic static void setThirdPartyId(final String thirdPartyId)
- thirdPartyId is a String that contains the custom visitor ID to be set in Target.
Example
Copied to your clipboardTarget.setThirdPartyId("third-party-id");
Syntax
Copied to your clipboard+ (void) setThirdPartyId: (nullable NSString*) thirdPartyId;
- thirdPartyId is a NSString that contains the custom visitor ID to be set in Target.
Example
Swift
Copied to your clipboardACPTarget.setThirdPartyId("third-party-id")
Objective-C
Copied to your clipboard[ACPTarget setThirdPartyId:@"third-party-id"];
JavaScript
Syntax
Copied to your clipboardsetThirdPartyId(thirdPartyId: string)
- thirdPartyId is a string that contains the custom visitor ID to be set in Target.
Example
Copied to your clipboardACPTarget.setThirdPartyId("third-party-id");
Java
Syntax
Copied to your clipboardpublic static void setTntId(final String tntId)
- tntId is 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");
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 clipboardACPCore.collectLaunchInfo(["adb_deeplink" : "com.adobe.targetpreview://app.adobetarget.com?at_preview_token=tokenFromTarget"])
Objective-C
Example
Copied to your clipboard[ACPCore collectLaunchInfo: @{@"adb_deeplink":@"com.adobe.targetpreview://app.adobetarget.com?at_preview_token=tokenFromTarget"}];`
TargetRequest
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);}
ACPTargetRequestObject
This class extends ACPTargetPrefetchObject
by adding default content and a callback block that will be invoked to return mbox content from Target.
Objective-C
Syntax
Copied to your clipboard@interface ACPTargetRequestObject : ACPTargetPrefetchObject/* The default content that will be returned if Target servers are unreachable */@property(nonatomic, strong, nonnull) NSString* defaultContent;/* Optional. When batch requesting Target locations, callback will be invoked when content is available for this location. */@property(nonatomic, strong, nullable) void (^callback)(NSString* __nullable content);@end
Example
The following method can be used to create an instance of ACPTargetRequestObject that might be used to make a batch request to the configured Target server to fetch content for mbox locations.
Copied to your clipboard+ (nonnull instancetype) targetRequestObjectWithName: (nonnull NSString*) nametargetParameters: (nullable ACPTargetParameters*) targetParametersdefaultContent: (nonnull NSString*) defaultContentcallback: (nullable void (^) (NSString* __nullable content)) callback;
ACPTargetRequestObject
This class extends ACPTargetPrefetchObject
by adding default content and a callback block that is invoked to return mbox content from Target.
JavaScript
Syntax
Copied to your clipboardclass ACPTargetRequestObject extends ACPTargetPrefetchObject {defaultContent: string;constructor(name: string, targetParameters: ACPTargetParameters, defaultContent: string) {super(name, targetParameters);this.defaultContent = defaultContent;}}
TargetPrefetch
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)}
ACPTargetPrefetchObject
This class contains the name of the Target location/mbox and target parameters to be used in a prefetch request.
Objective-C
Syntax
Copied to your clipboard@interface ACPTargetPrefetchObject : NSObject/* The name of the Target location/mbox */@property(nonatomic, strong, nullable) NSString* name;/* Target parameters associated with the prefetch object. You can set all other parameters in this object */@property(nonatomic, strong, nullable) ACPTargetParameters* targetParameters;@end
Example
The following method can be used to create an instance of ACPTargetPrefetchObject that might be used to make a prefetch request to the configured Target server to prefetch content for mbox locations.
Copied to your clipboard+ (nonnull instancetype) targetPrefetchObjectWithName: (nonnull NSString*) nametargetParameters: (nullable ACPTargetParameters*) targetParameters;
ACPTargetPrefetchObject
This class contains the name of the Target location/mbox and Target parameters to be used in a prefetch request.
JavaScript
Syntax
Copied to your clipboardclass ACPTargetPrefetchObject {name: string;targetParameters: ACPTargetParameters;constructor(name?: string, targetParameters?: ACPTargetParameters) {this.name = name;this.targetParameters = targetParameters;}}
TargetParameters
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();}}
ACPTargetParameters
This class contains mbox parameters dictionary, profile parameters dictionary, ACPTargetOrder object as well as ACPTargetProduct object.
Objective-C
Syntax
Copied to your clipboard@interface ACPTargetParameters : NSObject/* Dictionary containing key-value pairs of parameters */@property(nonatomic, strong, nullable) NSDictionary<NSString*, NSString*>* parameters;/* Dictionary containing key-value pairs of profile parameters */@property(nonatomic, strong, nullable) NSDictionary<NSString*, NSString*>* profileParameters;/* ACPTargetOrder object */@property(nonatomic, strong, nullable) ACPTargetOrder* order;/* ACPTargetProduct object */@property(nonatomic, strong, nullable) ACPTargetProduct* product;@end
Examples for creating instances of ACPTargetParameters can be seen in the Target overview
ACPTargetParameters
This class contains an mbox parameters dictionary, a profile parameters dictionary, an ACPTargetOrder
object, and an ACPTargetProduct
object.
JavaScript
Syntax
Copied to your clipboardclass ACPTargetParameters {parameters: {string: string};profileParameters: {string: string};order: ACPTargetOrder;product: ACPTargetProduct;constructor(parameters?: {string: string}, profileParameters?: {string: string}, product?: ACPTargetProduct, order?: ACPTargetOrder) {this.parameters = parameters;this.profileParameters = profileParameters;this.product = product;this.order = order;}}
TargetOrder
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();}
ACPTargetOrder
This class contains orderId, total, and an array for purchasedProductIds.
Objective-C
Syntax
Copied to your clipboard@interface ACPTargetOrder : NSObject/* Order ID */@property(nonatomic, strong, nonnull) NSString* orderId;/* Order total */@property(nonatomic, strong, nullable) NSNumber* total;/* Array of Purchased Product Ids */@property(nonatomic, strong, nullable) NSArray<NSString*>* purchasedProductIds;@end
Examples for creating instances of ACPTargetOrder can be seen in the Target overview
ACPTargetOrder
This class contains an orderId
, the total, and an array, for purchasedProductIds
.
JavaScript
Syntax
Copied to your clipboardclass ACPTargetOrder {orderId: string;total: number;purchasedProductIds: Array<string>;constructor(orderId: string, total?: number, purchasedProductIds: Array<string>) {this.orderId = orderId;this.total = total;this.purchasedProductIds = purchasedProductIds;}}
TargetProduct
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();}
ACPTargetProduct
This class contains productId and categoryId.
Objective-C
Syntax
Copied to your clipboard@interface ACPTargetProduct : NSObject/* Product ID */@property(nonatomic, strong, nullable) NSString* productId;/* Category ID */@property(nonatomic, strong, nullable) NSString* categoryId;@end
Examples for creating instances of ACPTargetProduct can be seen in the Target overview
ACPTargetProduct
This class contains a productId and a categoryId.
JavaScript
Syntax
Copied to your clipboardclass ACPTargetProduct {productId: string;categoryId: string;constructor(productId: string, categoryId: string) {this.productId = productId;this.categoryId = categoryId;}}
AdobeTargetDetailedCallback
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);}