Adobe Campaign Standard

Before you install or configure the Campaign Standard extension, read Getting Started and Configuring a mobile application using Adobe Experience Platform SDKs.

If you participated in the Campaign Standard beta, to use the new Campaign Standard extension, go to launch.adobe.com, instead of the Experience Platform Launch integration environment, .

Configure the Campaign Standard extension in Experience Platform Launch

  1. In Experience Platform Launch, click the Extensions tab.

  2. On the Catalog tab, locate the Adobe Campaign Standard extension, and click Install.

  3. Provide the extension settings.

  4. Click Save.

  5. Follow the publishing process to update SDK configuration.

Configure the Campaign Standard extension

Campaign Standard endpoints

Provide endpoint URL(s) for your Campaign Standard instances. You can specify up to three unique endpoints for your development, staging, and production environments. In most cases, the server endpoint is the root URL address, for example, companyname.campaign.adobe.com.

For this extension, these endpoint URLs should be typed in without the http:// or https://.and cannot end with a forward slash.

pKey

A unique, auto-generated identifier for a mobile app that was configured in Adobe Campaign Standard. After you configure this extension in Experience Platform Launch, configure your Launch mobile property in Campaign Standard. For more information, see Setting up your Adobe Launch application in Adobe Campaign.

After the configuration is successful in Campaign, the pKey is automatically generated and configured in Experience Platform Launch Campaign extension for a successful validation.

MCIAS region

Select an MCIAS region based on your customer's location or enter a custom endpoint. The SDK retrieves all in-app messaging rules and definition payloads from this endpoint.

For this extension, the custom MCIAS endpoint URL should be typed in without the http:// or https:// and cannot end with a forward slash.

Request timeout

Time in seconds to wait for a response from the in-app messaging service before timing out. The default timeout value is 5 seconds, and the minimum timeout value is 1 second.

The Request Timeout value must be a non-zero number.

Add the Campaign Standard extension to your app

Remember the following information when you add the Campaign extension to your app:

Extension

Information

Campaign Standard

This Campaign Standard extension requires the Mobile Core, Profile, Lifecycle, and Signal extensions. You should always ensure that you get the latest version of the extension.

Profile

The Profile extension is required for In-App trigger frequencies to work accurately. For more information, see Profile.

Signal

The Signal extension is required for all postback rules to work. For more information, see Signal.

Lifecycle

Lifecycle extension is required for a profile to get registered in Campaign. You also need to implement Lifecycle APIs. For more information, see

Lifecycle extension in Android or Lifecycle extension in iOS.

The instructions to add these extensions to your mobile app are also available in Experience Platform Launch. To access the installation dialog box, open your mobile property, click the Environments tab, and click Install.

Android
iOS
React Native
Android
  1. Add the Campaign Standard, Mobile Core and Profile extensions to your project using the app's Gradle file.

    implementation 'com.adobe.marketing.mobile:campaign:1.+'
    implementation 'com.adobe.marketing.mobile:userprofile:1.+'
    implementation 'com.adobe.marketing.mobile:sdk-core:1.+'
  2. Import the Campaign Standard, Mobile Core, Profile, Lifecycle, and Signal extensions in your application's main activity.

    import com.adobe.marketing.mobile.AdobeCallback;
    import com.adobe.marketing.mobile.Campaign;
    import com.adobe.marketing.mobile.Identity;
    import com.adobe.marketing.mobile.Lifecycle;
    import com.adobe.marketing.mobile.MobileCore;
    import com.adobe.marketing.mobile.Signal;
    import com.adobe.marketing.mobile.UserProfile;

To complete a manual installation, go to the Adobe Experience Platform SDKs for Android GitHub repo, fetch the Mobile Core, Campaign Standard, Profile, Lifecycle, and Signal artifacts, and complete the steps in the Manual installation section.

iOS
  1. Add the Campaign Standard, Mobile Core and Profile extensions to your project using Cocoapods.

    To complete a manual installation, go to the Adobe Experience Platform SDKs for iOS GitHub repo, fetch the Mobile Core, Campaign Standard, Profile, Lifecycle, and Signal artifacts, and complete the steps in the Manual installation section.

  2. In Xcode, import the Mobile Core, Campaign Standard, Profile, Lifecycle, and Signal extensions:

    Objective C

    #import "ACPCore.h"
    #import "ACPCampaign.h"
    #import "ACPUserProfile.h"
    #import "ACPIdentity.h"
    #import "ACPLifecycle.h"
    #import "ACPSignal.h"

    Swift

    import ACPCore
    import ACPCampaign
    import ACPUserProfile
