Edit in GitHubLog an issue

Java

Syntax

Copied to your clipboard
public static void clearPrefetchCache()

Example

Copied to your clipboard
Target.clearPrefetchCache();

Swift

Syntax

Copied to your clipboard
static func clearPrefetchCache()

Example

Copied to your clipboard
Target.clearPrefetchCache()

Objective-C

Syntax

Copied to your clipboard
+ (void) clearPrefetchCache

Example

Copied to your clipboard
[AEPMobileTarget clearPrefetchCache];

Java

Syntax

Copied to your clipboard
public static void clickedLocation(final String mboxName, final TargetParameters parameters)
  • mboxName: A string that contains the mbox location for which the click notification will be sent to Target.
  • parameters: A TargetParameters object configured 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.clickedLocation("cartLocation", targetParameters);

Swift

Syntax

Copied to your clipboard
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: A TargetParameters object configured for the request.

Example

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

Syntax

Copied to your clipboard
+ (void) clickedLocation: (nonnull NSString*) name withTargetParameters: (nullable AEPTargetParameters* targetParameters
  • name: A string that contains the mbox location for which the click notification will be sent to Target.
  • targetParameters: A TargetParameters object configured for the request.

Example

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

Java

Syntax

Copied to your clipboard
public static void displayedLocations(final List<String> mboxNames, final TargetParameters targetParameters)
  • mboxNames: A list of the mbox locations for which the display notification will be sent to Target.
  • targetParameters: The TargetParameters object configured 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.displayedLocations(mboxList, targetParameters);

Swift

Syntax

Copied to your clipboard
static func displayedLocations(_ names: [String], targetParameters: TargetParameters?)
  • names: An array of the mbox locations for which the display notification will be sent to Target.
  • targetParameters: A TargetParameters object configured for the request.

Example

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

Syntax

Copied to your clipboard
+ (void) displayedLocations: (nonnull NSArray<NSString*>*) names withTargetParameters: (nullable AEPTargetParameters*) targetParameters
  • names: An array of the mbox locations for which the display notification will be sent to Target.
  • targetParameters: A TargetParameters object configured for the request.

Example

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

Java

Syntax

Copied to your clipboard
public String extensionVersion()

Example

Copied to your clipboard
Target.extensionVersion();

Swift

Syntax

Copied to your clipboard
static var extensionVersion: String

Example

Copied to your clipboard
let targetVersion = Target.extensionVersion

Objective-C

Syntax

Copied to your clipboard
+ (nonnull NSString*) extensionVersion

Example

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

Java

Syntax

Copied to your clipboard
public static void getSessionId(final AdobeCallback<String> callback)
  • callback: A callback that 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
}
});

Swift

Syntax

Copied to your clipboard
static func getSessionId(_ completion: @escaping (String?, Error?) -> Void)
  • completion: A callback that is invoked with the sessionId value, or nil if there was an error retrieving it.

Example

Copied to your clipboard
Target.getSessionId { (id, err) in
// read Target sessionId
}

Objective-C

Syntax

Copied to your clipboard
+ (void) getSessionId: (void (nonnull ^) (nullable NSString* sessionId, nullable NSError* error)) completion
  • completion: A callback that is invoked with the sessionId value, or nil if there was an error retrieving it.

Example

Copied to your clipboard
[AEPMobileTarget getSessionId:^(NSString *sessionId, NSError *error){
// read Target sessionId
}];

Java

Syntax

Copied to your clipboard
public static void getThirdPartyId(final AdobeCallback<String> callback)
  • callback: A callback that 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
}
});

Swift

Syntax

Copied to your clipboard
static func getThirdPartyId(_ completion: @escaping (String?, Error?) -> Void)
  • completion: A callback that is invoked with the thirdPartyId value. If no third-party ID was set, this value will be nil.

Example

Copied to your clipboard
Target.getThirdPartyId { (id, err) in
// read Target thirdPartyId
}

Objective-C

Syntax

Copied to your clipboard
+ (void) getThirdPartyId: (nonnull void (^) (nullable NSString* thirdPartyId, nullable NSError* error)) completion
  • completion: A callback that is invoked with the thirdPartyId value. If no third-party ID was set, this value will be nil.

Example

Copied to your clipboard
[AEPMobileTarget getThirdPartyId:^(NSString *thirdPartyID, NSError *error){
// read Target thirdPartyId
}];

