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

Android
iOS
React Native

Java

  1. Add the Target extension to your project using the app's Gradle file.

  2. Import the Target extension in to your application's main activity.

    import com.adobe.marketing.mobile.*;
  1. Add the Target library to your project via your Podfile by adding pod 'ACPTarget'

  2. Import the Target and Identity libraries.

Objective-C

#import "ACPCore.h"
#import "ACPTarget.h"
#import "ACPIdentity.h"
#import "ACPTargetRequestObject.h"
#import "ACPTargetPrefetchObject.h"

Swift

#import ACPCore
#import ACPTarget
#import ACPIdentity

JavaScript

Install Target

npm install @adobe/react-native-acptarget
react-native link @adobe/react-native-acptarget

Importing the extension and related libraries

import {ACPTarget, ACPTargetPrefetchObject, ACPTargetRequestObject, ACPTargetOrder, ACPTargetProduct, ACPTargetParameters} from '@adobe/react-native-acptarget';

Getting the extension version

ACPTarget.extensionVersion().then(version => console.log("AdobeExperienceSDK: ACPTarget version: " + version));

Register Target with Mobile Core

Android
iOS
React Native

Java

After calling the setApplication() method in the onCreate() method, register Target with Mobile Core.

Here is code sample that calls these set up methods:

public class TargetApp extends Application {
@Override
public void onCreate() {
super.onCreate();
MobileCore.setApplication(this);
MobileCore.ConfigureWithAppId("yourAppId");
try {
Target.registerExtension();
Identity.registerExtension();
MobileCore.start(null);
} catch (Exception e) {
//Log the exception
}
}
}

Objective-C

  1. In your app's didFinishLaunchingWithOptions function, register the Target extension with Mobile Core:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[ACPCore configureWithAppId:@"yourAppId"];
[ACPIdentity registerExtension];
[ACPTarget registerExtension];
[ACPCore start:nil];
// Override point for customization after application launch.
return YES;
}

Swift

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ACPCore.configure(withAppId: "yourAppId")
ACPTarget.registerExtension()
ACPIdentity.registerExtension()
ACPCore.start(nil)
// Override point for customization after application launch.
return true;
}

To register the Target extension with the Mobile Core extension, use the following API:

JavaScript

ACPTarget.registerExtension();

Parameters in a Target request

Target Order

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

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

Example

List<String> purchasedProductIds = new ArrayList<String>();
purchasedProductIds.add("34");
purchasedProductIds.add("125");
TargetOrder targetOrder = new TargetOrder("123", 567.89, purchasedProductIds);

Syntax

+ (nonnull instancetype) targetOrderWithId: (nonnull NSString*) orderId
total: (nullable NSNumber*) total
purchasedProductIds: (nullable NSArray <NSString*>*) purchasedProductIds;

Examples

Here are some examples in Objective-C and Swift:

Objective-C

ACPTargetOrder *order = [ACPTargetOrder targetOrderWithId:@"ADCKKBC" total:@(400.50) purchasedProductIds:@[@"34", @"125"]];

Swift

let order = ACPTargetOrder(id: "ADCKKBC", total: NSNumber(value: 400.50), purchasedProductIds: ["34", "125"])

JavaScript

var targetOrder = new ACPTargetOrder("ADCKKBC", 400.50, ["34","125"]);

Target Product

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

public TargetProduct(final String id, final String categoryId)

Example

TargetProduct targetProduct = new TargetProduct("123", "Books");

Syntax

+ (nonnull instancetype) targetProductWithId: (nonnull NSString*) productId
categoryId: (nullable NSString*) categoryId;

Examples

Here are some examples in Objective-C and Swift:

Objective-C

ACPTargetProduct *product = [ACPTargetProduct targetProductWithId:@"24D334" categoryId:@"Stationary"];

Swift

let product = ACPTargetProduct(id: "24D334", categoryId: "Stationary")

JavaScript

var targetProduct = new ACPTargetProduct("24D334", "Stationary");

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

TargetParameters targetParameters = new TargetParameters.Builder()
.parameters(new HashMap<String, String>())
.profileParameters(new HashMap<String, String>())
.product(new TargetProduct("productId", "productCategoryId"))
.order(new TargetOrder("orderId", 0.0, new ArrayList<String>()))
.build();

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");
Map<String, String> mboxParameters = new HashMap<String, String>();
mboxParameters1.put("status", "platinum");
Map<String, String> profileParameters = new HashMap<String, String>();
profileParameters1.put("gender", "male");
TargetParameters targetParameters = new TargetParameters.Builder()
.parameters(mboxParameters)
.profileParameters(profileParameters)
.product(targetProduct)
.order(targetOrder)
.build();

Syntax

+ (nonnull instancetype) targetParametersWithParameters: (nullable NSDictionary*) targetParameters
profileParameters: (nullable NSDictionary*) profileParameters
product: (nullable ACPTargetProduct*) product
order: (nullable ACPTargetOrder*) order;

Examples

Here are some examples in Objective-C and Swift:

Objective-C

NSDictionary *mboxParameters = @{@"status":@"Platinum"};
NSDictionary *profileParameters = @{@"gender":@"female"};
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];

Swift

let mboxParameters = [
"status": "Platinum"
]
let profileParameters = [
"gender": "female"
]
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)

JavaScript

var mboxParameters = {"status": "platinum"};
var profileParameters = {"gender": "female"};
var targetProduct = new ACPTargetProduct("24D334", "Stationary");
var purchaseIDs = ["34","125"];
var targetOrder = new ACPTargetOrder("ADCKKBC", 400.50, purchaseIDs);
var targetParameters = new ACPTargetParameters(mboxParameters, profileParameters, targetProduct, targetOrder);

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 the 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.

Android
iOS

In 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.

Syntax

+ (void) collectLaunchInfo: (nonnull NSDictionary*) userInfo;

Examples

Here are some examples in Objective-C and Swift:

Objective-C

[ACPCore collectLaunchInfo: @{@"adb_deeplink":@"com.adobe.targetpreview://app.adobetarget.com?at_preview_token=tokenFromTarget"}];`

Swift

ACPCore.collectLaunchInfo(["adb_deeplink" : "com.adobe.targetpreview://app.adobetarget.com?at_preview_token=tokenFromTarget"])

Target with Analytics (A4T)

To see 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 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).

Configuration keys

If you need to update SDK configuration, programmatically, use the following information to change your Target configuration values. For more information, Configuration API reference.

Key

Description

target.clientcode

Client code for your account.

target.timeout

Time, in seconds, to wait for a response from Target servers before timing out.

target.environmentId

Environment ID you want to use, if this is left blank, the default production environment will be used.

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.

target.previewEnabled

Boolean parameter, which can be used to enable/disable Target Preview. If not specified, then Preview will be enabled by default.

target.sessionTimeout

The duration, in seconds, during which the Target session ID and Egde Host are persisted. If this value is not specified, the default timeout value is 30 minutes.

We recommend that, instead of passing the property token in as a mbox parameter, you use an Experience Platform Launch configuration to pass the token. If the token is passed in an Experience Platform Launch configuration, and as a an mbox parameter, the token that was entered in the mbox parameter is discarded.

Currently, the target.sessiontimeout value can only be configured programmatically. For more information, see updateConfiguration.

Additional information