Target API reference
This API clears the in-memory cache that contains the prefetched offers.
Android
iOS (AEP 3.x)
iOS (ACP 2.x)
React Native
Syntax
public static void clearPrefetchCache()
Example
Target.clearPrefetchCache();
Syntax
static func clearPrefetchCache()
Example
Swift
Target.clearPrefetchCache()
Objective-C
[AEPMobileTarget clearPrefetchCache];
Syntax
+ (void) clearPrefetchCache;
Example
Swift
ACPTarget.clearPrefetchCache
Objective-C
[ACPTarget clearPrefetchCache];
Signature
clearPrefetchCache();
Example usage
ACPTarget.clearPrefetchCache();
This API sends a location click notification for an mbox to the configured Target server and can be invoked in the following cases:
- For a prefetched mbox, after the mbox content is retrieved using the
retrieveLocationContent
API. - For a regular mbox, where no previous prefetch request is made, and the mbox content is retrieved using the
retrieveLocationContent
API.
Android
iOS (AEP 3.x)
iOS (ACP 2.x)
React Native
Syntax
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
// 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
static func clickedLocation(_ name: String, targetParameters: TargetParameters?)
- name : a
String
that contains the mbox location for which the click notification will be sent to Target. - targetParameters : the configured
TargetParameters
for the request.
Example
Swift
Target.clickedLocation("aep-loc-1", targetParameters: TargetParameters(parameters: ["mbox_parameter_key": "mbox_parameter_value"], profileParameters: ["name": "Smith"], order: TargetOrder(id: "id1", total: 1.0, purchasedProductIds: ["ppId1"]), product: TargetProduct(productId: "pId1", categoryId: "cId1")))
Objective-C
AEPTargetOrder *order = [[AEPTargetOrder alloc] initWithId:@"id1" total:1.0 purchasedProductIds:@[@"ppId1"]];
AEPTargetProduct *product =[[AEPTargetProduct alloc] initWithProductId:@"pId1" categoryId:@"cId1"];
AEPTargetParameters * targetParams = [[AEPTargetParameters alloc] initWithParameters:@{@"mbox_parameter_key":@"mbox_parameter_value"} profileParameters:@{@"name":@"Smith"} order:order product:product];
[AEPMobileTarget clickedLocation:@"aep-loc-1" withTargetParameters:targetParams];
Syntax
+ (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
// 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
// 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];
Syntax
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
// 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);
This API sends a location display notification for an mbox to the configured Target server. The API should be invoked for a prefetched mbox after the mbox content is retrieved using the
retrieveLocationContent
API. If no previous prefetch request is made, and the mbox content is retrieved using the retrieveLocationContent
API, calling this API does not trigger a notification request to the Target server.Android
iOS (AEP 3.x)
iOS (ACP 2.x)
React Native
Syntax
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
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
static func displayedLocations(_ names: [String], targetParameters: TargetParameters?)
- names : is an
array
of the mbox locations for which the display notification will be sent to Target. - targetParameters : is the configured
TargetParameters
for the request.
Example
Swift
Target.displayedLocations(
["mboxName1", "mboxName2"],
targetParameters: TargetParameters(
parameters: nil,
profileParameters: nil,
order: TargetOrder(id: "ADCKKBC", total: 400.50, purchasedProductIds: ["34", "125"]),
product: TargetProduct(productId: "24D334", categoryId: "Stationary")
)
)
Objective-C
AEPTargetOrder *order = [[AEPTargetOrder alloc] initWithId:@"ADCKKBC" total:400.50 purchasedProductIds:@[@"34", @"125"]];
AEPTargetProduct *product =[[AEPTargetProduct alloc] initWithProductId:@"24D334" categoryId:@"Stationary"];
AEPTargetParameters * targetParams = [[AEPTargetParameters alloc] initWithParameters:nil profileParameters:nil order:order product:product];
[AEPMobileTarget displayedLocations:@[@"mboxName1", @"mboxName2"] withTargetParameters:targetParams];
Syntax
+ (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
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
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];
Syntax
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
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);
Returns the running version of the Target extension.
Android
iOS (AEP 3.x)
iOS (ACP 2.x)
React Native
Syntax
public String extensionVersion()
Example
Target.extensionVersion();
Syntax
static var extensionVersion: String
Example
Swift
let targetVersion = Target.extensionVersion
Objective-C
NSString *targetVersion = [AEPMobileTarget extensionVersion];
Syntax
+ (nonnull NSString*) extensionVersion;
Example
Swift
let targetVersion = ACPTarget.extensionVersion()
Objective-C
NSString *targetVersion = [ACPTarget extensionVersion];
Syntax
extensionVersion(): Promise<string>
Example
ACPTarget.extensionVersion().then(version => {
// read Target extension version
});
This API gets the Target session identifier.
The session ID is generated locally in the SDK upon initial Target request and persisted for a period defined by
target.sessionTimeout
configuration setting. If the session timeout happens upon a subsequent Target request, a new session ID will be generated for use in the request and persisted in the SDK.Android
iOS (AEP 3.x)
iOS (ACP 2.x)
Syntax
public static void getSessionId(final AdobeCallback<String> callback)
- callback is invoked with the
sessionId
value, ornull
if there was an error retrieving it.
Example
Target.getSessionId(new AdobeCallback<String>() {
@Override
public void call(String sessionId) {
// read Target sessionId
}
});
Syntax
static func getThirdPartyId(_ completion: @escaping (String?, Error?) -> Void)
- completion : invoked with the
sessionId
value, ornil
if there was an error retrieving it.
Example
Swift
Target.getSessionId { (id, err) in
// read Target sessionId
}
Objective-C
[AEPMobileTarget getSessionId:^(NSString *sessionId, NSError *error){
// read Target sessionId
}];
This API is not available in Target iOS ACP 2.x SDK.
This API gets the custom visitor ID for Target. If no
third-party
ID was previously set, or if the ID was reset by calling resetExperience API, it will have a nil
value.Android
iOS (AEP 3.x)
iOS (ACP 2.x)
React Native
Syntax
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 benull
.
Example
Target.getThirdPartyId(new AdobeCallback<String>() {
@Override
public void call(String thirdPartyId) {
// read Target thirdPartyId
}
});
Syntax
static func getThirdPartyId(_ completion: @escaping (String?, Error?) -> Void)
- completion : invoked with the
thirdPartyId
value. If nothird-party
ID was set, this value will benil
.
Example
Swift
Target.getThirdPartyId { (id, err) in
// read Target thirdPartyId
}
Objective-C
[AEPMobileTarget getThirdPartyId:^(NSString *thirdPartyID, NSError *error){
// read Target thirdPartyId
}];
Syntax
+ (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
ACPTarget.getThirdPartyId({thirdPartyID in
// read Target thirdPartyId
})
Objective-C
[ACPTarget getThirdPartyId:^(NSString *thirdPartyId){
// read Target thirdPartyId
}];
Syntax
getThirdPartyId(): Promise<string>
- A Promise object is returned and is resolved with the
thirdPartyId
value.
Example
ACPTarget.getThirdPartyId().then(thirdPartyId => {
// read Target thirdPartyId
});
This API gets the Target user identifier (also known as the
tntId
).The tnt ID is returned in the network response from Target after a successful call to
prefetchContent
API or retrieveLocationContent
API, which is then persisted in the SDK. The persisted tnt ID is used in subsequent Target requests until a different tnt ID is returned from Target, or a new tnt ID is set using setTntId
API.Android
iOS (AEP 3.x)
iOS (ACP 2.x)
React Native
Syntax
public static void getTntId(final AdobeCallback<String> callback)
- callback is invoked with the
tntId
value, ornull
if there was an error retrieving it.
Example
Target.getTntId(new AdobeCallback<String>() {
@Override
public void call(String tntId) {
// read Target's tntid
}
});
Syntax
static func getTntId(_ completion: @escaping (String?, Error?) -> Void)
- completion : invoked with the
tntId
value, ornil
if there was an error retrieving it.
Example
Swift
Target.getTntId({ (id, err) in
// read Target's tntId
})
Objective-C
[AEPMobileTarget getTntId:^(NSString *tntId, NSError *error){
// read Target's tntId
}];
Syntax
+ (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
ACPTarget.getTntId({tntId in
// read Target's tntId
})
Objective-C
[ACPTarget getTntId:^(NSString *tntId){
// read Target's tntId
}];
Syntax
getTntId(): Promise<string>
- A Promise object is returned and is resolved with the
thirdPartyId
value.
Example
ACPTarget.getTntId().then(tntId => {
// read target's tntId
});
This API sends a prefetch request to your configured Target server. The prefetch request is sent with the prefetch objects array and the specified Target parameters.
Android
iOS (AEP 3.x)
iOS (ACP 2.x)
React Native
Syntax
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
// 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
static func prefetchContent(_ prefetchArray: [TargetPrefetch], with targetParameters: TargetParameters? = nil, _ completion: ((Error?) -> Void)?)
- prefetchArray - is an array of
TargetPrefetch
objects for various mbox locations. - targetParameters - is the configured
TargetParameters
for the prefetch request. - If the prefetch is successful,
completion
is invoked with a nil value. If the prefetch is not successful, an error message is returned.
Example
Swift
let TargetParameters1 = TargetParameters(
parameters: ["status": "platinum"],
profileParameters: ["age": "20"],
order: TargetOrder(id: "ADCKKIM", total: 344.30, purchasedProductIds: ["34", "125"]),
product: TargetProduct(productId: "24D3412", categoryId:"Books")
)
let TargetParameters2 = TargetParameters(
parameters: ["userType": "Paid"],
profileParameters: nil,
order: TargetOrder(id: "ADCKKIM", total: 344.30, purchasedProductIds: ["id1", "id2"]),
product: TargetProduct(productId: "764334", categoryId:"Online")
)
let globalTargetParameters = TargetParameters(
parameters: ["status": "progressive"],
profileParameters: ["age": "20-32"],
order: TargetOrder(id: "ADCKKBC", total: 400.50, purchasedProductIds: ["34", "125"]),
product: TargetProduct(productId: "24D334", categoryId:"Stationary")
)
Target.prefetchContent([
TargetPrefetch(name: "mboxName1", targetParameters: TargetParameters1),
TargetPrefetch(name: "mboxName2", targetParameters: TargetParameters2),
],
with: globalTargetParameters
){ error in
// do something with the callback response
}
Objective-C
NSDictionary *mboxParameters1 = @{@"status":@"platinum"};
NSDictionary *profileParameters1 = @{@"age":@"20"};
AEPTargetProduct *product1 = [[AEPTargetProduct alloc] initWithProductId:@"24D3412" categoryId:@"Books"];
AEPTargetOrder *order1 = [[AEPTargetOrder alloc] initWithId:@"ADCKKIM" total:[@(344.30) doubleValue] purchasedProductIds:@[@"34", @"125"]];
AEPTargetParameters *targetParameters1 = [[AEPTargetParameters alloc] initWithParameters:mboxParameters1 profileParameters:profileParameters1 order:order1 product:product1 ];
NSDictionary *mboxParameters2 = @{@"userType":@"Paid"};
AEPTargetProduct *product2 = [[AEPTargetProduct alloc] initWithProductId:@"764334" categoryId:@"Online"];
AEPTargetOrder *order2 = [[AEPTargetOrder alloc] initWithId:@"ADCKKIM" total:[@(344.30) doubleValue] purchasedProductIds:@[@"id1",@"id2"]];
AEPTargetParameters *targetParameters2 = [[AEPTargetParameters alloc] initWithParameters:mboxParameters2 profileParameters:nil order:order2 product:product2 ];
// Creating Prefetch Objects
AEPTargetPrefetchObject *prefetch1 = [[AEPTargetPrefetchObject alloc] initWithName: @"logo" targetParameters:targetParameters1];
AEPTargetPrefetchObject *prefetch2 = [[AEPTargetPrefetchObject alloc] initWithName: @"buttonColor" targetParameters:targetParameters2];
// Creating prefetch Array
NSArray *prefetchArray = @[prefetch1,prefetch2];
// Creating Target parameters
NSDictionary *mboxParameters = @{@"status":@"progressive"};
NSDictionary *profileParameters = @{@"age":@"20-32"};
AEPTargetProduct *product = [[AEPTargetProduct alloc] initWithProductId:@"24D334" categoryId:@"Stationary"];
AEPTargetOrder *order = [[AEPTargetOrder alloc] initWithId:@"ADCKKBC" total:[@(400.50) doubleValue] purchasedProductIds:@[@"34", @"125"]];
AEPTargetParameters *targetParameters = [[AEPTargetParameters alloc] initWithParameters:mboxParameters
profileParameters:profileParameters
order:order
product:product];
// Target API Call
[AEPMobileTarget prefetchContent:prefetchArray withParameters:targetParameters callback:^(NSError * _Nullable error){
// do something with the callback response
}];
Syntax
+ (void) prefetchContent: (nonnull NSArray<ACPTargetPrefetchObject*>*) prefetchObjectArray
withParameters: (nullable ACPTargetParameters*) parameters
callback: (nullable void (^) (NSError* _Nullable error)) callback;
Example
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 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
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
}];
Syntax
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.