Java

Syntax

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

Example

Copied to your clipboard
Target.getTntId(new AdobeCallback<String>() {
@Override
public void call(String tntId) {
// read target's tntid
}
});

Swift

Syntax

Copied to your clipboard
static func getTntId(_ completion: @escaping (String?, Error?) -> Void)
  • completion: A callback that is invoked with the tntId value. If no Target ID was set, this value will be nil.

Example

Copied to your clipboard
Target.getTntId({ (id, err) in
// read target's tntId
})

Objective-C

Syntax

Copied to your clipboard
+ (void) getTntId: (void (nonnull ^) (nullable NSString* tntId, nullable NSError* error)) completion
  • completion: A callback that is invoked with the tntId value. If no Target ID was set, this value will be nil.

Example

Copied to your clipboard
[AEPMobileTarget getTntId:^(NSString *tntID, NSError *error){
// read target's tntId
}];

Java

Syntax

Copied to your clipboard
public static void prefetchContent(final List<TargetPrefetch> mboxPrefetchList, final TargetParameters parameters, final AdobeCallback<String> callback)
  • mboxPrefetchList: A list of TargetPrefetch objects for various mbox locations.
  • parameters: A TargetParameters object configured for the prefetch request.
  • callback: A callback that is invoked with a null value if the prefetch is successful, or with an error message string otherwise.

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);

Swift

Syntax

Copied to your clipboard
static func prefetchContent(_ prefetchArray: [TargetPrefetch], with targetParameters: TargetParameters? = nil, _ completion: ((Error?) -> Void)?)
  • prefetchArray: An array of TargetPrefetch objects for various mbox locations.
  • targetParameters: A TargetParameters object configured for the prefetch request.
  • completion: A callback that is invoked with a nil value if the prefetch is successful, or with an error otherwise.

Example

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

Syntax

Copied to your clipboard
+ (void) prefetchContent: (nonnull NSArray<AEPTargetPrefetchObject*>*) targetPrefetchObjectArray
withParameters: (nullable AEPTargetParameters*) targetParameters
callback: (nullable void (^) (nullable NSError* error)) completion
  • targetPrefetchObjectArray: An array of AEPTargetPrefetchObject objects for various mbox locations.
  • targetParameters: An AEPTargetParameters object configured for the prefetch request.
  • completion: A callback that is invoked with a nil value if the prefetch is successful, or with an error otherwise.

Example

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

Java

Syntax

Copied to your clipboard
public static void registerExtension()

Example

Copied to your clipboard
Target.registerExtension();

Java

Syntax

Copied to your clipboard
public static void resetExperience()

Example

Copied to your clipboard
Target.resetExperience();

Swift

Syntax

Copied to your clipboard
static func resetExperience()

Example

Copied to your clipboard
Target.resetExperience()

Objective-C

Syntax

Copied to your clipboard
+ (void) resetExperience

Example

Copied to your clipboard
[AEPMobileTarget resetExperience];

Java

Syntax

Copied to your clipboard
public static void retrieveLocationContent(final List<TargetRequest> targetRequestList, final TargetParameters parameters)
  • targetRequestList: A list of TargetRequest objects for various mbox locations.
  • parameters: A TargetParameters object configured 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, Object> responseTokens = data.containsKey("responseTokens") ?
(Map<String, Object>) data.get("responseTokens") :
null;
Map<String, String> analyticsPayload = data.containsKey("analytics.payload") ?
(Map<String, String>) data.get("analytics.payload") :
null;
Map<String, String> clickMetricAnalyticsPayload = data.containsKey("clickmetric.analytics.payload") ?
(Map<String, String>) data.get("clickmetric.analytics.payload") :
null;
...
}
}
@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);

Swift

Syntax

Copied to your clipboard
static func retrieveLocationContent(_ requestArray: [TargetRequest], with targetParameters: TargetParameters? = nil)
  • requestArray: An array of TargetRequest objects to retrieve content.
  • targetParameters: A TargetParameters object containing parameters for all locations in the requests array.

Example