React Native

You'll need to install the SDK with npm and configure the native Android/iOS project in your react native project. Before installing the Campaign Standard extension, you'll need to install the Core extension. Follow these steps to get started:

Create React Native Project

react-native init MyReactApp

Install JavaScript packages

Install and link the @adobe/react-native-acpcampaign package:

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

Import the extension

import {ACPCampaign} from '@adobe/react-native-acpcampaign';

Register the Campaign Standard extension with Mobile Core

Android
iOS
React Native
Android

Java

  1. In your app's OnCreate method, register the Campaign, Identity, Signal, and Lifecycle extensions:

    public class CampaignTestApp extends Application {
    @Override
    public void onCreate() {
    super.onCreate();
    MobileCore.setApplication(this);
    MobileCore.setLogLevel(LoggingMode.DEBUG);
    try {
    Campaign.registerExtension();
    UserProfile.registerExtension();
    Identity.registerExtension();
    Lifecycle.registerExtension();
    Signal.registerExtension();
    MobileCore.start(new AdobeCallback () {
    @Override
    public void call(Object o) {
    MobileCore.configureWithAppID("launch-EN2c0ccd3a457a4c47b65a6b085e269c91-staging");
    }
    });
    } catch (InvalidInitException e) {
    Log.e("CampaignTestApp", e.getMessage());
    }
    }
    }

For more information about starting Lifecycle, see Lifecycle extension in Android.

iOS
  1. In your app's application:didFinishLaunchingWithOptions: method, register the Campaign, Identity, Signal, and Lifecycle extensions:

    Objective C

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [ACPCore setLogLevel:ACPMobileLogLevelDebug];
    [ACPCore configureWithAppId:@"launch-EN2c0ccd3a457a4c47b65a6b085e269c91-staging"];
    [ACPCampaign registerExtension];
    [ACPUserProfile registerExtension];
    [ACPIdentity registerExtension];
    [ACPLifecycle registerExtension];
    [ACPSignal registerExtension];
    [ACPCore start:^{
    [ACPCore lifecycleStart:nil];
    }];
    // Override point for customization after application launch.
    return YES;
    }

    Swift

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    ACPCore.setLogLevel(.debug)
    ACPCore.configure(withAppId: "launch-EN2c0ccd3a457a4c47b65a6b085e269c91-staging")
    ACPCampaign.registerExtension()
    ACPUserProfile.registerExtension()
    ACPIdentity.registerExtension()
    ACPLifecycle.registerExtension()
    ACPSignal.registerExtension()
    ACPCore.start {
    ACPCore.lifecycleStart(nil)
    }
    return true;
    }

For more information about starting Lifecycle, see Lifecycle extension in iOS.

React Native

To register the Campaign Standard with Core, use the following API:

JavaScript

ACPCampaign.registerExtension();

Initialize the SDK and set up tracking

To initialize the SDK and set up tracking, see Initialize the SDK and set up tracking.

Android
iOS
Android

Set up in-app messaging

Need help creating an in-app message using Adobe Campaign? For more information, see Preparing and sending an In-App message.

If you are developing an Android application, to correctly display fullscreen in-app messages, add the Campaign Standard extension's FullscreenMessageActivity to your AndroidManifest.xml file:

<activity android:name="com.adobe.marketing.mobile.FullscreenMessageActivity" />

In addition to adding the FullscreenMessageActivity, a global lifecycle callback must be defined in your app's MainActivity to ensure the proper display of fullscreen in-app messages. To define the global lifecycle callback, see Implementing Global Lifecycle Callbacks.

Set up local notifications

To set up local notifications in Android, update the AndroidManifest.xml file with <receiver android:name="com.adobe.marketing.mobile.LocalNotificationHandler"/>. To configure the notification icons that the local notification will use, see Configuring notification icons.

iOS

No additional setup is needed for iOS in-app messaging and local notifications.

Set up push messaging

To enable push messaging with Adobe Campaign, call setPushIdentifer to send the push identifier that is received from the Apple Push Notification Service (APNS) or Firebase Cloud Messaging Platform (FCM) to the Adobe Identity service. For more information about the setPushIdentifer API, see setPushIdentifier.

