Adobe Target
Adobe Target helps test, personalize, and optimize mobile app experiences based on user behavior and mobile context. You can deliver interactions that engage and convert through iterative testing and rules-based and AI-powered personalization.
To get started with Target, follow these steps:
    1.
    Configure the Target extension in Experience Platform Launch.
    2.
    Add the Target Extension to your app.
    3.
    Implement Target APIs to:
      Request mbox offers.
      Prefetch mbox offers.
      Track mboxes.
      Enter visual preview mode.

Configure the Target extension in Experience Platform Launch

Adobe Target Extension Configuration
    1.
    In Experience Platform Launch, click the Extensions tab.
    2.
    On the Catalog tab, locate the Adobe Target extension, and click Install.
    3.
    Your Target client code will be detected automatically.
    4.
    Optionally, provide your Environment ID.
    5.
    Set the timeout value to at least 5 seconds.
    6.
    Optionally, enter the Target workspace property token that was generated from Target UI.
    7.
    Click Save.
    8.
    Follow the publishing process to update SDK configuration.

Add Target to your app

To add Target to your app:
Android
iOS
React Native

Java

    1.
    Add the Mobile Core and Target extensions to your project using the app's Gradle file.
    1
    implementation 'com.adobe.marketing.mobile:sdk-core:1.+'
    2
    implementation 'com.adobe.marketing.mobile:target:1.+'
    Copied!
    2.
    Import the Target extension to your application's main activity.
    1
    import com.adobe.marketing.mobile.*;
    Copied!
    1.
    Add the Mobile Core and Target CocoaPods to your project via your Podfile.
    1
    pod 'ACPCore'
    2
    pod 'ACPTarget'
    Copied!
    2.
    Import the Target and Identity libraries.
    Objective C
    1
    #import "ACPCore.h"
    2
    #import "ACPTarget.h"
    3
    #import "ACPIdentity.h"
    4
    #import "ACPTargetRequestObject.h"
    5
    #import "ACPTargetPrefetchObject.h"
    Copied!
    Swift
    1
    #import ACPCore
    2
    #import ACPTarget
    3
    #import ACPIdentity
    Copied!

JavaScript

    1.
    Install Target.
    1
    npm install @adobe/react-native-acptarget
    2
    react-native link @adobe/react-native-acptarget
    Copied!
    2.
    Import the extension and related libraries.
    1
    import {ACPTarget, ACPTargetPrefetchObject, ACPTargetRequestObject, ACPTargetOrder, ACPTargetProduct, ACPTargetParameters} from '@adobe/react-native-acptarget';
    Copied!
    3.
    Get the extension version.
    1
    ACPTarget.extensionVersion().then(version => console.log("AdobeExperienceSDK: ACPTarget version: " + version));
    Copied!

Register Target with Mobile Core

To register Target with Mobile Core:
Android
iOS
React Native

Java

In your application's onCreate() method, after calling the setApplication() method, register Target with Mobile Core.
Here is code sample that calls these set up methods:
1
public class TargetApp extends Application {
2
3
@Override
4
public void onCreate() {
5
super.onCreate();
6
MobileCore.setApplication(this);
7
MobileCore.configureWithAppId("yourAppId");
8
9
try {
10
Target.registerExtension();
11
Identity.registerExtension();
12
MobileCore.start(null);
13
} catch (Exception e) {
14
//Log the exception
15
}
16
}
17
}
Copied!

Objective C

In your app's didFinishLaunchingWithOptions function, register the Target extension with Mobile Core:
1
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
2
[ACPCore configureWithAppId:@"yourAppId"];
3
[ACPTarget registerExtension];
4
[ACPIdentity registerExtension];
5
[ACPCore start:nil];
6
// Override point for customization after application launch.
7
return YES;
8
}
Copied!

Swift