Copied to your clipboard
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")
)
let request1 = TargetRequest(mboxName: "logo", defaultContent: "BlueWhale", targetParameters: TargetParameters1) { content in
if let content = content {
// do something with the target content.
}
}
let request2 = TargetRequest(mboxName: "logo", defaultContent: "red", targetParameters: TargetParameters2) { content, data in
if let content = content {
// do something with the target content.
}
// Read the data dictionary containing one or more of response tokens, analytics payload and click-tracking analytics payload, if available.
if let data = data {
let responseTokens = data["responseTokens"] as? [String: Any] ?? [:]
let analyticsPayload = data["analytics.payload"] as? [String: String] ?? [:]
let clickMetricAnalyticsPayload = data["clickmetric.analytics.payload"] as? [String: String] ?? [:]
...
}
}
Target.retrieveLocationContent([request1, request2], with: globalTargetParameters)

Objective-C

Syntax

Copied to your clipboard
+ (void) retrieveLocationContent: (nonnull NSArray<AEPTargetRequestObject*>*) requests withParameters: (nullable AEPTargetParameters*) parameters
  • requests: An array of TargetRequest objects to retrieve content.
  • parameters: An AEPTargetParameters object containing parameters for all locations in the requests array.

Example

Copied to your clipboard
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 ];
AEPTargetRequestObject *request1 = [[AEPTargetRequestObject alloc] initWithMboxName: @"logo" defaultContent: @"BlueWhale" targetParameters: targetParameters1 contentCallback:^(NSString * _Nullable content) {
// do something with the received content
NSString *targetContent = content ?: @"";
}];
AEPTargetRequestObject *request2 = [[AEPTargetRequestObject alloc] initWithMboxName: @"logo" defaultContent: @"red" targetParameters: targetParameters2 contentWithDataCallback:^(NSString * _Nullable content, NSDictionary<NSString *,id> * _Nullable data) {
// do something with the target content.
NSString *targetContent = content ?: @"";
// Read the data dictionary containing one or more of response tokens, analytics payload and click-tracking analytics payload, if available.
if ([data count] > 0) {
if ([data objectForKey:@"responseTokens"]) {
// read response tokens
}
if ([data objectForKey:@"analytics.payload"]) {
// read analytics payload
}
if ([data objectForKey:@"clickmetric.analytics.payload"]) {
// read click-tracking analytics payload
}
}
}];
// Create request object array
NSArray *requestArray = @[request1,request2];
// 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];
[AEPMobileTarget retrieveLocationContent: requestArray withParameters: targetParameters];

Java

Syntax

Copied to your clipboard
public static void setPreviewRestartDeepLink(final Uri deepLink)
  • deeplink: A URL that contains the preview restart deeplink.

Example

Copied to your clipboard
Target.setPreviewRestartDeepLink("myapp://HomePage");

Swift

Syntax

Copied to your clipboard
static func setPreviewRestartDeepLink(_ deeplink: URL)
  • deeplink: A URL that contains the preview restart deeplink.

Example

Copied to your clipboard
if let url = URL(string: "myapp://HomePage") {
Target.setPreviewRestartDeepLink(url)
}

Objective-C

Syntax

Copied to your clipboard
+ (void) setPreviewRestartDeeplink: (nonnull NSURL*) deeplink
  • deeplink: A URL that contains the preview restart deeplink.

Example

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

Java

Syntax

Copied to your clipboard
public static void setSessionId(final String sessionId)
  • sessionId: A string that contains the Target session identifier to be set in the SDK.

Example

Copied to your clipboard
Target.setSessionId("3f24b997-ea74-420c-81f8-96a8b92c3961");

Swift

Syntax

Copied to your clipboard
static func setSessionId(_ id: String?)
  • id: 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")

Objective-C

Syntax

Copied to your clipboard
+ (void) setSessionId: (nullable NSString*) id
  • id: A string that contains the Target session identifier to be set in the SDK.

Example

Copied to your clipboard
[AEPMobileTarget setSessionId:@"3f24b997-ea74-420c-81f8-96a8b92c3961"]

Java

Syntax

Copied to your clipboard
public static void setThirdPartyId(final String thirdPartyId)
  • thirdPartyId: A string that contains the custom visitor ID to be set in Target.

Example

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

Swift

Syntax

Copied to your clipboard
static func setThirdPartyId(_ id: String)
  • id: A string that contains the custom visitor ID to be set in Target.

Example

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

Objective-C

Syntax