For more information about setting up your iOS app to connect to APNS and retrieve a device token that will be used as a push identifier, see Registering Your App with APNs. For more information about setting up your Android app to connect to FCM and retrieve a device registration token that will be used as a push identifier, see Set up a Firebase Cloud Messaging client app on Android.

Need help creating a push notification using Adobe Campaign? For more information, see Preparing and sending a push notification.

Android
iOS
React Native
Android

Example

FirebaseInstanceId.getInstance().getInstanceId()
.addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
@Override
public void onComplete(@NonNull Task<InstanceIdResult> task) {
if (!task.isSuccessful()) {
return;
}
// Get new Instance ID token
String registrationID = task.getResult().getToken();
// Log and toast
System.out.println("Received new registration token: " + registrationID);
// invoke the API to send the push identifier to the Identity Service
MobileCore.setPushIdentifier(registrationID);
}
});
iOS

iOS simulators do not support push messaging.

Objective C

Example

- (void) application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
// Set the deviceToken that the APNS has assigned to the device
[ACPCore setPushIdentifier:deviceToken];
//...
}

Swift

Example

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
// Set the deviceToken that the APNS has assigned to the device
ACPCore.setPushIdentifier(deviceToken)
//...
}
React Native

Before you use the following API in your React Native project, complete the steps in the Android and iOS tabs to set up platform-specific push configuration.

Example

ACPCore.setPushIdentifier("pushID");

Tracking local and push notification message interactions

User interactions with local or push notifications can be tracked by invoking the collectMessageInfo API. After the API is invoked, a network request is made to Campaign that contains the message interaction event.

The code samples below are provided as examples on how to correctly invoke the collectMessageInfo API. The Campaign documents on local and push notification tracking are the recommended source for the proper implementation of local and push notification message tracking. The Campaign document about local notification tracking is Implementing local notification tracking and the Campaign document about push notification tracking is Push Tracking.

Android
iOS
Android

Syntax

public static void collectMessageInfo(final Map<String, Object> messageInfo)
  • messageInfo is a map that contains the delivery ID, message ID, and action type for a local or push notification for which there were interactions. The delivery and message IDs are extracted from the notification payload.

Java

Example

@Override
protected void onResume() {
super.onResume();
handleTracking();
}
// handle notification open and click tracking
private void handleTracking() {
Intent intent = getIntent();
Bundle data = intent.getExtras();
HashMap<String, Object> userInfo = null;
if (data != null) {
userInfo = (HashMap)data.get("NOTIFICATION_USER_INFO");
} else {
return;
}
// Check if we have notification user info.
// If it is present, this view was opened based on a notification.
if (userInfo != null) {
String deliveryId = (String)userInfo.get("deliveryId");
String broadlogId = (String)userInfo.get("broadlogId");
HashMap<String, Object> contextData = new HashMap<>();
if (deliveryId != null && broadlogId != null) {
contextData.put("deliveryId", deliveryId);
contextData.put("broadlogId", broadlogId);
// Send Click Tracking since the user did click on the notification
contextData.put("action", "2");
MobileCore.collectMessageInfo(contextData);
// Send Open Tracking since the user opened the app
contextData.put("action", "1");
MobileCore.collectMessageInfo(contextData);
}
}
}
iOS

Syntax

+ (void) collectMessageInfo: (nonnull NSDictionary*) messageInfo;
  • messageInfo is a dictionary that contains the delivery ID, message ID, and action type for a local or push notification for which there were interactions. The delivery and message IDs are extracted from the notification payload.

Objective C

Example

