Optional Module: Ad Identifier

Optional Module: Ad Identifier

by ‎03-22-2018 07:40 AM - edited ‎03-22-2018 09:04 AM (48 Views)

This is a separate, optional plugin that provides a Cordova wrapper for the native Android Ad Identifier module, and additional code to get the iOS Advertising Identifier (IDFA).

Installation

  1. Navigate to your cordova app's directory in a terminal window, and enter cordova plugin add tealium-cordova-adidentifier.
  2. In the JavaScript file where you instantiate the main Tealium plugin, after calling tealium.init, add the following code:
function tealiumInit(accountName, profileName, environmentName, instanceName){
    var ai;
        tealium.init({...});
                 // check if installreferrer is installed and available
        
        ai = window.tealiumAdIdentifier;
        if (ai) {
         ai.setPersistent(instanceName);   
         // Optionally, set as volatile data instead. Volatile data is cleared after the app is closed. Persistent data is therefore recommended
         // ai.setVolatile(instanceName);
        }
}

Testing

After installing the plugin, the following variables will be available as additional parameters on all tracking calls. If you are sending your data to the Tealium UDH, you will see these variables in "EventStream > Live Events" or when running a Trace session. If you are using Tealium iQ only, you can create and map the variables to a tag of your choice, and you will be able to verify success by checking in your 3rd party tracking tools.

The variables to look for are:

Android -> google_adid iOS -> device_advertising_id, device_advertising_vendor_id, device_advertising_enabled

Removal

To remove the Ad Identifier plugin, run cordova plugin rm tealium-cordova-adidentifier.

To delete the Ad Identifier data from persistent storage, call

// android only
tealium.removePersistent("google_adid", <your tealium instance name>);
// ios only
tealium.removePersistent("device_advertising_id", <your tealium instance name>);
tealium.removePersistent("device_advertising_vendor_id", <your tealium instance name>);
tealium.removePersistent("device_advertising_enabled", <your tealium instance name>);