Edit in GitHubLog an issue

Java

Syntax

Copied to your clipboard
public static void clearPrefetchCache()

Example

Copied to your clipboard
Target.clearPrefetchCache();

Syntax

Copied to your clipboard
+ (void) clearPrefetchCache;

Example

Swift

Copied to your clipboard
ACPTarget.clearPrefetchCache

Objective-C

Copied to your clipboard
[ACPTarget clearPrefetchCache];

React Native

Syntax

Copied to your clipboard
clearPrefetchCache();

Example

Copied to your clipboard
ACPTarget.clearPrefetchCache();

Java

Syntax

Copied to your clipboard
public String extensionVersion()

Example

Copied to your clipboard
Target.extensionVersion();

Syntax

Copied to your clipboard
+ (nonnull NSString*) extensionVersion;

Example

Swift

Copied to your clipboard
let targetVersion = ACPTarget.extensionVersion()

Objective-C

Copied to your clipboard
NSString *targetVersion = [ACPTarget extensionVersion];

JavaScript

Syntax

Copied to your clipboard
extensionVersion(): Promise<string>

Example

Copied to your clipboard
ACPTarget.extensionVersion().then(version => {
// read Target extension version
});

Java

Syntax

Copied to your clipboard
public static void getSessionId(final AdobeCallback<String> callback)
  • callback is invoked with the sessionId value, or null if there was an error retrieving it.

Example

Copied to your clipboard
Target.getSessionId(new AdobeCallback<String>() {
@Override
public void call(String sessionId) {
// read Target sessionId
}
});

Java

Syntax

Copied to your clipboard
public static void getThirdPartyId(final AdobeCallback<String> callback)
  • callback is invoked with the thirdPartyId value. If no third-party ID was set, this value will be null.

Example