// Handle notification interaction from background or closed
-(void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler{
dispatch_async(dispatch_get_main_queue(), ^{
NSDictionary *userInfo = response.notification.request.content.userInfo;
NSString *broadlogId = userInfo[@"_mId"] ?: userInfo[@"broadlogId"];
NSString *deliveryId = userInfo[@"_dId"] ?: userInfo[@"deliveryId"];
if(!broadlogId.length || !deliveryId.length){
return;
}
// Send Click Tracking since the user did click on the notification
[ACPCore collectMessageInfo:@{
@"broadlogId" : broadlogId,
@"deliveryId": deliveryId,
@"action": @"2"
}];
// Send Open Tracking since the user opened the app
[ACPCore collectMessageInfo:@{
@"broadlogId" : broadlogId,
@"deliveryId": deliveryId,
@"action": @"1"
}];
});
}

Swift

Example

// Handle notification interaction from background or closed
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
DispatchQueue.main.async(execute: {
let userInfo = response.notification.request.content.userInfo
var broadlogId:String = (userInfo["_mId"] ?? userInfo["broadlogId"]) as! String
var deliveryId:String = (userInfo["_dId"] ?? userInfo["deliveryId"]) as! String
if (broadlogId.count == 0 || deliveryId.count == 0) {
return
}
// Send Click Tracking since the user did click on the notification
ACPCore.collectMessageInfo([
"broadlogId": broadlogId,
"deliveryId": deliveryId,
"action": "2"
])
// Send Open Tracking since the user opened the app
ACPCore.collectMessageInfo([
"broadlogId": broadlogId,
"deliveryId": deliveryId,
"action": "1"
])
})
}

Deleting mobile properties in Experience Platform Launch

Deleting your property in Experience Platform Launch might cause disruption to your recurring push and in-app messaging activities.

In Experience Platform Launch, if you delete your mobile property, review your mobile property status in the Campaign Standard extension and ensure that the property displays an updated Deleted in Launch status. For more information about deleting a property, see Delete a Property.

To remove the corresponding mobile app in Campaign Standard, click Remove from ACS. For more information, see Deleting your Adobe Launch mobile application.

Deleting your mobile property in Experience Platform Launch does not automatically delete your Campaign Standard mobile app.

Handling clickthrough destinations included in Campaign In-App messages

A destination URL can be added to in-app messages that are delivered from Adobe Campaign. The destination can be a website URL such as https://www.adobe.com or a deep link such as campaigndemoapp://signupactivity?paidaccount=true, which can be used to direct the user to a specific area of your app.

Android
iOS
Android

Handling in-app message website URLs on Android

Website URL's are handled without any additional action by the app developer. If an in-app message is clicked through and contains a valid URL, the device's default web browser will redirect to the URL contained in the in-app notification payload. The location of the URL differs for each notification type:

  • url key present in the alert message payload

  • url present in the query parameters of a fullscreen message button (data-destination-url)

  • adb_deeplink key present in the local notification payload

  • uri key present in the push notification payload

To handle deep links in the notification payload, you need to set up URL schemes in the app. For more information about setting URL schemes for Android, see Create Deep Links to App Content. Once the desired activity is started by the newly added intent filter, the data present in the deep link can be retrieved. Any further actions based on the data present in the deep link can then be made.

Java

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Intent intent = getIntent();
String action = intent.getAction();
Uri data = intent.getData();
// parse any data present in the deep link
}

Android app links were introduced with Android OS 6.0. They are similar to deep links in functionality although they have the appearance of a standard website URL. The intent filter previously setup for deep links is modified to handle http schemes and verification of the app link needs to be setup on Google Search Console. For more information on the additional verification setup needed, see Verify Android App Links. The resulting app link can be used to redirect to specific areas of your app if it is installed or redirect to your app's website if it isn't. For more information on Android app links, see Handling Android App Links.

iOS

Handling alert or fullscreen notification website URLs on iOS

Website URL's included in alert or fullscreen messages are handled without any additional action by the app developer. If an alert of fullscreen message is clicked through and contains a valid URL, the Safari browser will be used to load the URL contained in the notification payload. The location of the URL differs for each notification type:

  • url key present in the alert message payload

  • url present in the query parameters of a fullscreen message button (data-destination-url)

  • adb_deeplink key present in the local notification payload

  • uri key present in the push notification payload

When a deep link is opened in Safari, this does not allow the app to directly handle the link. To provide a better customer experience, the Experience Platform SDK provides a URL handler that you can use with alert or fullscreen notification deep links.

Objective-C

[ACPCore registerURLHandler:^BOOL(NSString * _Nullable url) {
NSLog(@"Inside registerURLHandler callback, clickthrough url is: %@", url);
if([url containsString:@"campaigndemoapp://"]){
// handle the deep link (parse any data present in the deep link and/or redirect to a desired area within the app)
return true;
}
// false is returned when the URL should be opened in Safari
return false;
}];

Swift

