Adobe Marketing Cloud Android SDK 4.x for Marketing Cloud Solutions
Contents Android SDK 4.x for Marketing Cloud Solutions...5 Release Notes for Android SDK 4.x for Marketing Cloud Solutions...6 Getting Started...8 Before You Start...8 Core Implementation and Lifecycle...9 Processing Rules and Context Data...11 Configuration...13 ADBMobile JSON Config...13 Override the ADBMobile JSON Config Path...20 Hit Batching...20 Configuration Methods...21 Analytics...26 Track App States...26 Track App Actions...27 Track App Crashes...29 Timed Actions...31 Visitor Lifetime Value...32 Products Variable...33 Products Variable with Merchandising evars and Product-Specific Events...34 Event Serialization...35 Video Analytics...35 Postbacks...39 Postbacks Example...40 Analytics Methods...41 Last updated 9/15/2015 Android SDK 4.x for Marketing Cloud Solutions
Contents Acquisition...45 Mobile App Acquisition...45 Acquisition Methods...46 Messaging...47 In-app Messaging...47 Push Messaging...49 Location...51 Geo-Location and Points of Interest...51 Beacon tracking...53 Target...55 Target Configuration...55 Target Methods...55 Marketing Cloud...58 Marketing Cloud Visitor ID Configuration...58 Marketing Cloud Visitor ID Service Methods...58 Audience Manager...60 Audience Manager Configuration...60 Audience Manager Methods...60 Lifecycle Metrics...62 Wearables...67 Android Wearable Implementation...67 Android SDK Reference...70 App IDs...70 Visitor Tracking Between an App and Mobile Web...70 Last updated 9/15/2015 Android SDK 4.x for Marketing Cloud Solutions
Android Widgets...71 Opt-Out and Privacy Settings...72 Using Bloodhound to Test Mobile Applications...73 PhoneGap Plug-in...74 PhoneGap Plug-in Methods...75 4.x Migration Guide...80 Documentation Updates...84 Historical Release Notes...86 Contact and Legal Information...88 Last updated 9/15/2015 Android SDK 4.x for Marketing Cloud Solutions
Android SDK 4.x for Marketing Cloud Solutions 5 Android SDK 4.x for Marketing Cloud Solutions Android SDK 4.x for Marketing Cloud Solutions lets you measure native Android applications, deliver targeted content within your app, and leverage and collect audience data through audience management. Last Update: September 17, 2015 Version 4.6 of the SDK is now available! See Release Notes for Android SDK 4.x for Marketing Cloud Solutions. This SDK supports Android 2.2 or later. Note: In version 4.2 and later, all hits are now sent using HTTP POST. This has no impact on the data that is collected or reported, but you'll need to use a packet analyzer that supports inspecting POST data to view hits, such as the Bloodhound 3 beta. If you are upgrading from a previous version, you'll want to take a look at the 4.x Migration Guide. Adobe Mobile Services Adobe Mobile services provides a new UI that brings together mobile marketing capabilities for mobile applications from across the Adobe Marketing Cloud. Initially, the Mobile service provides seamless integration of app analytics and targeting capabilities from the Adobe Analytics and Adobe Target solutions. Learn more at Adobe Mobile Services documentation.
Release Notes for Android SDK 4.x for Marketing Cloud Solutions 6 Release Notes for Android SDK 4.x for Marketing Cloud Solutions Release notes and known issues for Android SDK 4.x for Marketing Cloud Solutions. This section contains the following information: Current Release Notes Marketing Cloud Release Notes, Documentation Updates, and Historical Release Notes Current Release Notes The Android SDK version 4.6 (September 17, 2015) includes the following changes: Feature Push Messaging to Analytics Segments Adobe Mobile Services and the Adobe Mobile SDK allow you to send push messages to Analytics segments. The SDK also allows you to easily report users that have opened your app as a result of opening the push message. See Push Messaging. Acquisition Methods Allows developers to start an app acquisition campaign as if the user had clicked a link. This is helpful for creating manual acquisition links and handling the app store redirect yourself. See Acquisition. Postbacks Postback Signals let you send data collected by the SDK to a separate third-party server. Leveraging the same triggers and traits you use to display an in-app message, you can configure the SDK to send customized data to a third-party destination. See Postbacks. Identifiers Added the following new identifiers: The setpushidentifier method in Configuration Methods. The submitadvertisingidentifiertask method in Configuration Methods. Marketing Cloud Release Notes, Documentation Updates, and Historical Release Notes In addition to the notes for each release, the following resources provide additional information: Resource Marketing Cloud Release Notes Documentation Updates View the latest release notes for the Adobe Marketing Cloud solutions. View detailed information about updates to this guide that might not be included in these release notes.
Release Notes for Android SDK 4.x for Marketing Cloud Solutions 7 Resource Historical Release Notes View information about new features and enhancements in previous releases of Android SDK 4.x for Marketing Cloud Solutions.
Getting Started 8 Getting Started Information to help you get starting with the Android SDK for Marketing Cloud Solutions. Before You Start Complete these steps to configure a report suite to collect app data. If you are an Analytics administrator: Complete the steps in Set up your App in Adobe Mobile Services to configure a report suite to collect mobile app data. After you complete these steps, create an Analytics account for each app developer and give them access to view the report suite(s) you created. If you are an app developer: Send a link to this page to your Analytics administrator and ask him or her to complete these steps. After the report suite is configured, your administrator will provide you with a login you can use to complete steps in Download the SDK and Testing Tools. This section contains the following information: Set up your App in Adobe Mobile Services Download the SDK and Testing Tools Set up your App in Adobe Mobile Services Note: You must be an Analytics Administrator to complete these steps. Adobe Mobile services is the primary reporting interface for mobile app analytics and targeting. After you complete these steps you can download a configuration file that is pre-configured with your data collection server, report suite, and many other settings. First, sign in at https://mobilemarketing.adobe.com. Two ways exist for you to sign in: Marketing Cloud: Sign in to the Marketing Cloud with your Adobe ID. This method assumes that your company has been provisioned in the Marketing Cloud, and you have linked your Analytics account. (If you are unsure, use your existing Adobe Analytics account.) Adobe Analytics: Click Sign in with Analytics provide your Analytics company, username, and password. Complete the following steps to set up a new report suite to collect app data and to define an app in Adobe Mobile services. 1. Click the Create New App button. (If you don't see this button, click Manage Apps > Add instead.) 2. From the Report Suite drop-down, select New Report Suite. 3. Provide the name of your App and select a unique report suite ID, for example, mycomobileappdev. Note that you'll need to set up separate report suites and apps for the development and production versions, so you can repeat these steps when you are ready to set up the production version. 4. Leave Mobile App Template selected. This template enables timestamps to collect offline data and activates the mobile solution variables to capture lifecyle metrics. 5. Select your Timezone and Currency, and then click Save. Download the SDK and Testing Tools After an Analytics Administrator has completed the previous steps, complete the following to download the mobile SDKs. 1. Browse to https://mobilemarketing.adobe.com and log-in the with the account your administrator created for you. 2. Select your App from the drop-down list in the left navigation. 3. Click the Gear icon to open the App configuration.
Getting Started 9 4. Scroll to bottom of the page and download the SDK, Bloodhound, and the Sample App for your platform. A config file for your App is included in the SDK download automatically, so you don't need to download that separately unless you have already downloaded the SDK and you just want to get updated settings. Core Implementation and Lifecycle Information to help you implement the Android library and collect lifecyle metrics (launches, upgrades, sessions, engaged users, and so on). This section contains the following information: Core Implementation and Lifecycle Add the SDK and Config File to your Project (IntelliJ IDEA) Add the SDK and Config File to your Project (Eclipse) Add App Permissions Implement Lifecycle Metrics Get the SDK Requires Android 2.2 or later. Complete the steps in Before You Start to set up a development report suite and download a pre-populated version of the configuration file. After unzipping the [Your_App_Name_]AdobeMobileLibrary-4.*-Android.zip download file, you'll have the following software components: adobemobilelibrary.jar: Library designed for use with Android devices and simulators. ADBMobileConfig.json: SDK configuration file customized for your app. Note: If you download the SDK outside of the Adobe Mobile services UI, the ADBMobileConfig.json must be manually configured. If you are new to Analytics and the mobile SDK, we highly recommend using the steps in Before You Start to set up a development report suite and download a pre-populated version of the configuration file. Configuration is not difficult, but it can be a source of frustration when you are getting started. Add the SDK and Config File to your Project (IntelliJ IDEA) For IntelliJ users: 1. Add the ADBMobileConfig.json file to the assets folder of your project. 2. Right click your project in the Project navigation panel. 3. Select Open Module Settings. 4. Select Libraries under Project Settings. 5. Click + icon to add a new library. 6. Select Java and navigate to the adobemobilelibrary.jar file. 7. Select the modules where you plan to use the mobile library. 8. Click Apply, and then OK to close the Module Settings window. Add the SDK and Config File to your Project (Eclipse) For Eclipse users: 1. Add the ADBMobileConfig.json file to the assets folder of your project.
Getting Started 10 2. In the Eclipse IDE, right-click on the project name. 3. Select Build Path > Add External Archives. 4. Select adobemobilelibrary.jar. 5. Click Open. 6. Right-click the project again, then select Build Path > Configure Build Path. 7. Click the Order and Export tab. 8. Ensure that adobemobilelibrary.jar is selected. Add App Permissions The AppMeasurement Library requires the following permissions to send data and record offline tracking calls: INTERNET ACCESS_NETWORK_STATE 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" /> Implement Lifecycle Metrics After you enable lifecycle, each time your app is launched, a single hit is sent to measure launches, upgrades, sessions, engaged users, and many other Lifecycle Metrics. In your main activity: 1. Import the library: import com.adobe.mobile.*; 2. Within the oncreate method, allow the SDK access to your application context using Config.setContext: @Override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); // Allow the SDK access to the application context Config.setContext(this.getApplicationContext()); 3. Within the onresume function, begin collecting lifecycle data: @Override public void onresume() { Config.collectLifecycleData(this); // -or- Config.collectLifecycleData(this, contextdata); 4. Within the onpause function, pause collecting lifecycle data: @Override public void onpause() { Config.pauseCollectingLifecycleData(); In Each activity within your application: 1. Import the library: import com.adobe.mobile.*;
Getting Started 11 2. Within the onresume function, begin collecting lifecycle data: @Override public void onresume() { Config.collectLifecycleData(this); // -or- Config.collectLifecycleData(this, contextdata); 3. Within the onpause function, pause collecting lifecycle data: @Override public void onpause() { Config.pauseCollectingLifecycleData(); It is essential that you add these calls to every activity to ensure accurate crash reporting. Including Additional Data with Lifecycle Calls To include additional data with lifecycle metric calls, pass an additional parameter to collectlifecycledata that contains context data: @Override public void onresume() { HashMap<String, Object> contextdata = new HashMap<String, Object>(); contextdata.put("myapp.category", "Game"); Config.collectLifecycleData(this, contextdata); Additional context data values that are sent with collectlifecycledata must be mapped to custom variables in Adobe Mobile services: Other Lifecycle Metrics are collected automatically. What to do next: Track App States Track App Actions Processing Rules and Context Data Processing rules are used to copy the data you send in context data variables to evars, props, and other variables for reporting. Processing Rules Training @ Summit 2013 Processing Rules Help
Getting Started 12 Become authorized to use Processing Rules We recommend grouping your context data variables using "namespaces", as it helps you keep logical ordering. For example, if you want to collect info about a product, you might define the following variables: "product.type":"hat" "product.team":"mariners" "product.color":"blue" Context data variables are sorted alphabetically in the processing rules interface, so namespaces let you quickly see variables that are in the same namespace. We recommend that you avoid naming context data keys using the evar or prop number: "evar1":"jimbo" This might make it slightly easier when you perform the one time mapping in processing rules, but you lose readability during debugging and future code updates can be more difficult. Instead, we strongly recommend using descriptive names for keys and values: "username":"jimbo" Context variables that define counter events should be set to 1: "logon":"1" Context data variables that define incrementor events can have the event as the key and the amount to increment as the value: "levels completed":"6" Note: Adobe reserves the namespace "a.". Aside from that small restriction, context data variables just need to be unique in your login company to avoid collisions.
Configuration 13 Configuration Information to help you configure the Android SDK, including JSON configuration, hit batching, and SDK methods. ADBMobile JSON Config Information to help you use the ADBMobile JSON Config file. ADBMobileConfig.json Config File Reference The same config file can be used for your app across multiple platforms. ios: The ADBMobileConfig.json can be placed anywhere that it is accessible in your bundle. Android: The ADBMobileConfig.json must be placed in the assets folder. Variable acquisition backdatesessioninfo batchlimit Minimum SDK Version 4.1 4.6 4.1 Enables mobile app acquisition. server - Acquisition server that is checked at the initial launch for an acquisition referrer. appid - Generated ID that uniquely identifies this app on the acquisition server. If this section is missing, you need to enable Mobile App acquisition and then re-download the SDK configuration file. See also: referrertimeout Enables/disables the ability for the Adobe SDK to backdate session info hits. Session info hits currently consist of crashes and session length. The default is false. When enabled, the Adobe SDK will backdate the session info hit to 1 second after the last hit of the previous session. This means that crashes and session data will correlate with the correct date in which they happened. This does, however, have a side effect in which it might create a visit for the backdated hit. One hit will be backdated on every new launch of the application. Be aware that backdated session hit information is sent in a session info server call. Additional server calls may apply. When disabled, the Adobe SDK will attach the session info to the current lifecycle. Threshold for number of hits to be sent in consecutive calls. For example, if batchlimit is set to 10, each hit prior to the 10th hit will be stored in the queue. Once the 10th hit comes in, all 10 hits will be sent consecutively Default: 0 (Batching not enabled) Requires offlineenabled = true
Configuration 14 Variable charset clientcode lifecycletimeout messages offlineenabled Minimum SDK Version 4.0 4.0 4.0 4.2 4.0 Defines the character set you are using for the data sent to Analytics. The charset is used to convert incoming data into UTF-8 for storage and reporting. See Using the charset Property. (Required by Target) Your assigned client code. Default: 300 seconds Specifies the length of time, in seconds, that must elapse between app launches before the launch is considered a new session. This timeout also applies when your application is sent to the background and reactivated. The time that your app spends in the background is not included in the session length. Generated automatically by Adobe Mobile services, defines the settings for in-app messaging. For details, see Messages description. When enabled, hits are queued while the device is offline and sent later when the device is online. Your report suite must be timestamp-enabled to use offline tracking. Default: false Important: If timestamps are enabled on your report suite, your offlineenabled configuration property must be true. if your report suite is not timestamp enabled, your offlineenabled configuration property must be false. If this is not configured correctly, data will be lost. If you are not sure if a report suite is timestamp enabled, contact Customer Care or download the configuration file from Adobe Mobile services. org poi 4.3 4.0 If you are currently reporting AppMeasurement data to a report suite that also collects data from JavaScript, you might need to set up a separate report suite for mobile data, or include a custom timestamp on all JavaScript hits using the s.timestamp variable. Specifies the Marketing Cloud org ID for the visitor ID service. Each POI array holds the POI name, latitude, longitude, and radius (in meters) for the area of the point. The POI name can be any string. When a tracklocation call is sent, if the current coordinates are within a defined POI, a context data variable is populated and sent with the tracklocation call. "poi" : [ ] ["san francisco",37.757144,-122.44812,7000], ["santa cruz",36.972935,-122.01725,600] Note: Starting in version 4.2, POIs are defined in the Adobe Mobile interface and then synchronized dynamically to the app configuration file. This synchronization requires the analytics.poi setting: analytics.poi : https://assets.adobedtm.com/ /yourfile.json,
Configuration 15 Variable Minimum SDK Version If this is not configured, the ADBMobile.json file must be updated to include this line. See "Before you Start" to download an updated configuration file. postback 4.6 The definition for the "callback" message template is shown below: "payload": { "templateurl": "", // required - will be token-expanded prior to being sent "templatebody": "", // optional - if this length > 0 POST will be used as transport method. This is a base64 encoded blob, which will be decoded and token-expanded prior to being sent. "contenttype": "", // optional - if this is length > 0 and POST type is selected this will be set as the Content-Type header. if this is not supplied for a POST request, the default will be "application/x-www-form-urlencoded" "timeout": 0 // optional - number of seconds to wait before timing out. Default is 2. The payload object in the code is an example payload for a message definition that would go in ADBMobileConfig.json. For more information, see the applicable topic: Android: Postbacks ios: Postbacks privacydefault referrertimeout remotes 4.0 4.1 4.2 Default: optedin optedin - hits are sent immediately. optedout - hits are discarded. optunknown - If your report suite is timestamp-enabled, hits are saved until the privacy status changes to opt-in (then hits are sent) or opt-out (then hits are discarded). If your report suite is not timestamp-enabled, hits are discarded until the privacy status changes to opt in. This sets the initial value only. If this value is ever set or changed in code, then the new value is used going forward until it is changed, or the app is uninstalled and then reinstalled. (Required by acquisition) Number of seconds the SDK waits for acquisition referrer data on the initial launch before timeout. If you are using acquisition, we recommend a 5 second timeout. If set to 0 or if not included, the SDK does not wait for acquisition data and acquisition metrics are not tracked. Configured automatically, defines the Adobe hosted endpoints for dynamic configuration files. The last update time of each configuration file is checked against the current version at each launch, and any updates are downloaded and saved. analytics.poi - endpoint for hosted POI configuration.
Configuration 16 Variable rsids server ssl Minimum SDK Version 4.0 4.0 4.0 messages - endpoint for hosted in-app message configuration. (Required by Analytics) One or more report suites to receive Analytics data. Multiple report suite IDs should be comma-separated with no space between. "rsids" : "rsid" "rsids" : "rsid1,rsid2" (Required by Analytics and/or Audience Management). Analytics or Audience Management server, based on the parent node. This variable should be populated with the server domain, without an "http://" or https://" protocol prefix. The protocol prefix is handled automatically by the library based on the ssl variable. If ssl is true, a secure connection is made to this server. If ssl is false, a non-secure connection is made to this server. Default: false Enables (true) or disables (false) sending measurement data via SSL (HTTPS). The definition for the "callback" message template is shown below: "payload": { "templateurl": "", // required - will be token-expanded prior to being sent "templatebody": "", // optional - if this length > 0 POST will be used as transport method. This is a base64 encoded blob, which will be decoded and token-expanded prior to being sent. "contenttype": "", // optional - if this is length > 0 and POST type is selected this will be set as the Content-Type header. if this is not supplied for a POST request, the default will be "application/x-www-form-urlencoded" "timeout": 0 // optional - number of seconds to wait before timing out. Default is 2. The payload object in the code is an example payload for a message definition that would go in ADBMobileConfig.json. For more information, see the applicable topic: Android: Third-Party Callback ios: Third-Party Callback timeout 4.0 Determines how long Target waits for a response. The following is an example of an ADBMobileConfig.json file: { "version": "2014-08-05T19:18:28.169Z", "marketingcloud" : { "org": "016D5C175213CCA80A490D05@AdobeOrg"
Configuration 17, "target": { "clientcode": "", "timeout": 5, "audiencemanager": { "server": "", "acquisition": { "server": "c00.adobe.com", "appid": "10a77a60192fbb628376e1b1daeeb65debf934e2c807e067ceb2963a41b165ee", "analytics": { "rsids": "coolapp", "server": "my.coolapp.com", "ssl": false, "offlineenabled": true, "charset": "UTF-8", "lifecycletimeout": 300, "privacydefault": "optedin", "batchlimit": 0, "referrertimeout": 5, "poi": [ ["san francisco",37.757144,-122.44812,7000], ["santa cruz",36.972935,-122.01725,600] ], "messages": [ { "messageid": "cb426565-a563-497a-a889-9dbeb451f8ae", "template": "fullscreen", "payload": { "html": "<!DOCTYPE html><html><head><meta charset=\"utf-8\" /><title></title><style></style></head><body><iframe src=\"http://www.adobe.com/\" frameborder=\"0\"></iframe></body></html>", "showoffline": false, "showrule": "always", "enddate": 2524730400, "startdate": 0, "audiences": [], "triggers": [ { "key": "pev2", "matches": "eq", "values": [ "AMACTION:custom" ] ] ], "remotes": { "analytics.poi": "https://assets.adobedtm.com/staging/42a6fc9b77cd9f29082cf19b787bae75b7d1f9ca/scripts/satellite-53e0faadc2f9ed92bc00003b.json", "messages": "https://assets.adobedtm.com/staging/42a6fc9b77cd9f29082cf19b787bae75b7d1f9ca/scripts/satellite-53e0f9e2c2f9ed92bc000032.json" Messages description The messages node is generated automatically by Adobe Mobile services and typically does not need to be manually changed. The following description is provided for troubleshooting purposes: "messageid"
Configuration 18 Generated ID, required "template" "alert", "fullscreen", or "local" required "showoffline" true or false default is false "showrule" "always", "once", or "untilclick" required "enddate" number of seconds since Jan 1, 1970 default is 2524730400 "startdate" number of seconds since Jan 1, 1970 default is 0 "payload" "html" fullscreen template only, required html defining the message "image" fullscreen only, optional url to the image to be used for a fullscreen image "altimage" fullscreen only, optional name of the bundled image to use if the url specified in image is unreachable "title" fullscreen and alert, required title text for a fullscreen or alert message "content" alert and local notification, required
Configuration 19 sub-text for an alert message, or notification text for a local notification message "confirm" alert, optional text used in the confirm button "cancel" alert, required text used in the cancel button "url" alert, optional url action to load if the confirm button is clicked "wait" local notification, required amount of time to wait (in seconds) to post the local notification after matching its criteria "audiences" array of objects that defines how the message should be shown "key" variable name to look for in the hit, required "matches" type of matcher used when doing the comparison eq = equals ne = does not equal co = contains nc = does not contain sw = starts with ew = ends with ex = exists nx = does not exist lt = less than le = less than or equals gt = greater than ge = greater than or equals "values" an array of values used to match against the value of the variable named in
Configuration 20 key with the matcher type in matches "triggers" same as audiences, but this is the action instead of the audience "key" "matches" "values" Override the ADBMobile JSON Config Path Load a different ADBMobile JSON Config file when the application starts. The Config.overrideConfigStream(configInput) method enables you to specify the path to a different ADBMobile.json configuration file when the application starts. This method must be called before any other Marketing Cloud SDK call (before Config.collectLifecycleData() ), likely in the oncreate method of your first loaded activity. Calling this method with a different path causes a one-time override of the configuration file until the application is closed. try { InputStream configinput = getassets().open("examplejsonfile.json"); Config.overrideConfigStream(configInput); catch (IOException ex) { // do something with the exception if needed Hit Batching Hit batching allows applications with offline tracking enabled to hold hits from being sent until the number of hits in the queue pass a configurable limit. Requires SDK version 4.1 or later To enable hit batching, you need to update your ADBMobileConfig.json and specify a value for batchlimit: "analytics": { "batchlimit": 5,... When set to a number higher than 0, the SDK queues the number of hits equal to batchlimit. After this threshold is passed, all hits in the queue are sent. The following methods are used in conjunction with hit batching: Analytics.getQueueSize() - Returns a long with the number of hits currently in the hit batching queue. Analytics.sendQueuedHits() - Forces the library to send all hits in the queue no matter how many are currently queued. Analytics.clearQueue() - Clears all hits from the queue without sending them. : Offline tracking must be enabled to use hit batching.
Configuration 21 Configuration Methods List of methods provided by the Android library. This section contains the following information: Initial Configuration SDK Settings (Config Class) Initial Configuration The following method must be called once in the oncreate() method of your main activity. Method setcontext @Override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); Config.setContext(this.getApplicationContext()); SDK Settings (Config Class) Method getversion Returns the current version of the Adobe Mobile library. public static String getversion(); String libraryversion = Config.getVersion(); getprivacystatus Returns the enum representation of the privacy status for current user. MOBILE_PRIVACY_STATUS_OPT_IN - hits are sent immediately. MOBILE_PRIVACY_STATUS_OPT_OUT - hits are discarded. MOBILE_PRIVACY_STATUS_UNKNOWN - If your report suite is timestamp-enabled, hits are saved until the privacy status changes to opt-in (then hits are sent) or opt-out (then hits are discarded). If your report suite is not timestamp-enabled, hits are discarded until the privacy status changes to opt in. Default: The default value is set in ADBMobileConfig.json public static MobilePrivacyStatus getprivacystatus(); MobilePrivacyStatus privacystatus = Config.getPrivacyStatus(); setprivacystatus Sets the privacy status for the current user to status. Set to one of the following values:
Configuration 22 Method MOBILE_PRIVACY_STATUS_OPT_IN - hits are sent immediately. MOBILE_PRIVACY_STATUS_OPT_OUT - hits are discarded. MOBILE_PRIVACY_STATUS_UNKNOWN - If your report suite is timestamp-enabled, hits are saved until the privacy status changes to opt-in (then hits are sent) or opt-out (then hits are discarded). If your report suite is not timestamp-enabled, hits are discarded until the privacy status changes to opt in. public static void setprivacystatus(mobileprivacystatus status); Config.setPrivacyStatus(MobilePrivacyStatus.MOBILE_PRIVACY_STATUS_OPT_IN); getlifetimevalue Returns the lifetime value of the current user. Default: 0 public static BigDecimal getlifetimevalue(); BigDecimal currentlifetimevalue = Config.getLifetimeValue(); getuseridentifier Returns the custom user identifier if a custom identifier has been set. Returns null if a custom identifier is not set. Default: null Note: If your app upgrades from the Marketing Cloud 3.x to 4.x SDK, the previous visitor ID (either custom or automatically generated) is retrieved and stored as the custom user identifier. This preserves visitor data between upgrades of the SDK. For new installations on the 4.x SDK, user identifier is null until set. public static String getuseridentifier(); String userid = Config.getUserIdentifier(); setuseridentifier Sets the user identifier to identifier. public static void setuseridentifer(string identifier); Config.setUserIdentifier("billybob"); getdebuglogging Returns the current debug logging preference. Default: false
Configuration 23 Method public static Boolean getdebuglogging(); Boolean debugging = Config.getDebugLogging(); setdebuglogging Sets the debug logging preference to debuglogging. public static void setdebuglogging(boolean debuglogging); Config.setDebugLogging(true); collectlifecycledata Indicates to the SDK that lifecycle data should be collected for use across all solutions in the SDK. See Lifecycle Metrics. public static void collectlifecycledata(final Activity activity, final Map<String, Object> contextdata); Without extra context data: @Override protected void onresume() { super.onresume(); Config.collectLifecycleData(this); With extra context data: @Override public void onresume() { HashMap<String, Object> contextdata = new HashMap<String, Object>(); contextdata.put("myapp.category", "Game"); Config.collectLifecycleData(this, contextdata); collectlifecycledata (Activity activity) (4.2 or later) Indicates to the SDK that lifecycle data should be collected for use across all solutions in the SDK. See Lifecycle Metrics. public static void collectlifecycledata(final Activity activity); @Override protected void onresume() { super.onresume(); // assumes being called in an Activity class Config.collectLifecycleData(this);
Configuration 24 Method pausecollectinglifecycledata Indicates to the SDK that your app is paused, so that lifecycle metrics are calculated correctly. For example, on pause collects a timestamp to determine previous session length. This also sets a flag so that lifecycle correctly knows that the app did not crash. See Lifecycle Metrics. public static void pausecollectinglifecycledata(); @Override protected void onpause() { super.onpause(); Config.pauseCollectingLifecycleData(); setsmalliconresourceid(int resourceid) (4.2 or later) Set the small icon that will be used for notifications created by the SDK. This icon will show up in the status bar. This will also be the secondary image shown when the user sees the full notification in the notification center. public static void setsmalliconresourceid(final int resourceid); Config.setSmallIconResourceId(R.drawable.appIcon); setlargeiconresourceid(int resourceid) (4.2 or later) Set the large icon that will be used for notifications created by the SDK. This icon will be the primary image shown when the user sees the full notification in the notification center. public static void setlargeiconresourceid(final int resourceid); Config.setLargeIconResourceId(R.drawable.appIcon); overrideconfigstream(inputstream configinput) (4.2 or later) Lets you load a different ADBMobile JSON Config file when the application starts. The different configuration is used until the application is closed. public static void overrideconfigstream(final InputStream configinput); try { InputStream configinput = getassets().open("examplejsonfile.json"); Config.overrideConfigStream(configInput); catch (IOException ex) { // do something with the exception if needed setpushidentifier Sets the device token for push notifications.
Configuration 25 Method public static void setpushidentifier(final String registrationid);... // note: the code to retreive the push token must run in the background InstanceID instanceid = InstanceID.getInstance(getApplicationContext()); String token = instanceid.gettoken("835015092242", GoogleCloudMessaging.INSTANCE_ID_SCOPE, null); Config.setPushIdentifier(token);... submitadvertisingidentifiertask Provide a Callable to the SDK that returns the string of the Advertising Identifier returned from Google Play Services. The SDK runs this task on a background thread and sets an internal variable for Advertising Identifier based on the value returned from the Callable. Note, if you want to use Advertising Identifier in Acquisition or Lifecycle, you must call it before calling Config.collectLifecycleData. public static void submitadvertisingidentifiertask(final Callable<String> task); @Override public void onresume() { super.onresume(); final Callable<String> task = new Callable<String>() { @Override public String call() throws Exception { AdvertisingIdClient.Info idinfo; String adid = null; Context appcontext = CLASSNAME.this.getApplicationContext(); try { idinfo = AdvertisingIdClient.getAdvertisingIdInfo(appContext); if (idinfo!= null) { adid = idinfo.getid(); catch (Exception ex) { Log.e("Error", ex.getlocalizedmessage()); ; return adid; Config.submitAdvertisingIdentifierTask(task); Config.collectLifecycleData(this);
Analytics 26 Analytics Information to help you use the Android SDK with Adobe Analytics. Track App States States are the different screens or views in your application. Each time a new state is displayed in your application (for example, when a user navigates from the home page to the news feed), you should send a trackstate call. In Android, trackstate is typically called each time a new Activity is loaded. How to Track Prerequisites: Add the library to your project and implement lifecycle. 1. Import the library: import com.adobe.mobile.*; 2. Within the oncreate function, call trackstate to send a hit for this state view: @Override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); // Adobe - track when this state loads Analytics.trackState("State Name", null); The "State Name" is reported in the View State variable in Adobe Mobile services, and a view is recorded for each trackstate call. In other Analytics interfaces, View State is reported as Page Name and state views is reported as page views. Sending Additional Data In addition to the "State Name", you can send additional context data with each track action call: @Override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); // Adobe - track when this state loads HashMap<String, Object> examplecontextdata = new HashMap<String, Object>(); examplecontextdata.put("myapp.login.loginstatus", "logged in"); Analytics.trackState("Home Screen", examplecontextdata); Context data values must be mapped to custom variables in Adobe Mobile services:
Analytics 27 App State Reporting States are typically viewed using a pathing report so you can see how users navigate your app, and which states are viewed most. Adobe Mobile Services Adobe Analytics Ad hoc analytics View States Report. This report is based on the paths users took through your application. For example, Login > Home > Settings, or Home > Feed. States can be viewed anywhere Pages can be viewed, such as the Pages Report, Page Views report, and Path Reports. States can be viewed anywhere Pages can be viewed using the Page dimension, Page Views metric, Path Reports. Track App Actions Actions are the events that occur in your app that you want to measure. Each action has one or more corresponding metrics that are incremented each time the event occurs. For example, you might send a trackaction call for each new subscription, each time an article is viewed, or each time a level is completed. Actions are not tracked automatically, you must call trackaction when an event you want to track occurs, and then map the action to a custom event. How to Track Prerequisites: Add the library to your project and implement lifecycle. 1. Import the library: import com.adobe.mobile.*; 2. When the action that you want to track occurs in your app, call trackaction to send a hit for this action: Analytics.trackAction("myapp.ActionName", null); 3. In Adobe Mobile services, select your app and click Manage App Settings. 4. Click Manage Variables and Metrics and then click the Custom Metrics tab. 5. Map the context data name defined in your code ("myapp.actionname " in the example) to a custom event.
Analytics 28 You can also set a prop to hold all action values by mapping a custom prop with a name like "Custom Actions" and setting the value to 'a.action'. Sending Additional Data In addition to the action name, you can send additional context data with each track action call: HashMap<String, Object> examplecontextdata = new HashMap<String, Object>(); examplecontextdata.put("myapp.social.socialsource", "Twitter"); Analytics.trackAction("myapp.SocialShare", examplecontextdata); Context data values must be mapped to custom variables in Adobe Mobile services:
Analytics 29 Action Reporting Interface Adobe Mobile Services Report Action Paths Report. View the order in which actions occur in your app. You can also click Customize on any report to view actions ranked, trended, or in a breakdown report. Apply a filter to view actions for a specific segment. Marketing reports & analytics Ad hoc analytics Custom Event Report. After an action is mapped to a custom event, you can view mobile events similar to all other Analytics events. Custom Event Report. After an action is mapped to a custom event, you can view mobile events similar to all other Analytics events. Track App Crashes App crashes are tracked as part of lifecycle metrics. To track crashes, add the library to your project and implement lifecycle. When lifecycle metrics are implemented, a call is made to Config.collectLifecycleData in the OnResume method of each activity. In the onpause method, a call is made to Config.pauseCollectingLifeCycleData. Inside of the pausecollectinglifecycledata, a flag is set to indicate a graceful exit. When the app is relaunched or resumed, collectlifecycledata checks this flag for a graceful exit. If the app did not exit successfully (as determined by the flag status), an a.crashevent context data is sent with the next call and a crash event is reported. To ensure accurate crash reporting, you must call the pausecollectinglifecycledata inside of the onpause method of each activity. To understand why this is essential, it is helpful to understand the Android activity lifecycle:
Analytics 30 If a call is not made to pausecollectinglifecycledata before your app is paused, when the user returns to your app or when your app is re-launched, the SDK reports a crash event since the flag is not set to indicate a graceful exit. If Config.collectLifecycleData is called twice in a row during the same session (without a call to pausecollectinglifecycledata in between), then a crash is reported on every call after the first. For example, if you forget to add a call to pausecollectinglifecycledata to onpause for an activity, then a crash might be reported if the app is backgrounded during that activity. (See http://developer.android.com/guide/components/activities.html for more information on Android activity lifecycle. The Android lifecycle image that appears on this page was created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License)
Analytics 31 Timed Actions Timed actions let you measure in-app time and total time between the start and end of an action. The SDK calculates the amount of time in session and the total time (cross-session) it takes for the action to be completed. This can be used to define segments to compare on time to purchase, pass level, checkout flow, and so on. The following metrics are reported for timed actions: Total # of seconds in app between start and end - cross sessions Total # of seconds between start and end (clock time) An optional callback allows you to take additional action when the timed action completes: Run code and add any logic - optional custom logic based on duration results. Add context data prior to passing in durations. Cancel hit and durations not yet sent. How to Track Prerequisites: Add the library to your project and implement lifecycle. 1. Import the library: import com.adobe.mobile.*; 2. Call tracktimedactionstart and provide a timed action name and optional context data. HashMap cdata = new HashMap<String, Object>(); cdata.put("experiencename", experience); Analytics.trackTimedActionStart("TimeUntilPurchase", cdata); 3. (Optional) At any point, you can call tracktimedactionupdate with the timed action name to add additional context data. HashMap cdata = new HashMap<String, Object>(); cdata.put("myapp.imageliked", imagename); Analytics.trackTimedActionUpdate("TimeUntilPurchase", cdata); 4. When the event completes, call tracktimedactionend and pass the timed action name and TimedActionBlock (callback) which will look up all data and calculate durations. Timed event metrics are saved in mobile solution variables for automatic reporting. Analytics.trackTimedActionEnd("TimeUntilPurchase", cdata); Sending Additional Data In addition to the timed action name, you can send additional context data with the action start and action update calls: HashMap cdata = new HashMap<String, Object>(); cdata.put("myapp.imageliked", imagename); Analytics.trackTimedActionUpdate("TimeUntilPurchase", cdata); Context data values must be mapped to custom variables in Adobe Mobile services:
Analytics 32 Examples // Timed Action Start Example HashMap cdata = new HashMap<String, Object>(); cdata.put("experiencename", experience); Analytics.trackTimedActionStart("TimeUntilPurchase", cdata); // Timed Action Update Example cdata = new HashMap<String, Object>(); cdata.put("imageliked", imagename); Analytics.trackTimedActionUpdate("TimeUntilPurchase", cdata); // Timed Action End Example Analytics.trackTimedActionEnd("TimeUntilPurchase", null); // Timed Action End Example with Callback Analytics.trackTimedActionEnd("TimeUntilPurchase", new Analytics.TimedActionBlock<Boolean>() { @Override public Boolean call(long inappduration, long totalduration, Map<String, Object> contextdata) { contextdata.put("purchaseitem", "Item453"); return true; // return true to send the hit, false to cancel ); Visitor Lifetime Value Lifetime value lets you measure and target on a lifetime value for each user. Each time you send in a value with tracklifetimevalueincrease, the value is added to the existing value. Lifetime value is stored on device and can be retrieved at any time by calling lifetimevalue. This can be used to store lifetime purchases, ad views, video completes, social shares, photo uploads, and so on. How to Track Prerequisites: Add the library to your project and implement lifecycle. 1. Import the library: import com.adobe.mobile.*; 2. Call tracklifetimevalueincrease with the amount to increase the value: Analytics.trackLifetimeValueIncrease(BigDecimal.valueOf(5.0), null);
Analytics 33 Sending Additional Data In addition to the lifetime value, you can send additional context data with each track action call: HashMap cdata = new HashMap<String, Object>(); cdata.put("myapp.imageliked", imagename); Analytics.trackLifetimeValueIncrease(BigDecimal.valueOf(5.0), cdata); Context data values must be mapped to custom variables in Adobe Mobile services: Products Variable The products variable cannot be set using processing rules. In the mobile SDK, you must use a special syntax within the context data parameter to set products directly on the server call. To set the products variable, set a context data key to "&&products", and set the value using the syntax defined for the products variable: cdata.put("&&products", "Category;Product;Quantity;Price[,Category;Product;Quantity;Price]"); For example: //create a context data dictionary HashMap cdata = new HashMap<String, Object>(); // add products, a purchase id, a purchase context data key, and any other data you want to collect. // Note the special syntax for products cdata.put("&&products", ";Running Shoes;1;69.95,;Running Socks;10;29.99"); cdata.put("myapp.purchase", "1"); cdata.put("myapp.purchaseid", "1234567890"); // send the tracking call - use either a trackaction or TrackState call. // trackaction example: Analytics.trackAction("purchase", cdata); // trackstate example: Analytics.trackState("Order Confirmation", cdata); Note that products is set directly on the image request, and the other variables are set as context data:
Analytics 34 All context data variables must be mapped using processing rules: You do not need to map the products variable using processing rules since it is set directly on the image request by the SDK. Products Variable with Merchandising evars and Product-Specific Events An example of the products variable with Merchandising evars and product-specific events. //create a context data dictionary HashMap cdata = new HashMap<String, Object>(); // add products, a purchase id, a purchase context data key, and any other data you want to collect. // Note the special syntax for products cdata.put("&&events", "event1"); cdata.put("&&products", ";Running Shoes;1;69.95;event1=5.5;eVar1=Merchandising,;Running Socks;10;29.99"); cdata.put("myapp.purchase", "1"); cdata.put("myapp.purchaseid", "1234567890"); // send the tracking call - use either a trackaction or TrackState call. // trackaction example: Analytics.trackAction("purchase", cdata);
Analytics 35 // trackstate example: Analytics.trackState("Order Confirmation", cdata); Note: If you trigger a product-specific event using the &&products variable, you must also set that event in the &&events variable, otherwise the event is filtered out during processing. Event Serialization Event serialization is not supported by processing rules. In the mobile SDK, you must use a special syntax within the context data parameter to set serialized events directly on the server call. See Event Serialization. cdata.put("&&events", "event1:12341234"); For example: //create a context data dictionary HashMap cdata = new HashMap<String, Object>(); // add events cdata.put("&&events", "event1:12341234"); // send the tracking call - use either a trackaction or TrackState call. // trackaction example: Analytics.trackAction("action", cdata); // trackstate example: Analytics.trackState("State Name", cdata); Video Analytics This guide describes measuring video on Android using milestone video measurement. Note: Adobe has a new video measurement solution called video heartbeat. During video playback, frequent "heartbeat" calls are sent to this service to measure time played. These heartbeat calls are sent every 10 seconds, which results in granular video engagement metrics and more accurate video fallout reports. See Measuring Video in Adobe Analytics using Video Heartbeat for details. Additional information on milestone video measurement is available in the Measuring Video in Analytics guide. The general process to measure video is very similar across all platforms. This quick start section provides a basic overview of the developer tasks along with code samples. Map Player Events to Analytics Variables The following table lists the media data that is sent to Analytics. Use processing rules to map the context data in the Context Data Variable column to an Analytics variable as described in the Variable Type column. Context Data Variable Variable Type a.media.name evar Default expiration: Visit Custom Insight (s.prop, used for video pathing) (Required) Collects the name of the video, as specified in the implementation, when a visitor views the video in some way.you can add classifications for this variable.
Analytics 36 Context Data Variable Variable Type (Optional) The Custom Insight variable provides video pathing information. a.media.name Custom Insight (s.prop) (Optional) Provides video pathing information. Pathing must be enabled for this variable by ClientCare. Event type: Custom Insight (s.prop) a.media.segment evar Default expiration: Page view (Required) Collects video segment data, including the segment name and the order in which the segment occurs in the video. This variable is populated by enabling the segmentbymilestones variable when tracking player events automatically, or by setting a custom segment name when tracking player events manually. For example, when a visitor views the first segment in a video, SiteCatalyst might collect the following in the Segments evar: 1:M:0-25 The default video data collection method collects data at the following points: video start (play), segment begin, and video end (stop). Analytics counts the first segment view at the start of the segment, when the visitor starts watching. Subsequent segment views as the segment begins. a.contenttype evar Default expiration: Page view Collects data about the type of content viewed by a visitor. Hits sent by video measurement are assigned a content type of "video". This variable does not need to be reserved exclusively for video tracking. Having other content report content type using this same variable lets you analyze the distribution of visitors across the different types of content. For example, you could tag other content types using values such as article" or product page" using this variable. From a video measurement perspective, Content Type lets you identify video visitors and thereby calculate video conversion rates. a.media.timeplayed Event Type: Counter Counts the time, in seconds, spent watching a video since the last data collection process (image request). a.media.view Event Type: Counter Indicates that a visitor has viewed some portion of a video. However, it does not provide any information about how much, or what part, of a video the visitor viewed.
Analytics 37 Context Data Variable Variable Type a.media.segmentview Event Type: Counter Indicates that a visitor has viewed some portion of a video segment. However, it does not provide any information about how much, or what part, of a video the visitor viewed. a.media.complete Event Type: Counter Indicates that a user has viewed a complete video. By default, the complete event is measured 1 second before the end of the video. During implementation, you can specify how many seconds from the end of the video you would like to consider a view complete. For live video and other streams that don't have a defined end, you can specify a custom point to measure completes. For example, after a specific time viewed. Configure Media Settings Configure a MediaSettings object with the settings you want to use to track video: MediaSettings mysettings = Media.settingsWith("name", 10, "playername", "playerid"); Track Player Events To measure video playback, The mediaplay, mediastop, and mediaclose methods need to be called at the appropriate times. For example, when the player is paused, mediastop. mediaplay is called when playback starts or is resumed. Classes Class: MediaSettings public String name; public String playername; public String playerid; public double length; public String channel; public String milestones; public String offsetmilestones; public boolean segmentbymilestones; public boolean segmentbyoffsetmilestones; public int trackseconds = 0; public int completecloseoffsetthreshold = 1; // MediaAnalytics Ad settings public String parentname; public String parentpod; public String CPM; public double parentpodposition; public boolean ismediaad; Class: MediaState public Date opentime = new Date(); public String name; public String segment; public String playername; public String mediaevent; public int offsetmilestone; public int segmentnum;
Analytics 38 public int milestone; public double length; public double offset; public double percent; public double timeplayed; public double segmentlength; public boolean complete = false; public boolean clicked = false; public boolean ad; public boolean eventfirsttime; Media Measurement Class and Method Reference Method settingswith Returns a MediaSettings object with specified parameters. public static MediaSettings adsettingswith(string name, double length, String playername, String parentname, String parentpod, double parentpodposition, String CPM); MediaSettings mysettings = Media.settingsWith("name", 10, "playername", "playerid"); adsettingswith Returns a MediaSettings object for use with tracking an ad video. public static MediaSettings adsettingswith(string name, double length, String playername, String parentname, String parentpod, double parentpodposition, String CPM); open Opens a MediaSettings object for tracking. public static void open(mediasettings settings, MediaCallback callback); Media.open(mySettings, new Media.MediaCallback() { @Override public void call(object item) { // monitor callback if you want to be notified every second the media is playing ); close Closes the media item named name. public static void close(string name); Media.close("name");
Analytics 39 Method play Plays the media item named name at the given offset (in seconds). public static void play(string name, double offset); complete Manually mark the media item as complete at the offset provided (in seconds). public static void complete(string name, double offset); Media.complete("name", 0); stop Notifies the media module that the video has been stopped or paused at the given offset. public static void stop(string name, double offset); Media.stop("name", 0); click Notifies the media module that the media item has been clicked. public static void click(string name, double offset); Media.click("name", 0); track Sends a track action call (no page view) for the current media state. public static void track(string name, Map<String, Object> data); Media.track("name", null); Postbacks Postbacks let you send data collected by the SDK to a separate third-party server. Leveraging the same triggers and traits you use to display an in-app message, you can configure the SDK to send customized data to a third-party destination. Note: This functionality requires SDK version 4.6.0 or later.
Analytics 40 Postback messages are queued and follow all existing online/offline rules that govern analytics data collection. Note that postback messages do not cancel the rest of the messages if a message matches (like shown-messages do). This allows for multiple postbacks to occur on the same analytics hit. See the "postbacks" row in ADBMobile JSON Config for the definition. Template Expansions Template expansions are available in both the templateurl and templatebody properties. Template items take the form of "{key", where "key" is a context-data key, or traditional data key. The values available for template expansion are limited to the standard Lifecycle variables list, in addition to any custom data attached to the hit that triggers the message. No historical-based or segment-based data is available at this time. There are also specific, reserved templates that the SDK will replace for you automatically with internal data known to the SDK. This list includes: Token Name {%sdkver% Token Returns SDK version. {%cachebust% Resolves to a random number between 1 and 100000000. {%adid% Returns Advertiser ID for Android. Note, this only works if you have used submitadvertisingidentifiertask. {%pushid% Returns the Push Identifier token. Note, this only works if you have used setpushidentifier. {%timestampu% Returns current timestamp in epoch time. {%timestampz% Returns current timestamp in JavaScript (ISO 8601) format. Postbacks Example Definition and source code examples for the Postbacks feature. : This example is provided for informational purposes only. The ADBMobileConfig.json file should be configured in the Adobe Mobile UI. This file should not be modified manually. Using a manually edited configuration file is especially dangerous if you have remote messages configuration enabled. This section contains the following information: ADBMobileConfig.json Definition Source Code ADBMobileConfig.json Definition "messages": [ { "messageid": "79ae37c9-89b9-465e-af7f-d3351771f1dc", "template": "callback", "payload": { "templateurl": "http://my.server.com/?user={user.name&zip={user.zip&c16={%sdkver%&c27=cln,{a.prevsessionlength",
Analytics 41 "templatebody": "c2rrdmvypxslc2rrdmvyjx0my2i9eyvjywnozwj1c3qlfszjbgllbnrjzd17bi5jbgllbnquawr9jnrzpxsldgltzxn0yw1wvsv9jnrzej17jxrpbwvzdgftcfolfq==", ] "contenttype": "application/x-www-form-urlencoded", "timeout": 4, "showoffline": true, "showrule": "always", "enddate": 2524730400, "startdate": 0, "audiences": [], "triggers": [ { "key": "pagename", "matches": "eq", "values": [ "MainMenu" ] ] Source Code HashMap<String, Object> contextdata = new HashMap<String, Object>(); contextdata.put("user.name", "bob"); contextdata.put("user.zip", "90210"); Analytics.trackState("MainMenu", contextdata); Due to the fact that its state is MainMenu, this tracking call triggers the above postback message. The URL will replace all template variables with values from the hit. Assuming that the user s previous session was 132 seconds long and that user is on Android SDK version 4.6.0, the resulting URL would look like this: http://my.server.com/?user=bob&zip=90210&c16=4.6.0-an&c27=cln,132 Analytics Methods List of Adobe Analytics methods provided by the Android library. The SDK currently has support for multiple Adobe Marketing Cloud Solutions, including Analytics, Target, Audience Manager, and the Marketing Cloud Visitor ID Service. Methods are prefixed according to the solution. Marketing Cloud visitor ID methods are prefixed with "analytics." Each of these methods is used to send data into your Adobe Analytics report suite. Method trackstate Tracks an app state with optional context data. States are the views that are available in your app, such as "home dashboard", "app settings", "cart", and so on. These states are similar to pages on a website, and trackstate calls increment page views. If state is empty, it displays as "app name app version (build)" in reports. If you see this value in reports, make sure you are setting state in each trackstate call. Note: This is the only tracking call that increments page views. public static void trackstate(string state, Map<String, Object> contextdata);
Analytics 42 Method Analytics.trackState("loginScreen", null); trackaction Tracks an action in your app. Actions are the things that happen in your app that you want to measure, such as "logons", "banner taps", "feed subscriptions", and other metrics. public static void trackaction(string state, Map<String, Object> contextdata); Analytics.trackAction("heroBannerTouched", null); gettrackingidentifier Returns the automatically generated visitor identifier for Analytics. This is an app-specific unique visitor id that is generated on initial launch and then stored and used from that point forward. This ID is preserved between app upgrades, and is removed on uninstall. public static String gettrackingidentifier(); String trackingid = Analytics.getTrackingIdentifier(); tracklocation Sends the current latitude and longitude, and location within any defined point of interest public static void tracklocation(location location, Map<String, Object> contextdata); Analytics.trackLocation(userLocation, null); tracklifetime ValueIncrease Adds amount to the user's lifetime value. public static void tracklifetimevalueincrease(bigdecimal amount, Map<String, Object> contextdata); Analytics.trackLifetimeValueIncrease(new BigDecimal(30), null); tracktimedactionstart Start a timed action with name action. If you call this method for an action that has already started, the previous timed action is overwritten. Note: This call does not send a hit. public static void tracktimedactionstart(string action, Map<String, Object> contextdata);
Analytics 43 Method Analytics.trackTimedActionStart("cartToCheckout", null); tracktimed ActionUpdate Pass in contextdata to update the context data associated with the given action. The data passed in is appended to the existing data for the given action, and overwrites the data if the same key is already defined for action. Note: This call does not send a hit. public static void tracktimedactionupdate(string action, Map<String, Object> contextdata); HashMap cdata = new HashMap<String, Object>(); cdata.put("quantity", 3); Analytics.trackTimedActionUpdate("cartToCheckout", cdata); tracktimedactionend End a timed action. If you provide block, you will have access to the final time values and be able to manipulate data prior to sending the final hit. Note: If you provide block, you must return true to send a hit. Passing in null for block sends the final hit. public static void tracktimedactionend(string action, TimedActionBlock<Boolean> logic); Analytics.trackTimedActionEnd("cartToCheckout", new Analytics.TimedActionBlock<Boolean>() { @Override public Boolean call(long inappduration, long totalduration, Map<String, Object> contextdata) { contextdata.put("price", 49.95); return true; ); sendqueuedhits Requires SDK 4.1 Forces the library to send all hits in the offline queue no matter how many are currently queued. void sendqueuedhits() Examples: Analytics.sendQueuedHits();
Analytics 44 Method getqueuesize Returns the number of stored tracking calls in the offline queue. long getqueuesize() Examples: long queuesize = Analytics.getQueueSize(); clearqueue Clears all hits from the offline queue. void clearqueue() Examples: Analytics.clearQueue(); Warning: Use caution when clearing the queue manually as it cannot be reversed.
Acquisition 45 Acquisition Information to help you use acquisition tracking links in your Android apps. Mobile App Acquisition Acquisition links with unique tracking codes can be generated in Adobe Mobile services. When a user downloads and runs an app from the Google Play Store after clicking on the generated link, the SDK automatically collects and sends the acquisition data to Adobe Mobile services. Requires SDK version 4.1 or later Acquisition links must be created in Adobe Mobile services. See App Acquisition Analytics. Note: If you are sending data to multiple report suites, use the acquisition data from the app associated with the first report suite in your list of report suite ids. The updates described in this section enable the SDK to send acquisition data from a acquisition link. How to Track Prerequisites: Add the library to your project and implement lifecycle. 1. Import the library: import com.adobe.mobile.*; 2. Implement the BroadcastReceiver for referrer: package com.your.package.name; // replace with your app package name import android.content.broadcastreceiver; import android.content.context; import android.content.intent; public class GPBroadcastReceiver extends BroadcastReceiver { @Override public void onreceive(context c, Intent i) { com.adobe.mobile.analytics.processreferrer(c, i); 3. Update AndroidManifest.xml to enable the BroadcastReceiver that was created in the previous step: <receiver android:name="com.your.package.name.gpbroadcastreceiver" android:exported="true"> <intent-filter> <action android:name="com.android.vending.install_referrer" /> </intent-filter> </receiver> 4. Verify that ADBMobileConfig.json contains the required acquisition settings: "acquisition": { "server": "c00.adobe.com", "appid": "0652024f-adcd-49f9-9bd7-2552a4565d2f", "analytics": { "referrertimeout": 5,... Note: If you are sending data to multiple report suites, use the acquisition settings (acquisition server and appid) from the app that is associated with the first report suite in your list of report suite ids.
Acquisition 46 The acquisition settings are generated by Adobe Mobile services, and should not be changed. See Before You Start for details on how to download a customized ADBMobileConfig.json file with the acquisition settings pre-configured. After these settings are enabled, acquisition data is sent automatically with the initial lifecycle call after the initial launch of the app. : referrertimeout must be set to a value higher than 0 to enable app acquisition. Acquisition Methods List of Acquisition methods provided by the Android library. The following methods are supported: Method campaignstartforapp Allows developers to start an app acquisition campaign as if the user had clicked a link. This is helpful for creating manual acquisition links and handling the app store redirect yourself. Syntax public static void campaignstartforapp(final String appid, final Map<String, Object> data); Example Acquisition.campaignStartForApp("0652024f-adcd-49f9-9bd7-2552a4564d2f", new HashMap<String, Object>() {{ put("custom.key", "value"); );
Messaging 47 Messaging Information to help you use messaging in your Android apps. In-app Messaging Deliver in-app messages to your app users triggered from any analytics data or event. After implementation, messages are delivered to the app dynamically without requiring a code update. Requires SDK version 4.2 or later Messages and the rules that define when messages are displayed are created in Adobe Mobile services. See Create an in-app message. The updates described in this section must be made to the SDK to display in-app messages. You can complete these steps even if you do not have any messages defined yet. After you define messages, they will be delivered dynamically to your app and displayed without an app store update. How to Enable Prerequisites: Add the library to your project and implement lifecycle. 1. Update AndroidManifest.xml to declare the full screen activity and enable the Message Notification Handler: <activity android:name="com.adobe.mobile.messagefullscreenactivity" android:theme="@android:style/theme.translucent.notitlebar" /> <receiver android:name="com.adobe.mobile.messagenotificationhandler" /> If you select modal layout when you create a message in Adobe mobile services: You must also specify the theme for the message: <activity android:name="com.adobe.mobile.messagefullscreenactivity" android:theme="@android:style/theme.translucent.notitlebar.fullscreen" android:windowsoftinputmode="adjustunspecified statehidden" /> <receiver android:name="com.adobe.mobile.messagenotificationhandler" /> You can specify Theme.Translucent.NoTitleBar.Fullscreen, Theme.Translucent.NoTitleBar, or Theme.Translucent. 2. Import the library: import com.adobe.mobile.*; 3. In each collectlifecycledata call, pass this to provide a reference to your current activity: @Override public void onresume() { Config.collectLifecycleData(this);
Messaging 48 4. Verify that ADBMobileConfig.json contains the required settings for In-App messaging. Either messages or remotes is required. In order for in-app messages to be updated dynamically on launch, the remotes object must be present and properly configured: messages : [ { messageid : de45c43c-37bf-441f-8cbd-cc3ba3469ebe, template : fullscreen, showoffline : false, showrule : always, enddate : 2524730400, startdate : 0, audiences : [], triggers : [], payload : { // contents change depending on template html : <html>html code goes here</html>,, ] remotes : { analytics.poi : https://assets.adobedtm.com/ /yourfile.json, messages : https://assets.adobedtm.com/ /yourfile.json If these are not configured, download an updatedadbmobileconfig.json from Adobe Mobile services. Local Fallback Image When creating a full screen message in Adobe Mobile services, you can optionally specify a fallback image. In the case that your message is unable to retrieve its intended image from the web, the SDK attempts to load the image with the same name from your application s assets folder. This allows you to show your message in its original form even if the user is offline or the predetermined image is unreachable. The fallback image asset name is specified when configuring the message in Adobe Mobile services, you need to ensure the specified resource is available. Configure Notification Icons Two methods were added to let you configure the small and large icon that appears in the notification area, and the large icon that is displayed when notifications appear in the notification drawer. Method Config.setSmallIconResourceId(int resourceid) Set the small icon that will be used for notifications created by the SDK. This icon will show up in the status bar. This will also be the secondary image shown when the user sees the full notification in the notification center. public static void setsmalliconresourceid(final int resourceid); Config.setSmallIconResourceId(R.drawable.appIcon); Config.setLargeIconResourceId(int resourceid) Set the large icon that will be used for notifications created by the SDK. This icon will be the primary image shown when the user sees the full notification in the notification center.
Messaging 49 Method public static void setlargeiconresourceid(final int resourceid); Config.setLargeIconResourceId(R.drawable.appIcon); Push Messaging Adobe Mobile and the Adobe Mobile SDK allow you to send push messages to your users. The SDK also allows you to easily report users that have opened your app as a result of clicking through a push message. Note: Requires SDK version 4.6 or later. This section contains the following information: Prerequisites Enable Push Messaging Prerequisites Add the library to your project and implement lifecycle metrics. SDK must be enabled for Visitor ID Service. Enable Push Messaging Note: If your app is already set up to use messaging via GCM, some of the following steps may already be completed. 1. Verify that ADBMobileConfig.json contains the required settings for push messaging. The "marketingcloud" object must have its "org" property configured for push messaging. "marketingcloud": { "org": <org-id-string> A guide for setting up GCM can be found on the Google Developers website. Implementation of a sample app can be found at https://github.com/googlesamples/google-services/tree/master/android/gcm. 2. The registration ID/token must be passed to the SDK using the method Config.setPushIdentifier(final String registrationid). For example, in the RegistrationIntentService.java file in the sample app above (https://github.com/googlesamples/google-services/blob/master/android/gcm/app/src/main/java/gcm/play/android/samples/com/gcmquickstart/registrationintentservice.java), the SDK call should be made after the token is received. InstanceID instanceid = InstanceID.getInstance(this); String token=instanceid.gettoken(getstring(r.string.gcm_defaultsenderid),googlecloudmessaging.instance_id_scope, null); Config.setPushIdentifier(token); 3. Enable reporting by passing your activity in the collectlifecycledata method.
Messaging 50 There are two requirements for enabling push clickthrough reporting: In your implementation of GCMListenerService, the Bundle object containing the message data (passed into the onmessagereceived method) must be added to the Intent used to open the target activity on a clickthrough. This can be done using the method putextras (http://developer.android.com/reference/android/content/intent.html#putextras(android.os.bundle)). In the target activity of the clickthrough, the activity must be passed into the SDK with the collectlifecycledata call. Use either Config.collectLifecycleData(this) or Config.collectLifecycleData(this, contextdata). Do not use Config.collectLifecycleData().
Location 51 Location Information to help you use messaging in your Android apps. Geo-Location and Points of Interest Geo-location lets you measure location data (latitude and longitude) and pre-defined points of interest. Each tracklocation call sends the following: Latitude and Longitude, and location within a point of interest (POI) that is defined in Adobe Mobile services. These are passed to mobile solution variables for automatic reporting. Distance from center & accuracy passed as context data. These variables are not captured automatically, map these context data variables using the instructions in Sending Additional Data. This section contains the following information: Dynamic POI updates How to Track Sending Additional Data Location Context Data Notes Dynamic POI updates Starting in version 4.2, POIs are defined in the Adobe Mobile interface and then synchronized dynamically to the app configuration file. This synchronization requires an analytics.poi setting in the ADBMobile JSON Config: analytics.poi : https://assets.adobedtm.com/ /yourfile.json, If this is not configured, an updated version of the ADBMobile.json file must be downloaded and added to your app. See Download the SDK and Testing Tools for instructions. How to Track Prerequisites: Add the library to your project and implement lifecycle. 1. Import the library: import com.adobe.mobile.*; 2. At launch (or at any other time), call tracklocation to track the current location: Location currentlocation = new Location("my location here"); Analytics.trackLocation(currentLocation, null); Use Android Location Strategies to determine the location that is passed to the tracklocation call. Additionally, if the location is determined to be within a defined POI radius, an a.loc.poi context data variable is sent in with the tracklocation hit and is reported as a Point of Interest on the Location reports. An a.loc.dist context variable is also sent with the distance in meters from the defined coordinates. Sending Additional Data In addition to the location data, you can send additional context data with each track location call: HashMap<String, Object> locationcontextdata = new HashMap<String, Object>(); locationcontextdata.put("myapp.location.locationsource", "GPS");
Location 52 Location currentlocation = new Location("my location here"); Analytics.trackLocation(currentLocation, locationcontextdata); Context data values must be mapped to custom variables in Adobe Mobile services: Location Context Data The latitude and longitude are each sent using three different context data parameters, with each parameter representing a different level of precision, for a total of six context data parameters. For example, the coordinates lat = 40.93231, lon = -111.93152 represent a location with 1 m precision. This location is split according to the level of precision across the following variables: a.loc.lat.a = 040.9 a.loc.lat.b = 32 a.loc.lat.c = 31 a.loc.lon.a = -111.9 a.loc.lon.b = 31 a.loc.lon.c = 52 Some precision levels might appear as "00" depending on the accuracy of the current location. For example, if the location is currently accurate to 100m, a.loc.lat.c and a.loc.lon.c will be populated with "00". Notes A tracklocation request sends in the equivalent of a trackaction call. POIs are not passed as part of normal trackaction and trackstate calls, you must use a tracklocation call to track POIs. tracklocation should be called as often as necessary to track location and POIs. We recommend calling tracklocation when the app starts and then as needed based on the requirements of the application. POIs are populated only after they are defined in the app configuration file. They are not applied to historical tracklocation calls that were sent previously. tracklocation calls support sending additional context data similar to trackaction calls. When two POIs have overlapping diameters, the first POI that contains the current location is used. If your POIs overlap, you should list POIs in order of most granular to least granular to ensure that the most granular POI is reported.
Location 53 Beacon tracking Beacon tracking allows you to measure and target micro locations using ibeacon and Bluetooth Low Energy. The following beacon data is sent to Analytics and Target when trackbeacon is called: a.beacon.uuid - ProximityUUID of the beacon a.beacon.major - Major number of the beacon (such as store number) a.beacon.minor - Minor number of the beacon (such as a unique number within a store) a.beacon.prox - Number 0-3 representing how close the user is to the beacon. 0 unknown, 1 immediate, 2 near, 3 far. This beacon data is captured in mobile solution variables. How to Track Prerequisites: Add the library to your project and implement lifecycle. 1. Import the library: import com.adobe.mobile.*; 2. Gather beacon location. Multiple 3rd party libraries are available for scanning bluetooth LE beacons, depending on the manufacturer of the beacon. After beacon information has been obtained it can be tracked with the following call: // assumed that the following variables will have been retrieved by the 3rd party beacon library String beaconuuid; String major; String minor; Analytics.BEACON_PROXIMITY proximity; // BEACON_PROXIMITY is an enum available in the SDK. Number 0-3 representing how close the // user is to the beacon. 0 unknown, 1 immediate, 2 near, 3 far. Analytics.trackBeacon(beaconUUID, major, minor, proximity, null); 3. When the user leaves the proximity of the beacon, clear the current beacon: Analytics.clearBeacon(); Sending Additional Data In addition to the beacon data, you can send additional context data with each trackbeacon call: HashMap cdata = new HashMap<String, Object>(); cdata.put("myapp.imageliked", imagename); Analytics.trackBeacon(beaconUUID, major, minor, proximity, cdata); Context data values must be mapped to custom variables in Adobe Mobile services:
Location 54
Target 55 Target Information to help you deliver targeted content within Android applications. Target Configuration Deliver targeted content within Android applications. (Required) Set the Application Context The setcontext() method must be called once in the oncreate() method of your main activity. @Override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); Config.setContext(this.getApplicationContext()); If you already added this method call when you implemented Analytics or Audience Management, you do not need to add it again. Target Methods List of Adobe Target methods provided by the Android library. The SDK currently has support for multiple Adobe Marketing Cloud Solutions, including Analytics, Target, Audience Manager, and the Marketing Cloud Visitor ID Service. Methods are prefixed according to the solution. Marketing Cloud visitor ID methods are prefixed with "target." Lifecycle Metrics are sent as parameters to each mbox load. Class Reference : TargetLocationRequest Properties: public String name; public String defaultcontent; public HashMap<String, Object> parameters; String Constants (for ease of use when setting keys for custom parameters): public static final String TARGET_PARAMETER_ORDER_ID = "orderid"; public static final String TARGET_PARAMETER_ORDER_TOTAL = "ordertotal"; public static final String TARGET_PARAMETER_PRODUCT_PURCHASE_ID = "productpurchasedid"; public static final String TARGET_PARAMETER_CATEGORY_ID = "categoryid"; public static final String TARGET_PARAMETER_MBOX_3RDPARTY_ID = "mbox3rdpartyid"; public static final String TARGET_PARAMETER_MBOX_PAGE_VALUE = "mboxpagevalue"; public static final String TARGET_PARAMETER_MBOX_PC = "mboxpc"; // pcid in cookie public static final String TARGET_PARAMETER_MBOX_SESSION_ID = "mboxsession"; // sessionid in cookie public static final String TARGET_PARAMETER_MBOX_HOST = "mboxhost"; Method loadrequest Sends request to your configured Target server and returns the string value of the offer generated in a block callback.
Target 56 Method public static void loadrequest(targetlocationrequest request, TargetCallback<String> callback); Target.loadRequest(heroBannerRequest, new Target.TargetCallback<String>() { @Override public void call(string item) { // do something with item ); createorder ConfirmRequest Creates a TargetLocationRequest object with the given parameters. public static TargetLocationRequest createorderconfirmrequest(string name, String orderid, String ordertotal, String productpurchasedid, Map<String, Object> parameters); TargetLocationRequest orderconfirm = Target.createOrderConfirmRequest("orderConfirm", "order", "47.88", "3722", null); createrequest Creates a TargetLocationRequest object with the given parameters. public static TargetLocationRequest createrequest(string name, String defaultcontent, Map<String, Object> parameters); TargetLocationRequest herobannerrequest = Target.createRequest("heroBanner", "default.png", null); clearcookies Clears any target cookies from your app. public static void clearcookies(); Target.clearCookies(); getpcid Returns the pcid. public static String getpcid(); Target.getPcID(); getsessionid Returns the session ID.
Target 57 Method public static String getsessionid(); Target.getSessionID();
Marketing Cloud 58 Marketing Cloud Information to help you use the Android SDK with the Adobe Marketing Cloud. Marketing Cloud Visitor ID Configuration The Marketing Cloud visitor ID service provides a universal visitor ID across Marketing Cloud solutions. The visitor ID service is required by Analytics for Target, video heartbeat, and future Marketing Cloud integrations. Note: You do not need to populate the Marketing Cloud Visitor ID unless you are using the Marketing Cloud ID service. See Marketing Cloud Visitor ID Service for more information. Requires SDK version 4.3 or later How to Enable Prerequisites: Add the library to your project and implement lifecycle. 1. Import the library: import com.adobe.mobile.*; 2. Verify that ADBMobileConfig.json contains the marketingcloudorg: "marketingcloud" : { "org": "YOUR-MCORG-ID" Note: Marketing Cloud organization IDs uniquely identify each client company in the Adobe Marketing Cloud, and are similar to the following value: 016D5C175213CCA80A490D05@AdobeOrg. Be sure to include @AdobeOrg. If these are not configured, download an updatedadbmobileconfig.json from Adobe Mobile services. After configuration, a Marketing Cloud visitor ID is generated and is included on all hits. Other visitor IDs (custom and automatically-generated) continue to be sent with each hit. Marketing Cloud Visitor ID Service Methods Information to help you use the Android SDK with the Adobe Marketing Cloud. The SDK currently has support for multiple Adobe Marketing Cloud Solutions, including Analytics, Target, Audience Manager, and the Marketing Cloud Visitor ID Service. Methods are prefixed according to the solution. Marketing Cloud visitor ID methods are prefixed with "visitor." See Marketing Cloud Visitor ID Configuration. Method getmarketingcloudid Retrieves the Marketing Cloud visitor ID from the visitor ID service. public static String getmarketingcloudid(); String mcid = Visitor.getMarketingCloudId();
Marketing Cloud 59 Method syncidentifiers Along with the Marketing Cloud visitor ID, you can set additional customer IDs to associate with each visitor. The Visitor API accepts multiple Customer IDs for the same visitor, along with a customer type identifier to separate the scope of the different customer IDs. This method corresponds to setcustomerids in the JavaScript library. public static void syncidentifiers(map<string, String> identifiers); Map<String, String> identifiers = new HashMap<String, String>(); identifiers.put("idtype", "idvalue"); Visitor.syncIdentifiers(identifiers);
Audience Manager 60 Audience Manager Information to help you send signals and retrieve visitor segments from audience manager. Audience Manager Configuration Send signals and retrieve visitor segments from audience management. (Required) Set the Application Context The setcontext() method must be called once in the oncreate() method of your main activity. @Override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); 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. Audience Manager Methods Information to help you use the Android SDK with the Adobe Audience Manager. The SDK currently has support for multiple Adobe Marketing Cloud Solutions, including Analytics, Target, Audience Manager, and the Marketing Cloud Visitor ID Service. Methods are prefixed according to the solution. Marketing Cloud visitor ID methods are prefixed with "audience manager." If Audience Manager is configured in your JSON file, a signal containing lifecycle metrics is sent in with your lifecycle hit. getvisitorprofile Returns the visitor profile that was most recently obtained. Returns null if no signal has been submitted yet. Visitor profile is saved in SharedPreferences for easy access across multiple launches of your app. public static HashMap<String, Object> getvisitorprofile(); HashMap<String, Object> visitorprofile = AudienceManager.getVisitorProfile(); getdpid Returns the current DPID. public static void getdpid(); String dpid = AudienceManager.getDpid(); getdpuuid Returns the current DPUUID.
Audience Manager 61 public static void getdpuuid(); String dpuuid = AudienceManager.getDpuuid(); setdpidanddpuuid Sets the DPID and DPUUID. If DPID and DPUUID are set, they will be sent with each signal. public static void setdpidanddpuuid(string dpid, String dpuuid); AudienceManager.setDpidAndDpuuid("myDpid", "mydpuuid"); signalwithdata Sends audience management a signal with traits and get the matching segments returned in a block callback. public static void signalwithdata(map<string, Object> data, AudienceManagerCallback<Map<String, Object>> callback); HashMap aamtraits = new HashMap<String, Object>(); aamtraits.put("trait", "b"); AudienceManager.signalWithData(aamTraits, new AudienceManager.AudienceManagerCallback<Map<String, Object>>() { @Override public void call(map<string, Object> item) { // segments come back here, normally found in the segs object of your json );
Lifecycle Metrics 62 Lifecycle Metrics Lists the metrics and dimensions that can be measured automatically by the mobile library after lifecycle is implemented, as well as a link to troubleshoot Lifecycle data. See Troubleshoot Lifecycle data in the Knowledge Base for more information. Lifecycle Metrics and Dimensions When configured, lifecycle metrics are sent in context data parameters to Analytics, parameters to Target with each mbox call, and as a signal to audience management. Analytics and Target use the same format, while audience management uses a different prefix for each metric. For Analytics, the context data that is sent with each lifecycle tracking call is automatically captured in and reported using the metric or dimension listed in the first column, with the exceptions noted in the description column. Metrics Metric Analytics Context Data/Target Parameter Audience Manager Signal First Launches a.installevent c_a_installevent Triggered on first run after installation (or re-installation). Upgrades a.upgradeevent c_a_upgradeevent Triggered on first run after upgrade (anytime the version number changes). Daily Engaged Users a.dailyenguserevent c_a_dailyenguserevent Triggered when the application is used on a particular day. Note: Daily Engaged Users is not automatically stored in an Analytics metric. You must create a processing rule that sets a custom event to capture this metric. Monthly Engaged Users a.monthlyenguserevent c_a_monthlyenguserevent Triggered when the application is used during a particular month. Note: Monthly Engaged Users is not automatically stored in an Analytics metric. You must create a processing rule that sets a custom event to capture this metric. Launches a.launchevent c_a_launchevent Triggered on every run, including crashes and installs. Also triggered on a resume from background when the lifecycle session timeout has been exceeded.
Lifecycle Metrics 63 Metric Analytics Context Data/Target Parameter Audience Manager Signal Crashes a.crashevent c_a_crashevent Triggered when the application is not backgrounded before closing. Event is sent on application start following the crash. Adobe Mobile crash reporting does not implement a global uncaught exception handler. Previous Session Length a.prevsessionlength c_a_prevsessionlength Expressed in seconds and reports the number of seconds that a previous application session lasted based on how long the application was open and in the foreground. Dimensions Dimension Analytics Context Data/Target Audience Management Install Date a.installdate c_a_installdate Date of first launch after installation. MM/DD/YYYY App ID a.appid c_a_appid Stores the Application name and version in the following format: [AppName] [BundleVersion] For example, myapp 1.1 Launch Number a.launches c_a_launches Number of times the application was launched or brought out of the background. Days since first use a.dayssincefirstuse c_a_dayssincefirstuse Number of days since first run. Days since last use a.dayssincelastuse c_a_dayssincelastuse Number of days since last use. Hour of Day a.hourofday c_a_hourofday Measures the hour the app was launched. 24 hour numerical format. Used for time parting to determine peak usage times. Day of Week a.dayofweek c_a_dayofweek Number of the week day the app was launched. Operating System Version a.osversion c_a_osversion OS version.
Lifecycle Metrics 64 Dimension Analytics Context Data/Target Audience Management Days since last upgrade a.dayssincelastupgrade c_a_dayssincelastupgrade Number of days since the application version number has changed. Note: Days since last upgrade is not automatically stored in an Analytics variable. You must create a processing rule to copy this value to an Analytics variable for reporting. Launches since last upgrade a.launchessinceupgrade c_a_launchessinceupgrade Number of launches since the application version number has changed. Note: Launches since last upgrade is not automatically stored in an Analytics variable. You must create a processing rule to copy this value to an Analytics variable for reporting. Device Name a.devicename c_a_devicename Stores the device name. ios: Comma-separated 2 digit string that Identifies the ios device. The first number typically represents the device generation, and the second number typically versions different members of the device family. See ios Device Versions for a list of common device names. Carrier Name a.carriername c_a_carriername Stores the name of the mobile service provider as provided by the device. Note: Carrier name is not automatically stored in an Analytics variable. You must create a processing rule to copy this value to an Analytics variable for reporting. Resolution a.resolution c_a_resolution Width x Height in actual pixels Additional Mobile Metrics and Dimensions The following metrics and dimensions are captured in mobile solution variables by the method listed in the column. Metrics
Lifecycle Metrics 65 Event Analytics Context Data/Target Parameter Audience Management Trait Action Time Total a.action.time.total c_a_action_time_total Populated by tracktimedaction methods. Action Time In App a.action.time.inapp c_a_action_time_inapp Populated by tracktimedaction methods. Lifetime Value (event) a.ltv.amount c_a_ltv_amount Populated by tracklifetimevalue methods. Dimensions Dimension Analytics Context Data/Target Parameter Audience Management Trait Location (down to 10 km) a.loc.lat.a c_a_loc_lat_a Populated by tracklocation methods. a.loc.lon.a c_a_loc_lon_a Location (down to 100 m) a.loc.lat.b c_a_loc_lat_b Populated by tracklocation methods. a.loc.lon.b c_a_loc_lon_b Location (down to 1 m) a.loc.lat.c c_a_loc_lat_c Populated by tracklocation methods. a.loc.lon.c c_a_loc_lon_c Point of Interest Name a.loc.poi c_a_loc_poi Populated by tracklocation methods when device is within a defined POI. Distance to Point of Interest Center a.loc.dist c_a_loc_dist Populated by tracklocation methods when device is within a defined POI. Lifetime Value (conversion variable) a.ltv.amount c_a_ltv_amount Populated by tracklifetimevalue methods. Tracking Code a.referrer.campaign.trackingcode c_a_referrer_campaign_trackingcode Populated by Mobile App Acquisition. Generated automatically by Adobe mobile services. Campaign a.referrer.campaign.name c_a_referrer_campaign_name Name of the campaign, also stored in the campaign variable. Populated by Mobile App Acquisition. Campaign Content a.referrer.campaign.content c_a_referrer_campaign_content The name or id of the content that displayed the link. Populated by Mobile App Acquisition. Campaign Medium a.referrer.campaign.medium c_a_referrer_campaign_medium Marketing medium, such as banner or email. Populated by Mobile App Acquisition.
Lifecycle Metrics 66 Dimension Analytics Context Data/Target Parameter Audience Management Trait Campaign Source a.referrer.campaign.source c_a_referrer_campaign_source Original referrer, such as newsletter or social media network. Populated by Mobile App Acquisition. Campaign Term a.referrer.campaign.term c_a_referrer_campaign_term Paid keywords or other terms you want to track with this acquisition. Populated by Mobile App Acquisition.
Wearables 67 Wearables Information to help you collect data from your Android Wearable app. Android Wearable Implementation Starting in Android SDK version 4.5, a new Android extension lets you collect data from your Android Wearable app. This section contains the following information: Getting Started Additional Notes Getting Started To configure the SDK for Handheld App (Android Studio): For more information about how to import the SDK into your project, see Core Implementation and Lifecycle. 1. Add the ADBMobileConfig.json file to the assets folder of your project. 2. Add the adobemobilelibrary-*.jar file to the libs folder, or make sure it get referenced by the project. You might need to sync the gradle project after adding the.jar file. 3. Within the oncreate method, allow the SDK access to your application context using Config.setContext: @Override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); // Allow the SDK access to the application context Config.setContext(this.getApplicationContext()); 4. Add following code to AndroidManifest.xml: <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.read_phone_state" /> <application>... <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> </application> 5. Make sure your project has included Google play-services library. 6. Implement WearableListenerService or add the corresponding code into your own WearableListenerService: public class WearListenerService extends WearableListenerService { @Override public void onmessagereceived(messageevent messageevent) { super.onmessagereceived(messageevent); private GoogleApiClient mgoogleapiclient; @Override public void oncreate() { super.oncreate(); mgoogleapiclient = new GoogleApiClient.Builder(this).addApi(Wearable.API).build(); mgoogleapiclient.connect();
Wearables 68 @Override public void ondestroy() { super.ondestroy(); mgoogleapiclient.disconnect(); @Override public void ondatachanged(com.google.android.gms.wearable.dataeventbuffer dataevents) { DataListenerHandheld.onDataChanged(dataEvents, mgoogleapiclient, this); 7. Add WearListenerService into AndroidManifest.xml: <application>... <service android:name=".wearlistenerservice" > <intent-filter> <action android:name="com.google.android.gms.wearable.bind_listener" /> </intent-filter> </service> </application> To configure the SDK for Wearable App (Android Studio) 1. Add the same ADBMobileConfig.json file to the assets folder of your wearable project. Or Change the gradle config to use the ADBMobileConfig.json in the assets folder of the handheld app: android { sourcesets { main { assets.srcdirs = ['src/main/assets','../mobile/src/main/assets'] 2. Add the adobemobilelibrary-*.jar file to the libs folder, or make sure it get referenced by the project. You might need to sync the gradle project after adding the jar file. 3. Within the oncreate method, allow the SDK access to your application context using Config.setContext: @Override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); // Allow the SDK access to the application context Config.setContext(this.getApplicationContext(), Config.ApplicationType.APPLICATION_TYPE_WEARABLE); 4. Add following code to AndroidManifest.xml: <application>... <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> </application> 5. Make sure your project has included google play-services library. 6. Implement WearableListenerService, or add the corresponding code into your own WearableListenerService: public class WearListenerService extends WearableListenerService { @Override
Wearables 69 public void ondatachanged(com.google.android.gms.wearable.dataeventbuffer dataevents) { DataListenerWearable.onDataChanged(dataEvents); 7. Add WearListenerService into AndroidManifest.xml: <application>... <service android:name=".wearlistenerservice" > <intent-filter> <action android:name="com.google.android.gms.wearable.bind_listener" /> </intent-filter> </service> </application> Additional Notes There is one additional context value, A.RunMode, added to indicate whether the data comes from containing app or extension. RunMode = Application (the hit comes from handheld app) RunMode = Extension (the hit comes from wearable app) The SDK automatically syncs aid/vid/visitor service id/privacy status from the handheld app to the wearable app, so it's better not to call setprivacystatus/setuseridentifier/idsync from the wearable app. In-app messages, Target, and Audience Manager are disabled for the wearable app.
Android SDK Reference 70 Android SDK Reference Reference material to help you use the Android SDK for Marketing Cloud Solutions. App IDs Describes the different App identifiers used by the SDK and Adobe Mobile services. ID ID sent with lifecycle metrics App Store ID AppID in ADBMobile JSON Config This is a combination of the app name + bundle version that gets submitted to the app store. This value is used for the Versions report in Adobe Mobile services, and you can filter using this value to segment by a specific release version of your app. This ID is assigned to your app by the app store, and is provided in Adobe Mobile services when you create acquisition links. This ID is a unique ID assigned to the app instance by Adobe Mobile services for all the associated metadata in our system. This ID is used to create the unique URLs for acquisition tracking or tracking link. This ID is automatically added to the ADBMobile JSON config file when downloaded from the UI and can be found in the "Manage App Settings" under the Acquisition settings for your app. Visitor Tracking Between an App and Mobile Web If your app opens mobile web content, you need to take extra steps to ensure that visitors are not separately identified as they move between the native and mobile web in a hybrid app. Visitor IDs within Apps The SDK generates a unique visitor ID when an app is installed. This app visitor ID is stored within persistent memory on the mobile device and is sent with every hit. The app visitor ID is removed only when the user uninstalls the app (app visitor IDs persist through upgrades). Visitor IDs within Mobile Web Typical mobile web implementations use the same standard Analytics s_code.js or AppMeasurement.js that is used within desktop sites. The JavaScript libraries have their own methods of generating unique visitor IDs, which causes a different visitor ID to be generated when you open mobile web content from your app. To use the same visitor ID in the app and mobile web, complete the following instructions to pass the app visitor ID to the mobile web. How to Track Prerequisites: Add the library to your project and implement lifecycle. 1. Import the library: import com.adobe.mobile.*;
Android SDK Reference 71 2. Create a method to retrieve the app visitor ID from the SDK: protected static String retrievevisitoridentification() { // check to see if a custom ID is set. String visitorid = Config.getUserIdentifier(); if (visitorid == null visitorid.length() <= 0) { // if a custom ID was not set, get the default ID. visitorid = Analytics.getTrackingIdentifier(); return visitorid; 3. When you open mobile web content from your application, pass the app visitor ID as query parameter: String urlstring = "http://www.mydomain.com/index.php?appvi=" + retrievevisitoridentification(); Intent browserintent = new Intent(Intent.ACTION_VIEW, Uri.parse(urlString)); startactivity(browserintent); 4. Add the following JavaScript code to the s_doplugins() function in your Analytics s_code.js or AppMeasurement.js file that is included on the mobile web content to set the visitor ID that you passed: if (s.getqueryparam("appvi")) { s.new_vi_date=new Date; s.new_vi_date.setfullyear(s.new_vi_date.getfullyear() + 5); s.c_w("app_vi",s.getqueryparam("appvi"),s.new_vi_date); s.visitorid=s.c_r("app_vi"); else if (s.c_r("app_vi")) { s.visitorid=s.c_r("app_vi"); This code retrieves the app visitor ID from the query string, stores that value into a five-year cookie, and uses that value moving forward on the mobile web site (whether the app visitor ID is present within the URL or not). The custom visitor ID will appear as the 'vid' parameter on hits from mobile web content. Verification On hits from the mobile web content, verify that the 'vid' parameter is present on each hit, and that this value matches 'aid' (if you are not setting custom IDs using setuseridentifier), or matches 'vid' (if you are setting custom IDs by calling setuseridentifier). Android Widgets Android widgets can be tracked using the same methods as your app. Widgets share the application context with your app, so hit order and visitor identification is preserved. The following guidelines will help you track Android widgets: Do not implement lifecycle metrics (startactivity/stopactivity) calls in the widget itself. To track when a widget is added to the home screen, add a trackstate or trackevent call to the onenabled method of the widget. To track when the app is launched from a widget, add a trackstate or trackevent call before you create the intent to launch your application. If you are interested in tracking the context of an action, you can define a ContextData variable that provides the option of segmenting each out separately (for example, AppExperienceType="widget" vs. "app").
Opt-Out and Privacy Settings 72 Opt-Out and Privacy Settings You can control whether or not Analytics data is sent on a specific device using the following settings: privacydefault setting in ADBMobile JSON Config. This controls the initial setting that persists until it is changed in code. Config.setPrivacyStatus method. After the privacy setting is changed using this method, the change is permanent until it is changed again using this method, or the app is completely uninstalled and re-installed. The following table describes each privacy status: Setting Value in JSON Config Value in setprivacystatus Opt in Hits are sent. optedin MOBILE_PRIVACY_STATUS_OPT_IN Opt out Hits are discarded. optedout MOBILE_PRIVACY_STATUS_OPT_OUT Unknown If offline tracking is enabled, hits are saved until the privacy status changes to opt-in (then hits are sent) or opt-out (then hits are discarded). If offline tracking is not enabled, hits are discarded until the privacy status changes to opt in. optunknown MOBILE_PRIVACY_STATUS_UNKNOWN Examples public void setoptin(view view) { /* * Adobe Tracking - Analytics * * setting privacy status to ADBMobilePrivacyStatusOptIn will send hits immediately */ Config.setPrivacyStatus(MobilePrivacyStatus.MOBILE_PRIVACY_STATUS_OPT_IN); currentstatus = Config.getPrivacyStatus(); public void setoptout(view view) { /* * Adobe Tracking - Analytics * * setting privacy status to ADBMobilePrivacyStatusOptOut will discard hits immediately */ Config.setPrivacyStatus(MobilePrivacyStatus.MOBILE_PRIVACY_STATUS_OPT_OUT); currentstatus = Config.getPrivacyStatus(); public void setoptunknown(view view) { /* * Adobe Tracking - Analytics * * setting privacy status to ADBMobilePrivacyStatusOptUnknown will have different behaviors * if your app is not set to track offline, hits will be discarded immediately * if your app is set to track offline, hits will be retained until the privacy status changes * retained hits will all be sent if next privacy status is set to OptIn * retained hits will all be discarded if next privacy status is set to OptOut */ Config.setPrivacyStatus(MobilePrivacyStatus.MOBILE_PRIVACY_STATUS_UNKNOWN); currentstatus = Config.getPrivacyStatus();
Using Bloodhound to Test Mobile Applications 73 Using Bloodhound to Test Mobile Applications During application development, Bloodhound lets you view server calls locally, and optionally forward the data to Adobe collection servers. Bloodhound can be downloaded from any app configuration page in Adobe Mobile services, see Download the SDK and Testing Tools for instructions. Bloodhound 3 Beta for Mac documentation Bloodhound 2 for Windows documentation
PhoneGap Plug-in 74 PhoneGap Plug-in This plug-in lets you send Android AppMeasurement calls from your PhoneGap project. For help creating a PhoneGap project, see PhoneGap Getting Started with Android. To download the most-recent plug-in, see the release page in our GitHub account. Include the Plug-in 1. Drag ADBMobile_PhoneGap.java onto your src folder. Click OK to move this file. 2. Drag ADB_Helper.js into the folder that contains index.html (assets > www). Click OK to move this file. 3. In the res/xml folder, open config.xml and register an new plugin by adding the following: <feature name="adbmobile_phonegap"> <param name="android-package" value="[your_package_name].adbmobile_phonegap" /> </feature> For example, if you package is named com.example.phonegaptest, then your android-package value would be the following: <param name="android-package" value="com.example.phonegaptest.adbmobile_phonegap" /> Include the AppMeasurement Library To download the AppMeasurement library, see Get the SDK. 1. Drag adobemobilelibrary.jar onto your src folder. Click OK to move this file. 2. Right-click adobemobilelibrary.jar and select Add as Library. 3. Provide the name, level, and location for the library based on the requirements of your project. 4. Drag ADBMobileConfig.json onto your assets folder in the application root. Confirm that you have selected the root application and not an application within an application. 5. Click OK to move this file. Lifecycle Metrics Auto Tracking Lifecycle metrics are tracked by adding a few lines of code to the default activity that was automatically generated by PhoneGap. In a basic application, it is in src. 1. In oncreate, add the following code: com.adobe.mobile.config.setcontext(this.getapplicationcontext()); 2. In onresume, add the following code: com.adobe.mobile.config.collectlifecycledata(); 3. In onpause, add the following code: com.adobe.mobile.config.pausecollectinglifecycledata(); Add App Permissions The AppMeasurement Library requires the following permissions to send data and record offline tracking calls: INTERNET ACCESS_NETWORK_STATE
PhoneGap Plug-in 75 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" /> Implement Custom Tracking In html files where you want to use tracking, add the following to the <head> tag: <script type="text/javascript" charset="utf-8" src="adb_helper.js"></script> That's it, you are now ready to make measurement calls. See PhoneGap Plug-in Methods. PhoneGap Plug-in Methods In html files where you want to use tracking, add the following to the <head> tag: <script type="text/javascript" charset="utf-8" src="adb_helper.js"></script> Configuration Methods Method getprivacystatus Returns the privacy status for current user. ADB.optedIn - hits are sent immediately. ADB.optedOut - hits are discarded. ADB.optUnknown - If your report suite is timestamp-enabled, hits are saved until the privacy status changes to opt-in (then hits are sent) or opt-out (then hits are discarded). If your report suite is not timestamp-enabled, hits are discarded until the privacy status changes to opt in. Default: The default value is set in ADBMobileConfig.json getprivacystatus(function (value) { mytempval = value;, function () { mytempval = null; ); setprivacystatus getlifetimevalue Sets the privacy status for the current user to status. Set to one of the following values: ADB.optedIn - hits are sent immediately. ADB.optedOut - hits are discarded. ADB.optUnknown - If your report suite is timestamp-enabled, hits are saved until the privacy status changes to opt-in (then hits are sent) or opt-out (then hits are discarded). If your report suite is not timestamp-enabled, hits are discarded until the privacy status changes to opt in. ADB.setPrivacyStatus('ADB.optedIn'); Returns the lifetime value of the current user. Default: 0 ADB.getLifetimeValue(function (value) { mytempval = value;, function () { mytempval = null; );
PhoneGap Plug-in 76 Method setdebuglogging Enables (true) or disables (false) viewing debug information. By default, this variable is false. ADB.setDebugLogging(true); getversion Gets the library version. ADB.getVersion(function (value) { versionnum = value;, function () { versionnum = 1.0; ); trackingidentifier Returns the automatically generated visitor identifier. This is an app-specific unique visitor id that is generated on initial launch and then stored and used from that point forward. This ID is preserved between app upgrades, and is removed on uninstall. Note: If your app upgrades from the Marketing Cloud 3.x to 4.x SDK, the previous visitor ID (either custom or automatically generated) is retrieved and stored as the custom user identifier (see getuseridentifier below). This preserves visitor data between upgrades of the SDK. For new installations on the 4.x SDK, user identifier is null and tracking identifier is used. ADB.trackingIdentifier(function (value) { mytempval = value;, function () { mytempval = null; ); getuseridentifier Returns the custom user identifier if a custom identifier has been set. Returns null if a custom identifier is not set. Default: null getuseridentifier(function (value) { mytempval = value;, function () { mytempval = null; ); setuseridentifier Sets the user identifier to identifier. ADB.setUserIdentifier('testUser'); trackinggetqueuesize Gets or sets the number of stored tracking calls in the offline queue. ADB.trackingGetQueueSize(function (value) { mytempval = value;, function () { mytempval = null; ); trackingclearqueue Removes all stored tracking calls from the offline queue. Warning: use caution when clearing the queue manually as it cannot be reversed.
PhoneGap Plug-in 77 Method ADB.trackingClearQueue(function (value) { mytempval = value;, function () { mytempval = null; ); Tracking Methods Method trackstate Tracks an app state with optional context data. States are the views that are available in your app, such as "home dashboard", "app settings", "cart", and so on. These states are similar to pages on a website, and trackstate calls increment page views. cdata: JSON object with key-value pairs to send in context data. ADB.trackAppState(string statename[,json cdata]); ADB.trackState("login page"); ADB.trackState("login page", {"user":"john","remember":"true"); trackaction Tracks an action in your app. Actions are the things that happen in your app that you want to measure, such as "logons", "banner taps", "feed subscriptions", and other metrics. ADB.trackAction(string action[,json cdata]); ADB.trackAction("login"); ADB.trackAction("login", {"user":"john","remember":"true"); trackbeacon Tracks when a users enters proximity of a beacon. ADB.trackBeacon = function(uuid, major, minor, proximity, cdata) ADB.trackBeacon('2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6', 1, 2, ADB.beaconUnknown, {'hp':'hp_val','hp.company':'adobe' clearcurrentbeacon Clears beacons data after a user leaves the proximity of the beacon. ADB.clearCurrentBeacon = function(success, fail) ADB.clearCurrentBeacon();
PhoneGap Plug-in 78 Method tracklocation Sends the current x y coordinates. Also uses points of interest defined in the ADBMobileConfig.json file to determine if the location provided as a parameter is within any of your POI. If the current coordinates are within a defined POI, a context data variable is populated and sent with the tracklocation call. ADB.trackLocation(x, y[,json cdata]); ADB.trackLocation('40.431596', '-111.893713'); tracklifetime ValueIncrease Adds amount to the user's lifetime value. ADB.trackLifetimeValueIncrease(amount[,JSON cdata]); ADB.trackLifetimeValueIncrease('10.01'); tracktimedactionstart Start a timed action with name action. If you call this method for an action that has already started, the previous timed action is overwritten. Note: This call does not send a hit. ADB.trackTimedActionStart(action[,JSON cdata]); ADB.trackTimedActionStart("cartToCheckout"); tracktimedactionupdate Pass in cdata to update the context data associated with the given action. The cdata passed in is appended to the existing data for the given action, and overwrites the data if the same key is already defined for action. Note: This call does not send a hit. ADB.trackTimedActionUpdate(String action[,json cdata]); ADB.trackTimedActionUpdate("cartToCheckout",{'SampleContextDataKey3':'SampleContextDataVal3','SampleContextDataKey4':'SampleContextDataVal4'); tracktimedactionend End a timed action. ADB.trackTimedActionEnd("cartToCheckout");
PhoneGap Plug-in 79 Method trackingtimedactionexists Returns whether or not a timed action is in progress. ADB.trackingTimedActionExists(function (value) { mytempval = value;, function () { mytempval = null; ); Target Methods Method targetloadrequest Sends request to your configured Target server and returns the string value of the offer. ADB.targetLoadRequest(success, fail, name, defaultcontent, parameters); ADB.targetLoadRequest(function (value) { mytempval = value;, function () { mytempval = null;, 'banneroffer', 'none', {'hp':'hp_val_new','hp.company':'adobe', 'hp.val2':'hp_val2'); targetloadorderconfirmrequest Sends request to your configured Target server. ADB.targetLoadOrderConfirmRequest(success, fail, name, orderid, ordertotal, productpurchaseid, parameters); ADB.targetLoadRequest(function (value) { mytempval = value;, function () { mytempval = null;, 'name', 'orderid', 'total', 'purchaseid', {'hp':'hp_val_new','hp.company':'adobe', 'hp.val2':'hp_val2' );
4.x Migration Guide 80 4.x Migration Guide This section describes how to migrate to 4.x from the 3.x or 2.x version of the Android library. With the move to version 4, all of the public methods are consolidated into one header to make it easier on developers. Also, all functionality is now accessible through class level methods, so no more keeping track of pointers, instances, or singletons. The following sections walk you through migrating from version 2 or 3 to version 4. Events, Props, and evars If you've looked at the Configuration Methods, you are probably wondering where to set events, evars, props, heirs, and lists. In version 4, you can no longer assign those types of variables directly in your app. Instead, the SDK uses context data and processing rules to map your app data to Analytics variables for reporting. Processing rules provide you several advantages: You can change your data mapping without submitting an update to the App Store. You can use meaningful names for data instead of setting variables that are specific to a report suite. There is little impact to sending in extra data. These values won t appear in reports until they are mapped using processing rules. Any values that you were assigning directly to variables should be added to the data HashMap instead. Remove Unused Properties You probably noticed a new ADBMobileConfig.json file included with your download. This file contains application-specific, global settings, and replaces most of the configuration variables that were used in previous versions. Here is an example of an ADBMobileConfig.json file: { "version" : "1.0", "analytics" : { "rsids" : "coolapp", "server" : "my.coolapp.com", "charset" : "UTF-8", "ssl" : false, "offlineenabled" : true, "lifecycletimeout" : 5, "privacydefault" : "optedin", "poi" : [ ["san francisco",37.757144,-122.44812,7000], ["santa cruz",36.972935,-122.01725,600] ], "target" : { "clientcode" : "mytargetclientcode", "timeout" : 5, "audiencemanager" : { "server" : "myserver.demdex.com" The following tables list the configuration variables that you need to move to the configuration file. Move the value set for the variable in the first column to the variable in the second column, and then remove the old configuration variable from your code. Migrating from 3.x:
4.x Migration Guide 81 Configuration Variable/Method setofflinetrackingenabled setofflinehitlimit reportsuiteids trackingserver charset currencycode ssl linktrackvars linktrackevents Variable in ADBMobileConfig.json "offlineenabled" "batchlimit" "rsids" "server" "charset" "currency" "ssl" Remove, no longer used. Remove, no longer used. Migrating from 2.x: Move the value from the first column to the variable in the second column. Configuration Variable trackoffline offlinelimit account trackingserver trackingserversecure charset currencycode ssl linktrackvars Variable in ADBMobileConfig.json "offlineenabled" "batchlimit" "rsids" "server", remove the "http://" prefix. The protocol prefix is added automatically based on the "ssl" setting. Remove. For secure connections, define "server" and then enable "ssl". "charset" "currency" "ssl" Remove, no longer used.
4.x Migration Guide 82 Configuration Variable linktrackevents timestamp dc useragent dynamicvariableprefix visitornamespace useplugins Variable in ADBMobileConfig.json Remove, no longer used. Remove, no longer configurable. Remove, no longer used. Remove, no longer configurable. Remove, no longer used. Remove, no longer used. Remove, no longer used. usebestpractices Remove, replaced by Lifecycle Metrics. all calls to churn measurement (getchurninstance) Update Track Calls and Tracking Variables Instead of using the web-focused track and tracklink calls, the version 4 SDK uses two methods that make a little more sense in the mobile world: trackstate States are the views that are available in your app, such as "home dashboard", "app settings", "cart", and so on. These states are similar to pages on a website, and trackstate calls increment page views. trackaction Actions are the things that happen in your app that you want to measure, such as "logons", "banner taps", "feed subscriptions", and other metrics. The contextdata parameter for both of these methods is a HashMap<String, Object> that contains name-value pairs that are sent as context data. Events, Props, evars If you've looked at the Configuration Methods, you are probably wondering where to set events, evars, props, heirs, and lists. In version 4, you can no longer assign those types of variables directly in your app. Instead, the SDK uses context data and processing rules to map your app data to Analytics variables for reporting. Processing rules provide you several advantages: You can change your data mapping without submitting an update to the App Store. You can use meaningful names for data instead of setting variables that are specific to a report suite. There is little impact to sending in extra data. These values won t appear in reports until they are mapped using processing rules. See Processing Rules and Context Data.
4.x Migration Guide 83 Any values that you were assigning directly to variables should be added to the data HashMap instead. This means that calls to setprop, setevar, and assignments to persistent context data should all be removed and the values added to the data parameter. AppSection/Server, GeoZip, Transaction ID, Campaign, and other standard variables Any other data that you were setting on the measurement object, including the variables listed above, should be added to the data HashMap instead. To put it simply, the only data sent in with a trackstate or trackaction call is the payload in the data parameter. Replace Tracking Calls Throughout your code, replace the following methods with a call to trackstate or trackaction: Migrating from 3.x: trackappstate (trackstate) trackevents (trackaction) track (trackaction) tracklinkurl (trackaction) Migrating from 2.x: track (trackstate) tracklink (trackaction) Custom Visitor ID Replace the visitorid variable with a call to setuseridentifier. Offline Tracking Offline tracking is enabled in ADBMobileConfig.json. All other offline configuration is done automatically. Throughout your code, remove calls to the following methods: 3.x setonline setoffline 2.x forceoffline forceonline Products Variable See Products Variable for instructions. Test the Migration After you have completed the migration, see Using Bloodhound to Test Mobile Applications to find out how to inspect the data being sent by the mobile SDK.
Documentation Updates 84 Documentation Updates Information about updates to the Android SDK 4.x for Marketing Cloud Solutions help. Date and Topic September 19, 2015 New topic. Postbacks September 19, 2015 New topic. Postbacks Example September 19, 2015 Added "signals" row to table. ADBMobile JSON Config September 19, 2015 New topic. Push Messaging September 19, 2015 Configuration Methods Added "setpushidentifier" row to table. Added "submitadvertisingidentifiertask" row to table. September 19, 2015 New topic. Acquisition Methods August 19, 2015 New topic. Products Variable with Merchandising evars and Product-Specific Events August 19, 2015 Edited the Previous Session Length description. Lifecycle Metrics July 21, 2015 Lifecycle Metrics Updated the Previous Session Length row for the Analytics Context Data/Target Parameter and Audience Manager Signal columns. July 14, 2015 Edited the description for the crash metric. Lifecycle Metrics June 25, 2015 Updated the URL to download the most recent plug-in. PhoneGap Plug-in
Documentation Updates 85 Date and Topic May 26, 2015 Added the Target Methods section. PhoneGap Plug-in Methods May 21, 2015 New topic. Android Wearable Implementation
Historical Release Notes 86 Historical Release Notes Historical release notes for Android SDK 4.x for Marketing Cloud Solutions guide, listed by release date in descending order. New Features in Version 4.5 The Android SDK version 4.5 includes the following changes: Feature Android Wearable Extension Starting in Android SDK version 4.5, a new Android extension lets you collect data from your Android Wearable app. See Android Wearable Implementation. New Features in Version 4.4 Feature Custom data with lifecycle metrics You can now include custom context data variables with lifecycle metrics. See Implement Lifecycle Metrics. Beacon tracking support in PhoneGap The trackbeacon and clearcurrentbeacon calls are now available in PhoneGap. New Features in Version 4.3 Feature Marketing Cloud Visitor ID Configuration The Marketing Cloud visitor ID service provides a universal visitor ID across Marketing Cloud solutions. New Features in Version 4.2 Feature In-app Messaging Deliver in-app messages to your app users triggered from any analytics data or event. After implementation, messages are delivered to the app dynamically without requiring a code update. Dynamic Points of Interest Run-time selection of JSON Config file Points of interests are now retrieved dynamically after they are defined in Adobe Mobile services. You no longer need to submit an app update to the store to update your points of interest. You can now load a different ADBMobile JSON Config file when the application starts. The different configuration is used until the application is closed. POST Support All hits are now sent using HTTP POST instead of GET.
Historical Release Notes 87 New Features in Version 4.1 Feature Mobile app acquisition Allows you to measure the effectiveness of app download campaigns. By generating acquisition links in Adobe mobile services and implementing version 4.1, you can measure your acquisition channels from the first click through KPIs. Hit batching Enables the SDK to store hits and send them in batches instead of sending each hit as it occurs. Beacon support Support for Bluetooth LE and ibeacon technology to measure and personalize for app users in close proximity. New Features in Version 4 In addition to significant performance increases, version 4 adds the following new features: Feature Geo-location - Points of Interest Points of interest are for you to set up a lat/long central point, determine a radius, and then our tracklocation call will determine if the location provided for that call falls within any of your points of interest. Lifetime Value Lifetime value is a way to measure your users contributions and usage within your app. Each time you send in a value with tracklifetimevalueincrease, it will add to that user s existing value. Timed Action Timed Actions are an easy way for you see how long it takes your users to complete a process end-to-end within your app. Using tracktimedactionstart, tracktimedactionupdate, and tracktimedactionend, we will calculate the amount of time in session and the total time (cross-session) it takes for the action to be completed. Opt-in/Opt-out Quickly enable and disable analytics.
Contact and Legal Information 88 Contact and Legal Information Information to help you contact Adobe and to understand the legal issues concerning your use of this product and documentation. Help & Technical Support The Adobe Marketing Cloud Customer Care team is here to assist you and provides a number of mechanisms by which they can be engaged: Check the Marketing Cloud help pages for advice, tips, and FAQs Ask us a quick question on Twitter @AdobeMktgCare Log an incident in our customer portal Contact the Customer Care team directly Check availability and status of Marketing Cloud Solutions Service, Capability & Billing Dependent on your solution configuration, some options described in this documentation might not be available to you. As each account is unique, please refer to your contract for pricing, due dates, terms, and conditions. If you would like to add to or otherwise change your service level, or if you have questions regarding your current service, please contact your Account Manager. Feedback We welcome any suggestions or feedback regarding this solution. Enhancement ideas and suggestions for the Analytics suite can be added to our Customer Idea Exchange. Legal 2015 Adobe Systems Incorporated. All Rights Reserved. Published by Adobe Systems Incorporated. Terms of Use Privacy Center Adobe and the Adobe logo are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States and/or other countries. A trademark symbol (,, etc.) denotes an Adobe trademark. All third-party trademarks are the property of their respective owners. Updated Information/Additional Third Party Code Information available at http://www.adobe.com/go/thirdparty.