1
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
2
ACPCore.configure(withAppId: "yourAppId")
3
ACPTarget.registerExtension()
4
ACPIdentity.registerExtension()
5
ACPCore.start(nil)
6
// Override point for customization after application launch.
7
return true;
8
}
Copied!
To register the Target extension with the Mobile Core extension, use the following API:

JavaScript

1
ACPTarget.registerExtension();
Copied!

Parameters in a Target request

Here is some information about the parameters in a Target request:

Target Order class

The TargetOrder class encapsulates the order ID, the order total, and the purchased product IDs. You can instantiate this class to create order parameters. For more information about Target Order parameters, see Create an Order Confirmation mbox - mbox.js.
Android
iOS
React Native

Syntax

1
public TargetOrder(final String id, final double total, final List<String> purchasedProductIds)
Copied!

Example

1
List<String> purchasedProductIds = new ArrayList<String>();
2
purchasedProductIds.add("34");
3
purchasedProductIds.add("125");
4
TargetOrder targetOrder = new TargetOrder("123", 567.89, purchasedProductIds);
Copied!

Syntax

1
+ (nonnull instancetype) targetOrderWithId: (nonnull NSString*) orderId
2
total: (nullable NSNumber*) total
3
purchasedProductIds: (nullable NSArray <NSString*>*) purchasedProductIds;
Copied!

Examples

Here are some examples in Objective C and Swift:
Objective C
1
ACPTargetOrder *order = [ACPTargetOrder targetOrderWithId:@"ADCKKBC" total:@(400.50) purchasedProductIds:@[@"34", @"125"]];
Copied!
Swift
1
let order = ACPTargetOrder(id: "ADCKKBC", total: NSNumber(value: 400.50), purchasedProductIds: ["34", "125"])
Copied!
JavaScript
1
var targetOrder = new ACPTargetOrder("ADCKKBC", 400.50, ["34","125"]);
Copied!

Target Product class

The TargetProduct class encapsulates the product ID and the product category ID, and you can instantiate this class to create order parameters. For more information about Target Product parameters, see Entity attributes
Android
iOS
React Native

Syntax

1
public TargetProduct(final String id, final String categoryId)
Copied!

Example

1
TargetProduct targetProduct = new TargetProduct("123", "Books");
Copied!

Syntax

1
+ (nonnull instancetype) targetProductWithId: (nonnull NSString*) productId
2
categoryId: (nullable NSString*) categoryId;
Copied!

Examples

Here are some examples in Objective C and Swift:
Objective C
1
ACPTargetProduct *product = [ACPTargetProduct targetProductWithId:@"24D334" categoryId:@"Stationary"];
Copied!
Swift
1
let product = ACPTargetProduct(id: "24D334", categoryId: "Stationary")
Copied!
JavaScript
1
var targetProduct = new ACPTargetProduct("24D334", "Stationary");
Copied!

Target Parameters

TargetParameters encapsulates mboxParameters, profileParameters, orderParameters, and productParameters and allows you easily pass these parameters in a Target request.
Android
iOS
React Native

Syntax

1
TargetParameters targetParameters = new TargetParameters.Builder()
2
.parameters(new HashMap<String, String>())
3
.profileParameters(new HashMap<String, String>())
4
.product(new TargetProduct("productId", "productCategoryId"))
5
.order(new TargetOrder("orderId", 0.0, new ArrayList<String>()))
6
.build();
Copied!

Example

1
List<String> purchasedProductIds = new ArrayList<String>();
2
purchasedProductIds.add("34");
3
purchasedProductIds.add("125");
4
TargetOrder targetOrder = new TargetOrder("123", 567.89, purchasedProductIds);
5
6
TargetProduct targetProduct = new TargetProduct("123", "Books");
7
8
Map<String, String> mboxParameters = new HashMap<String, String>();
9
mboxParameters1.put("status", "platinum");
10
11
Map<String, String> profileParameters = new HashMap<String, String>();
12
profileParameters1.put("gender", "male");
13
14
TargetParameters targetParameters = new TargetParameters.Builder()
15
.parameters(mboxParameters)
16
.profileParameters(profileParameters)
17
.product(targetProduct)
18
.order(targetOrder)
19
.build();
Copied!

