Implementing AAM for Android

Introduction

AAM for mobile can be used to ingest, organize, and segment an advertiser’s first- and third-party mobile and desktop audience data. Assisting a marketer for audience creation, analytics, and executing marketing campaigns. Audience manager can be integrated with multiple platforms and mobile operating systems.

This article focuses on implementing Adobe Audience Manager in android mobile apps.  This article is technical in nature as the intended audience is android developers implementing the solution and validating it.

The implementation guide is specific for implementation of Audience Manager when both the Marketing Cloud service and the core services are implemented for the client. In case Marketing Cloud service is implemented for the client and core services is not implemented then check the implementation Tech specific with Marketing Cloud service. If the Marketing Cloud service (Visitor ID service) is not enabled then, refer the corresponding client side implementation guide.

Prerequisites

You should have downloaded the Adobe SDK files to begin the implementation set up for Audience Manager. If you have the Analytics administrator access you can set up the app in Adobe Mobile Services and download the SDK for your app. If you don’t have access to the Adobe Mobile Services, you can download the SDK from this link: https://github.com/Adobe-Marketing-Cloud/mobile-services/releases?

Search for the latest Android SDK and download the AdobeMobileLibrary-4.*-Android.zip file. You should have the following software components within it:

  • adobeMobileLibrary.jar: Library designed for use with Android devices and simulators.
  • ADBMobileConfig.json: SDK configuration file customized for your app.

Add the adobeMobileLibrary.jar as a file dependency under Dependencies within your project structure as shown in below screenshot:

image1

If your app is already configured for Adobe Analytics then the above steps would have already been done along with the core implementation & Life cycle metrics implementation and you can directly proceed to the section of Audience Manager configuration.

Core Implementation & Lifecycle

The SDK downloaded requires Android 2.2 or later for the implementation to work.

1. Add the ADBMobileConfig.json file to assets folder in your project.

2. Add app permissions to let the AppMeasurement library to send and record offline tracking calls. To add these permissions, add the following lines to your AndroidManifest.xml file (in the application project directory):

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

3. Implement lifecycle metrics (In each activity within your application):

a. Import the following library:

 import com.adobe.mobile.*; 

b. Within the onResume function, begin collecting lifecycle data: 

@Override
public voidonResume() {
Config.collectLifecycleData(this);
// -or- Config.collectLifecycleData(this, contextData);
}

 c.  Within the onPause function, pause collecting lifecycle data

@Override
public voidonPause() {
Config.pauseCollectingLifecycleData();
}

4. To include additional data with lifecycle metric calls, pass an additional parameter to collectLifecycleData that contains context data:

@Override
public voidonResume() {
HashMap<String, Object> contextData = new HashMap<String, Object>();
contextData.put("myapp.category", "Game");
Config.collectLifecycleData(this, contextData);
}

You can see this documentation for some steps that are required to be performed if you are using IntelliJ IDEA or Eclipse instead of Android Studio for configuring the apps: https://marke1ting.adobe.com/resources/help/en_US/mobile/android/dev_qs.html

Audience Manager Configuration

1. When we configure the app in Mobile Services User Intetrface: https://mobilemarketing.adobe.com we get options to enable Server Side Forwarding (SSF) in Audience Manager SDK configuration section.  

From there itself we can check Analytics Forwarding and enter subdomain for Audience Manager. So, after downloading the ADBMobileConfig.json file it will have all the required fields.

 

image2
image2_1
"marketingCloud" : {
  "org": "YOUR-MCORG-ID"
}
"audienceManager": {
    "server": "",
    "analyticsForwardingEnabled": "true",
  },

Following are steps to manually enter these values in the ADBMobileConfig.json file. Within the ADBMobileConfig.json file in the section for audienceManager and marketingCloud provide the following configuration details

 

"marketingCloud" : {
  "org": "YOUR-MCORG-ID"
}
"audienceManager": {
    "server": "",
    "analyticsForwardingEnabled": "true",
  },

Note:

  • A pre-requisite for using server side forwarding of analytics data is that the client should be provisioned for Marketing Cloud ID Service (https://marketing.adobe.com/resources/help/en_US/mcvid/).
  • Marketing Cloud organization IDs uniquely identify each client company in the Adobe Marketing Cloud, and are similar to the following value: 016D5C175213CCA80A490D05@AdobeOrg.       

When the above configuration is set up all the lifecycle metrics are captured within the analytics call and get forwarded directly through server side:

image3

2. Within the onCreate method in the main activity, allow the SDK access to your application context using Config.setContext:

@Override
public voidonCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Allow the SDK access to the application context
Config.setContext(this.getApplicationContext());
}

If you already added this method call when you implemented Analytics or Target, you do not need to add it again.

Verify the Implementation

Below are some of the call logs check points to verify the server side implementation:

If a customer ID sync happens then it shows up in: d_cid_ic in the dpm.demdex.net network call. When server side implementation is done there is no additional Audience Manager network call made. The data from Analytics gets pushed to Audience Manager thorough server side.

image4

Note that d_uuid will not be available in the request call if server side forwarding is done along with visitor ID implementation (unlike client side implementation). You should be able to see d_mid value & d_orgid values instead which are associated with the Visitor ID service in the dpm.demdex.net call. However, the uuid value will appear in the response which would look something like this (this appears in the Analytics network call):

image5