Copied to your clipboard
+ (void) setThirdPartyId: (nullable NSString*) thirdPartyId
  • id: A string that contains the custom visitor ID to be set in Target.

Example

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

Java

Syntax

Copied to your clipboard
public static void setTntId(final String tntId)
  • tntId: A string that contains the Target user identifier to be set in the SDK.

Example

Copied to your clipboard
Target.setTntId("f741a5d5-09c0-4931-bf53-b9e568c5f782.35_0");

Swift

Syntax

Copied to your clipboard
static func setTntId(_ id: String?)
  • id: 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")

Objective-C

Syntax

Copied to your clipboard
+ (void) setTntId: (nullable NSString*) id
  • id: A string that contains the Target user identifier to be set in the SDK.

Example

Copied to your clipboard
[AEPMobileTarget setTntId:@"f741a5d5-09c0-4931-bf53-b9e568c5f782.35_0"]

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.

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
MobileCore.collectLaunchInfo(["adb_deeplink" : "com.adobe.targetpreview://app.adobetarget.com?at_preview_token=tokenFromTarget"])

Objective-C

Example

Copied to your clipboard
[AEPMobileCore collectLaunchInfo:@{@"adb_deeplink" : @"com.adobe.targetpreview://app.adobetarget.com?at_preview_token=tokenFromTarget"}];

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);
}

Swift

Syntax

Copied to your clipboard
@objc(AEPTargetRequestObject)
public class TargetRequest: NSObject, Codable {
@objc public let name: String
@objc public let defaultContent: String
@objc public let targetParameters: TargetParameters?
@objc let responsePairId: String
@objc var contentCallback: ((String?) -> Void)?
/// Instantiate a `TargetRequest` object
/// - Parameters:
/// - name: `String` mbox name for this request
/// - defaultContent: `String` default content for this request
/// - targetParameters: `TargetParameters` for this request
/// - contentCallback: which will get called with target mbox content
@objc public init(mboxName: String, defaultContent: String, targetParameters: TargetParameters? = nil, contentCallback: ((String?) -> Void)? = nil) {
name = mboxName
self.defaultContent = defaultContent
self.targetParameters = targetParameters
self.contentCallback = contentCallback
contentWithDataCallback = nil
responsePairId = UUID().uuidString
}
/// Instantiate a `TargetRequest` object
/// - Parameters:
/// - name: `String` mbox name for this request
/// - defaultContent: `String` default content for this request
/// - targetParameters: `TargetParameters` for this request
/// - contentWithDataCallback: which will get called with target mbox content, and an optional dictionary containing one or more of response tokens, analytics payload, and click metric analytics payload, if available.
@objc public init(mboxName: String, defaultContent: String, targetParameters: TargetParameters? = nil, contentWithDataCallback: ((String?, [String: Any]?) -> Void)? = nil) {
name = mboxName
self.defaultContent = defaultContent
self.targetParameters = targetParameters
self.contentWithDataCallback = contentWithDataCallback
contentCallback = nil
responsePairId = UUID().uuidString
}
}

Example

The following example shows how to create an instance of a TargetRequest object that might be used to make a batch request to the configured Target server to fetch content for mbox locations.

Copied to your clipboard
let request1 = TargetRequest(mboxName: "mboxName", defaultContent: "default content", targetParameters: nil, contentCallback: { content in
print(content ?? "")
})
let request2 = TargetRequest(mboxName: "mboxName", defaultContent: "default content", targetParameters: nil, contentwithDataCallback: { content, data in
print(content ?? "")
if let data = data {
// read response tokens
let responseTokens = data["responseTokens"] as? [String: String] ?? [:]
// read analytics payload
let analyticsPayload = data["analytics.payload"] as? [String: String] ?? [:]
// read click-tracking analytics payload
let clickMetricAnalyticsPayload = data["clickmetric.analytics.payload"] as? [String: String] ?? [:]
}
})

Objective-C

Example

The following example shows how to create an instance of a TargetRequest object that might be used to make a batch request to the configured Target server to fetch content for mbox locations.

