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:

Configuration Variable/Method Variable in ADBMobileConfig.json
setOfflineTrackingEnabled

"offlineEnabled"

setOfflineHitLimit

"batchLimit"

reportSuiteIDs

"rsids"

trackingServer

"server"

charSet

"charset"

currencyCode

"currency"

ssl

"ssl"

linkTrackVars

Remove, no longer used.

linkTrackEvents

Remove, no longer used.

Migrating from 2.x:

Move the value from the first column to the variable in the second column.

Configuration Variable Variable in ADBMobileConfig.json
trackOffline

"offlineEnabled"

offlineLimit

"batchLimit"

account

"rsids"

trackingServer

"server", remove the "http://" prefix. The protocol prefix is added automatically based on the "ssl" setting.

trackingServerSecure

Remove. For secure connections, define "server" and then enable "ssl".

charSet

"charset"

currencyCode

"currency"

ssl

"ssl"

linkTrackVars

Remove, no longer used.

linkTrackEvents

Remove, no longer used.

timestamp

Remove, no longer configurable.

dc

Remove, no longer used.

userAgent

Remove, no longer configurable.

dynamicVariablePrefix

Remove, no longer used.

visitorNamespace

Remove, no longer used.

usePlugins

Remove, no longer used.

useBestPractices

all calls to churn measurement (getChurnInstance)

Remove, replaced by Lifecycle Metrics.

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.

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.

Important: As of April 30, 2017, Adobe Bloodhound has been sunset. Starting on May 1, 2017, no additional enhancements and no additional Engineering or Adobe Expert Care support will be provided.