Copied to your clipboard
Target.getThirdPartyId(new AdobeCallback<String>() {
@Override
public 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 be nil.

Example

Swift

Copied to your clipboard
ACPTarget.getThirdPartyId({thirdPartyID in
// read Target thirdPartyId
})

Objective-C

Copied to your clipboard
[ACPTarget getThirdPartyId:^(NSString *thirdPartyId){
// read Target thirdPartyId
}];

JavaScript

Syntax

Copied to your clipboard
getThirdPartyId(): Promise<string>
  • A Promise object is returned and is resolved with the thirdPartyId value.

Example

Copied to your clipboard
ACPTarget.getThirdPartyId().then(thirdPartyId => {
// read Target thirdPartyId
});

Java

Syntax

Copied to your clipboard
public static void getTntId(final AdobeCallback<String> callback)
  • callback is invoked with the tntId value. If no Target ID was set, this value will be null.

Example

Copied to your clipboard
Target.getTntId(new AdobeCallback<String>() {
@Override
public 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 be nil.

Example

Swift

Copied to your clipboard
ACPTarget.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 clipboard
getTntId(): Promise<string>
  • A Promise object is returned and is resolved with the thirdPartyId value.

Example

Copied to your clipboard
ACPTarget.getTntId().then(tntId => {
// read target's tntId
});

Java

Syntax

Copied to your clipboard
public 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 parameters
Map<String, String> mboxParameters = new HashMap<>();
mboxParameters.put("membership", "prime");
// Product parameters
TargetProduct targetProduct = new TargetProduct("CEDFJC", "Electronics");
// Order parameters
List<String> purchasedIds = new ArrayList<String>();
purchasedIds.add("81");
purchasedIds.add("123");
purchasedIds.add("190");
TargetOrder targetOrder = new TargetOrder("NJJICK", "650", purchasedIds);
// Profile parameters
Map<String, String> profileParameters = new HashMap<>();
profileParameters.put("ageGroup", "20-32");
// Create Target Parameters
TargetParameters 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 parameters
let mboxParameters = [
"membership": "prime"
]
// Product parameters
let productParameters = [
"id": "CEDFJC",
"categoryId": "Electronics"
]
// Order parameters
let orderParameters = [
"id": "NJJICK",
"total": "650",
"purchasedProductIds": "81, 123, 190"
]
// Profile parameters
let profileParameters = [
"ageGroup": "20-32"
]
// Create Target parameters
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.locationClicked(withName: "cartLocation", targetParameters: targetParameters)

Objective-C

Copied to your clipboard
// Mbox parameters
NSDictionary *mboxParameters = @{@"membership":@"prime"};
// Product parameters
NSDictionary *productParameters = @{@"id":@"CEDFJC",
@"categoryId":@"Electronics"};
// Order parameters
NSDictionary *orderParameters = @{@"id":@"NJJICK",
@"total":@"650",
@"purchasedProductIds":@"81, 123, 190"};
// Profile parameters
NSDictionary *profileParameters = @{@"ageGroup":@"20-32"};
// Create Target parameters
ACPTargetProduct *product = [ACPTargetProduct targetProductWithId:@"24D334" categoryId:@"Stationary"];
ACPTargetOrder *order = [ACPTargetOrder targetOrderWithId:@"ADCKKBC" total:@(400.50) purchasedProductIds:@[@"34", @"125"]];
ACPTargetParameters *targetParameters = [ACPTargetParameters targetParametersWithParameters:nil
profileParameters:nil
product:product
order:order];
[ACPTarget locationClickedWithName:@"cartLocation" targetParameters:targetParameters];

JavaScript

Syntax

Copied to your clipboard
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.

Example

Copied to your clipboard
// Mbox parameters
var mboxParameters = {"membership": "prime"};
// Product parameters
var productParameters = new ACPTargetProduct("CEDFJC", "Electronics");
// Order parameters
var orderParameters = new ACPTargetOrder("NJJICK", 650, ["81","123","190"]);
// Profile parameters
var profileParameters = {"ageGroup": "20-32"};
// Create Target parameters
var 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 clipboard
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.

Example

Copied to your clipboard
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);

Syntax

Copied to your clipboard
+ (void) locationsDisplayed: (nonnull NSArray<NSString*>*) mboxNames
withTargetParameters: (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 clipboard
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)

Objective-C

Copied to your clipboard
ACPTargetProduct *product = [ACPTargetProduct targetProductWithId:@"24D334" categoryId:@"Stationary"];
ACPTargetOrder *order = [ACPTargetOrder targetOrderWithId:@"ADCKKBC" total:@(400.50) purchasedProductIds:@[@"34", @"125"]];
ACPTargetParameters *targetParameters = [ACPTargetParameters targetParametersWithParameters:nil
profileParameters:nil
product:product
order:order];
[ACPTarget locationsDisplayed:@[@"mboxName1", @"mboxName2"] withTargetParameters:targetParameters];

JavaScript

Syntax

Copied to your clipboard
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.

Example

Copied to your clipboard
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);

Java

Syntax

Copied to your clipboard
public 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 request
Map<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 request
Map<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*>*) prefetchObjectArray
withParameters: (nullable ACPTargetParameters*) parameters
callback: (nullable void (^) (NSError* _Nullable error)) callback;

Example

Swift

Copied to your clipboard
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 Objects
let prefetch1 = ACPTargetPrefetchObject(name: "logo", targetParameters: targetParameters1)
let prefetch2 = ACPTargetPrefetchObject(name: "buttonColor", targetParameters: targetParameters2)
// Creating prefetch Array
let prefetchArray = [prefetch1, prefetch2]
// Creating Target parameters
let 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 Call
ACPTarget.prefetchContent(prefetchArray, with: targetParameters, callback: { error in
// do something with the callback response
})

Objective-C

Copied to your clipboard
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:mboxParameters1
profileParameters:profileParameters1
product:product1
order: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:mboxParameters2
profileParameters:nil
product:product2
order:order2];
// Creating Prefetch Objects
ACPTargetPrefetchObject *prefetch1 = [ACPTargetPrefetchObject targetPrefetchObjectWithName:@"logo"
targetParameters:targetParameters1];
ACPTargetPrefetchObject *prefetch2 = [ACPTargetPrefetchObject targetPrefetchObjectWithName:@"buttonColor"
targetParameters:targetParameters2];
// Creating prefetch Array
NSArray *prefetchArray = @[prefetch1,prefetch2];
// Creating Target parameters
NSDictionary *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:mboxParameters
profileParameters:profileParameters
product:product
order:order];
// Target API Call
[ACPTarget prefetchContent:prefetchArray withParameters:targetParameters callback:^(NSError * _Nullable error){
// do something with the callback response
}];

JavaScript

Syntax

Copied to your clipboard
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.

Example

Copied to your clipboard
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 Objects
var prefetch1 = new ACPTargetPrefetchObject("logo", targetParameters1);
var prefetch2 = new ACPTargetPrefetchObject("buttonColor", targetParameters2);
// Creating prefetch Array
var prefetchList = [prefetch1, prefetch2];
// Creating Target parameters
var 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 Call
ACPTarget.prefetchContent(prefetchList, targetParameters).then(success => console.log(success)).catch(err => console.log(err));

Java

Syntax

Copied to your clipboard
public static void registerExtension()

Example

Copied to your clipboard
Target.registerExtension();

Syntax

Copied to your clipboard
+ (void) registerExtension;

Example

Swift

Copied to your clipboard
ACPTarget.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 clipboard
public static void resetExperience()

Example

Copied to your clipboard
Target.resetExperience();

Syntax

Copied to your clipboard
+ (void) resetExperience;

Example

Swift

Copied to your clipboard
ACPTarget.resetExperience()

Objective-C

Copied to your clipboard
[ACPTarget resetExperience];

JavaScript

Syntax