Copied to your clipboard
AEPTargetRequestObject *request1 = [[AEPTargetRequestObject alloc] initWithMboxName:@"mboxName" defaultContent:@"defaultContent" targetParameters:nil contentCallback:^(NSString * _Nullable content) {
NSLog(@"%@", content ?: @"");
}];
AEPTargetRequestObject *request2 = [[AEPTargetRequestObject alloc] initWithMboxName: @"logo" defaultContent: @"red" targetParameters: targetParameters2 contentWithDataCallback:^(NSString * _Nullable content, NSDictionary<NSString *,id> * _Nullable data) {
NSLog(@"%@", content ?: @"");
if ([data count] > 0) {
if ([data objectForKey:@"responseTokens"]) {
// read response tokens
}
if ([data objectForKey:@"analytics.payload"]) {
// read analytics payload
}
if ([data objectForKey:@"clickmetric.analytics.payload"]) {
// read click-tracking analytics payload
}
}
}];

Java

Syntax

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

Swift

Syntax

Copied to your clipboard
/// `TargetPrefetch` class, used for specifying a mbox location.
@objc(AEPTargetPrefetchObject)
public class TargetPrefetch: NSObject, Codable {
@objc public let name: String
@objc public let targetParameters: TargetParameters?
/// Instantiate a `TargetPrefetch` object
/// - Parameters:
/// - name: `String` mbox name for this prefetch
/// - targetParameters: `TargetParameters` for this prefetch
@objc public init(name: String, targetParameters: TargetParameters? = nil) {
self.name = name
self.targetParameters = targetParameters
}
}

Example

The following example can be used to create an instance of a TargetPrefetch object that might be used to make a prefetch request to the configured Target server to prefetch content for mbox locations.

Copied to your clipboard
let prefetch = TargetPrefetch(name: "mboxName", targetParameters: nil)

Objective-C

Example

The following example can be used to create an instance of a TargetPrefetch object that might be used to make a prefetch request to the configured Target server to prefetch content for mbox locations.

Copied to your clipboard
AEPTargetPrefetchObject *prefetch = [[AEPTargetPrefetchObject alloc] initWithName:@"mboxName" targetParameters:nil];

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();
}
}

Swift

Syntax

Copied to your clipboard
/// Target parameter class, used for specifying custom parameters to be sent in Target requests,
/// such as location (former mbox) parameters, profile parameters, order/product parameters.
@objc(AEPTargetParameters)
public class TargetParameters: NSObject, Codable {
@objc public let parameters: [String: String]?
@objc public let profileParameters: [String: String]?
@objc public let order: TargetOrder?
@objc public let product: TargetProduct?
/// Initialize a `TargetParameters` with the mbox parameters, the profile parameters, the order parameters and the product parameters.
/// - Parameters:
/// - parameters: the mbox parameters
/// - profileParameters: the profile parameters
/// - order: the order parameters
/// - product: the product parameters
@objc public init(parameters: [String: String]? = nil, profileParameters: [String: String]? = nil, order: TargetOrder? = nil, product: TargetProduct? = nil) {
self.parameters = parameters
self.profileParameters = profileParameters
self.order = order
self.product = product
}
}

Examples for creating instances of TargetParameters can be seen in the Target overview.

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();
}

Swift

Syntax

Copied to your clipboard
/// Class for specifying Target order parameters
@objc(AEPTargetOrder)
public class TargetOrder: NSObject, Codable {
@objc public let orderId: String
@objc public let total: Double
@objc public let purchasedProductIds: [String]?
/// Initialize a `TargetOrder` with an order `id`, order `total` and a list of `purchasedProductIds`
/// - Parameters:
/// - id: `String` order id
/// - total: `Double` order total amount
/// - purchasedProductIds: a list of purchased product ids
@objc public init(id: String, total: Double = 0, purchasedProductIds: [String]? = nil) {
orderId = id
self.total = total
self.purchasedProductIds = purchasedProductIds
}
}

Examples for creating instances of TargetOrder can be seen in the Target overview.

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();
}

Swift

Syntax

Copied to your clipboard
/// Class for specifying Target product parameters
@objc(AEPTargetProduct)
public class TargetProduct: NSObject, Codable {
@objc public let productId: String
@objc public let categoryId: String?
/// Initialize a `TargetProduct` with a product id and a productCategoryId.
/// - Parameters:
/// - productId: product id
/// - categoryId: product category id
@objc public init(productId: String, categoryId: String? = nil) {
self.productId = productId
self.categoryId = categoryId
}
}

Examples for creating instances of TargetProduct can be seen in the Target overview

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);
}
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2025 Adobe. All rights reserved.