Syntax

1
+ (nonnull instancetype) targetParametersWithParameters: (nullable NSDictionary*) targetParameters
2
profileParameters: (nullable NSDictionary*) profileParameters
3
product: (nullable ACPTargetProduct*) product
4
order: (nullable ACPTargetOrder*) order;
Copied!

Examples

Here are some examples in Objective C and Swift:
Objective C
1
NSDictionary *mboxParameters = @{@"status":@"Platinum"};
2
NSDictionary *profileParameters = @{@"gender":@"female"};
3
4
ACPTargetProduct *product = [ACPTargetProduct targetProductWithId:@"24D334" categoryId:@"Stationary"];
5
6
ACPTargetOrder *order = [ACPTargetOrder targetOrderWithId:@"ADCKKBC" total:@(400.50) purchasedProductIds:@[@"34", @"125"]];
7
8
ACPTargetParameters *targetParameters = [ACPTargetParameters targetParametersWithParameters:mboxParameters
9
profileParameters:profileParameters
10
product:product
11
order:order];
Copied!
Swift
1
let mboxParameters = [
2
"status": "Platinum"
3
]
4
let profileParameters = [
5
"gender": "female"
6
]
7
8
let product = ACPTargetProduct(id: "24D334", categoryId: "Stationary")
9
10
let order = ACPTargetOrder(id: "ADCKKBC", total: NSNumber(value: 400.50), purchasedProductIds: ["34", "125"])
11
12
let targetParameters = ACPTargetParameters(parameters: mboxParameters, profileParameters: profileParameters, product: product, order: order)
Copied!
JavaScript
1
var mboxParameters = {"status": "platinum"};
2
var profileParameters = {"gender": "female"};
3
var targetProduct = new ACPTargetProduct("24D334", "Stationary");
4
var purchaseIDs = ["34","125"];
5
var targetOrder = new ACPTargetOrder("ADCKKBC", 400.50, purchaseIDs);
6
var targetParameters = new ACPTargetParameters(mboxParameters, profileParameters, targetProduct, targetOrder);
Copied!

Merge behavior of Target parameters

TargetParameters, such as mboxParameters, profileParameters, orderParameters, and productParameters, can be passed in the Target APIs and can also be passed in when you create TargetPrefetch or TargetRequest objects. The TargetParameters that are passed in the public APIs are global parameters and are merged with the corresponding parameters in the individual TargetRequest or TargetPrefetch objects.
When merging, the new keys in the mbox parameters or the profile parameters are appended to the final dictionary, and the keys with the same name are overwritten in each TargetRequest or TargetPrefetch object by the keys from the global parameters. For TargetOrder or TargetProduct objects, the object that is passed to the global parameters replaces the corresponding object in the TargetRequest or TargetPrefetch objects.

Target sessions

The Target extension (version 2.1.4 for iOS) and (version 1.1.3 for Android) now supports persistent sessions. When a Target request is received, if a session ID does not exist, a new ID is generated and is sent in the request. This ID, with the Edge Host that is returned from Target, is kept in persistent storage for the configured target.sessionTimeout period. If the timeout value is not configured, the default value is 30 minutes.
If no Target request is received during the configured target.sessionTimeout or if the resetExperience API is called, these variables are reset and removed from persistent storage.

Visual preview

The visual preview mode allows you to easily perform end-to-end QA activities by enrolling and previewing these activities on your device. This mode does not require a specialized testing set up. To get started, set up a URL scheme and generate the preview links. For more information about setting up Target visual preview, see Target mobile preview. For more information about setting URL schemes for iOS, see Defining a Custom URL Scheme for Your App. For more information about setting URL schemes for Android, see Create Deep Links to App Content.
You can also set an application deep link that can be triggered when selections are made in the preview mode by using the setPreviewRestartDeeplink API.
To enter the preview visual mode, use the collectLaunchInfo API to enable the mode and click the red floating button that appears on the app screen. For more information, see collectLaunchInfo.
After making preview mode selections, the first mbox request made may fail due to a caching issue on the Target server. For more information see the known issues and resolved issues document.
The mbox request that failed can be retried to successfully retrieve the test offer content.
Android
iOS
On Android, when the application is launched as a result of a deep link, the 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 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 in each of your Activities.