Copied to your clipboard
resetExperience()

Example

Copied to your clipboard
ACPTarget.resetExperience();

Java

Syntax

Copied to your clipboard
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 retrieve location request.

Example

Copied to your clipboard
// define parameters for first request
Map<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>() {
@Override
public void call(String value) {
// do something with target content.
}
});
// define parameters for second request
Map<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() {
@Override
public 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 available
if (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;
...
}
}
@Overrides
void fail(final AdobeError error) {
// take appropriate action upon error.
}
});
// Creating Array of Request Objects
List<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*>*) requests
withParameters: (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 clipboard
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 array
let requestArray = [request1, request2]
// Creating Target parameters
let 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 API
ACPTarget.retrieveLocationContent(requestArray, with: targetParameters)

Objective-C

Copied to your clipboard
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:mboxParameters1
profileParameters:nil
product:product1
order:order1];
ACPTargetRequestObject *request1 = [ACPTargetRequestObject targetRequestObjectWithName:@"logo" targetParameters:params1
defaultContent:@"BlueWhale" callback:^(NSString * _Nullable content) {
// do something with the received content
}];
ACPTargetParameters *params2 = [ACPTargetParameters targetParametersWithParameters:mboxParameters2
profileParameters:nil
product:product2
order:order2];
ACPTargetRequestObject *request2 = [ACPTargetRequestObject targetRequestObjectWithName:@"logo" targetParameters:params2
defaultContent:@"red" callback:^(NSString * _Nullable content) {
// do something with the received content
}];
// Create request object array
NSArray *requestArray = @[request1,request2];
// Creating Target parameters
NSDictionary *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:mboxParameters
profileParameters:profileParameters
product:product
order:order];
// Call the API
[ACPTarget retrieveLocationContent:requestArray withParameters:targetParameters];

JavaScript

Syntax

Copied to your clipboard
retrieveLocationContent(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 clipboard
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 array
let requestArray = [request1, request2]
// Creating Target parameters
var 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 Call
ACPTarget.retrieveLocationContent(requestArray, targetParameters);

Java

Syntax

Copied to your clipboard
public static void setPreviewRestartDeepLink(final Uri deepLink)
  • deeplink is a URI that contains the preview restart deeplink.

Example

Copied to your clipboard
Target.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 clipboard
ACPTarget.setPreviewRestartDeepLink("myapp://HomePage")

Objective-C

Copied to your clipboard
[ACPTarget setPreviewRestartDeepLink:@"myapp://HomePage"];

JavaScript

Syntax

Copied to your clipboard
setPreviewRestartDeeplink(deepLink: string)
  • deepLink is a string that contains the preview restart deeplink.

Example

Copied to your clipboard
ACPTarget.setPreviewRestartDeeplink("myapp://HomePage");

Java

Syntax

Copied to your clipboard
public 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 clipboard
Target.setSessionId("3f24b997-ea74-420c-81f8-96a8b92c3961");

Java

Syntax

Copied to your clipboard
public 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 clipboard
Target.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 clipboard
ACPTarget.setThirdPartyId("third-party-id")

Objective-C

Copied to your clipboard
[ACPTarget setThirdPartyId:@"third-party-id"];

JavaScript

Syntax

Copied to your clipboard
setThirdPartyId(thirdPartyId: string)
  • thirdPartyId is a string that contains the custom visitor ID to be set in Target.

Example

Copied to your clipboard
ACPTarget.setThirdPartyId("third-party-id");

Java

Syntax

Copied to your clipboard
public 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 clipboard
Target.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 clipboard
ACPCore.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 clipboard
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);
/**
* 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*) name
targetParameters: (nullable ACPTargetParameters*) targetParameters
defaultContent: (nonnull NSString*) defaultContent
callback: (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 clipboard
class ACPTargetRequestObject extends ACPTargetPrefetchObject {
defaultContent: string;
constructor(name: string, targetParameters: ACPTargetParameters, defaultContent: string) {
super(name, targetParameters);
this.defaultContent = defaultContent;
}
}

TargetPrefetch

Java

Syntax

Copied to your clipboard
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)
}

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*) name
targetParameters: (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 clipboard
class ACPTargetPrefetchObject {
name: string;
targetParameters: ACPTargetParameters;
constructor(name?: string, targetParameters?: ACPTargetParameters) {
this.name = name;
this.targetParameters = targetParameters;
}
}

TargetParameters

Java

Syntax

Copied to your clipboard
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
*/
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 clipboard
class 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 clipboard
public 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 clipboard
class 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 clipboard
public 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 clipboard
class ACPTargetProduct {
productId: string;
categoryId: string;
constructor(productId: string, categoryId: string) {
this.productId = productId;
this.categoryId = categoryId;
}
}

AdobeTargetDetailedCallback

Java

Syntax

Copied to your clipboard
public 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);
}
Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.