ACPCore.registerURLHandler({ url in
print("Inside registerURLHandler callback, clickthrough url is: \(url ?? "")")
if url?.contains("campaigndemoapp://") ?? false {
// handle the deep link (parse any data present in the deep link and/or redirect to a desired area within the app)
return true
}
// false is returned when the URL should be opened in Safari
return false
})

Handling local notification website URLs on iOS

The website URL in the local notification response can be loaded using the openURL:options:completionHandler: instance method.

Objective-C

-(void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler{
dispatch_async(dispatch_get_main_queue(), ^{
NSDictionary *userInfo = response.notification.request.content.userInfo;
NSString *urlString = userInfo[@"adb_deeplink"];
if(urlString.length){
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: urlString] options:@{} completionHandler:^(BOOL success) {
NSLog(@"Open %@: %d",urlString,success);
}];
}
completionHandler();
});
}

Swift

func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
DispatchQueue.main.async(execute: {
let userInfo = response.notification.request.content.userInfo
let urlString = userInfo["adb_deeplink"] as? String
if (urlString?.count ?? 0) != 0 {
if let url = URL(string: urlString ?? "") {
UIApplication.shared.open(url, options: [:], completionHandler: { success in
print("Open \(urlString ?? ""): \(success)")
})
}
}
completionHandler()
})
}

Handling push notification website URLs on iOS

The website URL in the push notification can be loaded using the openURL:options:completionHandler: instance method.

Objective-C

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
dispatch_async(dispatch_get_main_queue(), ^{
NSString *urlString = userInfo[@"uri"];
if(urlString.length){
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: urlString] options:@{} completionHandler:^(BOOL success) {
NSLog(@"Open %@: %d",urlString,success);
}];
}
completionHandler(UIBackgroundFetchResultNoData);
});
}

Swift

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
DispatchQueue.main.async(execute: {
let urlString = userInfo["uri"] as? String
if (urlString?.count ?? 0) != 0 {
if let url = URL(string: urlString ?? "") {
UIApplication.shared.open(url, options: [:], completionHandler: { success in
print("Open \(urlString ?? ""): \(success)")
})
}
}
completionHandler(UIBackgroundFetchResultNoData)
})
}

When a local or push notification is clicked through, the didReceiveNotificationResponse instance method is called with the notification response being passed in as a parameter. For more information, see the Apple developer docs at userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:.

The deep link URL can be retrieved from the response object passed into the handler method. An example for retrieving the deep link URL and loading web links is provided below. The retrieved URL can then be parsed to aid with app navigation decision making. For more information about handling deep links and setting URL schemes for iOS, see Defining a Custom URL Scheme for Your App.

Objective-C

-(void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler{
dispatch_async(dispatch_get_main_queue(), ^{
NSDictionary *userInfo = response.notification.request.content.userInfo;
NSString *urlString = userInfo[@"adb_deeplink"];
NSString *urlString2 = userInfo[@"uri"];
if(urlString.length){
// handle the local notification deep link (parse any data present in the deep link and/or redirect to a desired area within the app)
}else if(urlString2.length){
// handle the push notification deep link (parse any data present in the deep link and/or redirect to a desired area within the app)
}
completionHandler();
});
}

Swift

func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
DispatchQueue.main.async(execute: {
let userInfo = response.notification.request.content.userInfo
let urlString = userInfo["adb_deeplink"] as? String
let urlString2 = userInfo["uri"] as? String
if (urlString?.count ?? 0) != 0 {
// handle the local notification deep link (parse any data present in the deep link and/or redirect to a desired area within the app)
} else if (urlString2?.count ?? 0) != 0 {
// handle the push notification deep link (parse any data present in the deep link and/or redirect to a desired area within the app)
}
completionHandler()
})
}

Universal links are available for iOS 9.0 devices or later. They can be used to redirect to specific areas of your app if it is installed or redirect to your app's website if it isn't. For more information, see Allowing Apps and Websites to Link to Your Content. Universal links are typically used from outside your installed app, for example, from a link present on a website or a link included in an email message. iOS will not open a universal link if it determines that the link is being opened from within the app it links to. For more information on this limitation, see the section titled "Preparing Your App to Handle Universal Links" at Support Universal Links. If a universal link is included as a Campaign clickthrough destination, the link must be handled by the app developer in a similar fashion as a deep link. More information can be seen at Handling alert or fullscreen notification deep links on iOS and Handling local or push notification deep links on iOS.