Syntax

1
+ (void) collectLaunchInfo: (nonnull NSDictionary*) userInfo;
Copied!

Examples

Here are some examples in Objective-C and Swift:
Objective-C
1
[ACPCore collectLaunchInfo: @{@"adb_deeplink":@"com.adobe.targetpreview://app.adobetarget.com?at_preview_token=tokenFromTarget"}];`
Copied!
Swift
1
ACPCore.collectLaunchInfo(["adb_deeplink" : "com.adobe.targetpreview://app.adobetarget.com?at_preview_token=tokenFromTarget"])
Copied!

Offer Prefetch

The SDK can minimize the number of times it reaches out to Target servers to fetch offers by caching server responses. With a successful prefetch call for mbox locations, offer content is retrieved and cached in the SDK. This content is retrieved from the cache for all future retrieveLocationContent API calls for the specified mbox names. This prefetch process reduces the offer load time and network calls that were made to the Target servers, and the prrocess allows Target to be notified which mbox was visited by the mobile app user.
Prefetched offer content does not persist across application launches. The prefetch content is cached as long as the application lives in memory or until the API to clear the cache is called. For more information, see clearPrefetchCache.
Offer prefetch is not available while visual preview mode is enabled.

Target with Analytics (A4T)

To track the performance of your Target activities for certain segments, set up the Analytics for Target (A4T) cross-solution integration by enabling the A4T campaigns. This integration allows you to use Analytics reports to examine your results. If you use Analytics as the reporting source for an activity, all reporting and segmentation for that activity is based on Analytics data collection. For more information, see Adobe Analytics for Adobe Target (A4T).
Once Analytics is listed as the reporting source for an activity on Target UI, A4T works out of the box in the Target SDK. The Target SDK extension extracts the A4T payload from the Target server response, dispatches an event for Analytics SDK extension to send an internal track action request to the configured Analytics server.
The A4T payload returned from Target servers is sent to Adobe Analytics in the following cases:
For A4T data to be sent to Adobe Analytics client-side, make sure Analytics SDK extension is installed and registered in your mobile application. For more information, see Adobe Analytics.

Configuration keys

To programmatically update SDK configuration, use the following information to change your Target configuration values:
For more information, see Programmatic updates to Configuration.
Key
Description
Data Type
target.clientcode
Client code for your account.
String
target.timeout
Time, in seconds, to wait for a response from Target servers before timing out.
Integer
target.environmentId
Environment ID you want to use. If the value is left blank, the default production environment will be used.
Integer
target.propertyToken
at_property token value, which is generated from the Target UI. If this value is left blank, no token is sent in the Target network calls.
String
target.previewEnabled
Boolean parameter, which can be used to enable/disable Target Preview. If not specified, then Preview will be enabled by default.
Boolean
target.sessionTimeout
The duration, in seconds, during which the Target session ID and Edge Host are persisted. If this value is not specified, the default timeout value is 30 minutes.
Integer
target.server
Optional. If provided, all Target requests will be sent to this host. Available since v2.1.7 (iOS), v1.1.6 (Android). e.g. - mytargetdomain.com
String
We recommend that, instead of passing the property token as a mbox parameter, you use an Experience Platform Launch configuration so that Target can pass the token. If the token is passed both in an Experience Platform Launch configuration, and as a mbox parameter, the token that was provided as the mbox parameter is discarded.
Currently, the target.sessiontimeout value can only be configured programmatically. For more information, see updateConfiguration.

Additional information

Last modified 1mo ago