This API clears the in-memory cache that contains the prefetched offers.
This API gets the current Target extension version.
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 null
value.
public static void getThirdPartyId(final AdobeCallback<String> callback)
Target.getThirdPartyId(new AdobeCallback<String>() {@Overridepublic void call(String thirdPartyId) {// read Target thirdPartyId}});
callback is invoked with the thirdPartyId
value. If no third-party ID was set, this value will be null
.
+ (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 be nil
.
Here are the examples in Objective C and Swift:
[ACPTarget getThirdPartyId:^(NSString *thirdPartyId){// read Target thirdPartyId}];
Swift
ACPTarget.getThirdPartyId({thirdPartyID in// read Target thirdPartyId})
This API gets the Target user identifier. Target returns the tntId
with a successful call to loadRequests
or prefetchContent
, 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.
+ (void) getTntId: (nonnull void (^) (NSString* __nullable tntId)) callback;
callback is invoked with the tntId
value. If no Target ID was set, this value will be nil
.
Here are some examples in Objective C and Swift:
Objective C
[ACPTarget getTntId:^(NSString *tntId){// read target's tntId}];
Swift
ACPTarget.getTntId({tntId in// read target's tntId})
This API sends a location (mbox) click notification 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.
For a click notification to be sent to Target, ensure that the click metric is enabled for the specified mbox name in Target.
public static void locationClicked(final String mboxName, final TargetParameters parameters)
mboxName is a String the contains the mbox location for which the click notification will be sent to Target.
parameters is the configured TargetParameters
for the request.
// 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);
+ (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.
Here are some examples in Objective C and Swift:
// 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];
Swift
// 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)
locationClickedWithName(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.
JavaScript
// 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);
Use this API to send a location (mbox) display notification to the configured Target server. This 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.
Do not use this API with the deprecated loadRequests API. For a prefetched mbox, after calling the deprecated loadRequests
API, the mbox display notification is sent internally to the Target server by the SDK.
public 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.
List<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);
+ (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.
Here are some examples in Objective C and Swift:
Objective C
ACPTargetProduct *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];
Swift
let 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)
locationsDisplayed(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.
JavaScript
var 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);
This API sends a prefetch request to your configured Target server with the prefetch objects array and the specified target parameters. For more information, see Offer prefetch.
public static void prefetchContent(final List<TargetPrefetch> targetPrefetchList,final TargetParameters targetParameters,final final AdobeCallback<String> callback);
targetPrefetchList is a list of TargetPrefetch
objects for various mbox locations.
targetParameters 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.
// 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);
+ (void) prefetchContent: (nonnull NSArray<ACPTargetPrefetchObject*>*) targetPrefetchObjectArraywithParameters: (nullable ACPTargetParameters*) targetParameterscallback: (nullable void (^) (NSError* _Nullable error)) callback;
targetPrefetchObjectArray is an array of ACPTargetPrefetchObject
objects for various mbox locations.
targetParameters is the configured ACPTargetParameters
for the prefetch request.
If the prefetch is successful, callback is invoked with a nil
value. If the prefetch is not successful, an error message is returned.
Here are some examples in Objective C and Swift:
Objective C
NSDictionary *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}];
Swift
let 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})
prefetchContent(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.
JavaScript
var 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));
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.
This API sends a batch request to the configured Target server for multiple mbox locations.
The main difference with the deprecated loadRequests API is in usage with prefetch APIs. For a prefetched mbox, unlike loadRequests
API, invoking this API does not send a display notification to the configured Target server. If you do not have an existing prefetch content call, and you send a batch request to Target, there is no difference in behaviors of the retrieveLocationContent
and loadRequests
APIs.
For mbox locations in the Target requests list that are not already prefetched, this API sends a batch request to the configured Target server. 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.
public 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 load request.
// 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 AdobeCallback<String>() {@Overridepublic void call(String value) {// do something with target content.}});// 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);
+ (void) retrieveLocationContent: (nonnull NSArray<ACPTargetRequestObject*>*) requestswithParameters: (nullable ACPTargetParameters*) parameters;
ACPTargetRequestObject is an NSArray of ACPTargetRequestObject
objects for various mbox locations.
parameters is the configured ACPTargetParameters
for the load request.
Here are some examples in Objective C and Swift:
Objective C
NSDictionary *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];
Swift
let 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)
retrieveLocationContent(requests: Array<ACPTargetRequestObject>, parameters?: ACPTargetParameters)
ACPTargetRequestObject is an Array of ACPTargetRequestObject
objects for various mbox locations.
parameters is the configured ACPTargetParameters
for the load request.
JavaScript
var 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);
This API sets the Target preview URL to be displayed when the preview mode is enabled and preview selections are confirmed.
+ (void) setPreviewRestartDeeplink: (nonnull NSURL*) deeplink;
deeplink is an NSURL that contains the preview restart deeplink.
Here are some examples in Objective C and Swift:
Objective C
[ACPTarget setPreviewRestartDeepLink:@"myapp://HomePage"];
Swift
ACPTarget.setPreviewRestartDeepLink("myapp://HomePage")
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.
+ (void) setThirdPartyId: (nullable NSString*) thirdPartyId;
thirdPartyId is a NSString that contains the custom visitor ID to be set in Target.
Here are some examples in Objective C and Swift:
[ACPTarget setThirdPartyId:@"third-party-id"];
Swift
ACPTarget.setThirdPartyId("third-party-id")
Here is a code sample for this class in Android:
public 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);/*** Sets mbox parameters for the request.** @param mboxParameters Map<String, String> mbox parameters*/void setMboxParameters(final Map<String, String> mboxParameters);/*** Sets profile parameters for the request.** @param profileParameters Map<String, String profile parameters*/void setProfileParameters(final Map<String, String> profileParameters);/*** Sets order parameters for the request.** @param orderParameters Map<String, Object> order parameters*/void setOrderParameters(final Map<String, Object> orderParameters);/*** Sets product parameters for the request.** @param productParameters Map<String, String> product parameters*/void setProductParameters(final Map<String, String> productParameters);/*** Sets targetParameters for the request.** @param targetParameters TargetParameters for the request.*/void setTargetParameters(final TargetParameters targetParameters);}
Here is a code sample for this class in Android:
public 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)/*** Sets mbox parameters for the request.** @param mboxParameters Map<String, String> mbox parameters*/void setMboxParameters(final Map<String, String> mboxParameters);/*** Sets profile parameters for the request.** @param profileParameters Map<String, String profile parameters*/void setProfileParameters(final Map<String, String> profileParameters);/*** Sets order parameters for the request.** @param orderParameters Map<String, Object> order parameters*/void setOrderParameters(final Map<String, Object> orderParameters);/*** Sets product parameters for the request.** @param productParameters Map<String, String> product parameters*/void setProductParameters(final Map<String, String> productParameters);/*** Sets targetParameters for the request.** @param targetParameters TargetParameters for the request.*/void setTargetParameters(final TargetParameters targetParameters);}
Here is a code sample for this class in Android:
public 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*/