• Platforms
  • Partners
  • Forums
  • TLC Tealium Learning Center Tealium Learning
    Community
  • Discussions & Ideas Dicussions & Ideas
  • Product Guides Product Guides
  • Knowledge Base Knowledge Base
  • Developer Docs Developer Docs
  • Education Education
  • TLC Blog TLC Blog
  • Support Desk Support Desk
  • CDH Customer Data Hub Customer Data Hub

Table of Contents

  • Requirements
  • Install
    • Maven
    • Manual
  • Initialize
  • Auto-Tracked Events
  • Data Layer
    • Variable Name Overrides (optional)
  • API Reference
ANDROID JAVA/MODULE LIST

Optimizely X Tracking Module

Provides an integration between Optimizely X and Tealium Collect. The module listens for events triggered by the OptimizelyX library and passes the event data to Tealium Collect.

Requirements

  • Optimizely X Android SDK added to your app

Install

Install the Optimizely X Tracking module with Maven or manually.

Maven

To install the Optimizely X Tracking module with Maven:

  1. In your project’s top-level build.gradle file, add the following Maven repository:

    maven {
      url "https://maven.tealiumiq.com/android/releases/"
    }
  2. In your project module’s build.gradle file, add the following Maven dependency:

    dependencies{
      //only required if you do not have this reference
      implementation 'com.tealium:library:5.8.0'
      implementation 'com.tealium:optimizelylistener:1.1.2'
      //only required if you do not already have this reference and require lifecycle tracking
      implementation 'com.tealium:lifecycle:1.1.4'
    }

Manual

To install the Optimizely X module manually:

  1. Download the Tealium OptimizelyListener module.

  2. In your top-level build.gradle file, verify the following:

    allprojects {
      repositories {
         jcenter()
         flatDir {
              dirs 'libs'
         }
      }
    }
  3. Copy the file tealium.optimizelylistener-1.1.1.aar into your project’s <PROJECT_ROOT>/<MODULE>/libs directory.

  4. Add the Tealium library dependency to your project module’s build.gradle file:

    dependencies {
      // only required if you do not already have this reference
      implementation(name:'tealium-5.6.1', ext:'aar')
      implementation(name:'tealium.optimizelylistener-1.1.1', ext:'aar')
      // only required if you do not already have this reference and require lifecycle tracking
      implementation(name:'tealium.lifecycle-1.1.2', ext:'aar')
    }

Initialize

The module must be initialized after the OptimizelyManager has finished initializing. If initialized elsewhere, some or all events may not be tracked.

Optimizely provides a listener which is called as soon as the OptimizelyManager is initialized.

// import the Tealium OptimizelyListener module in the import section
import com.tealium.optimizelylistener.TealiumOptimizelyEventListener;
//...

// substitute the example instance name here with the same instance name you used when initializing the Tealium library
private static final String TEALIUM_INSTANCENAME = "teal";

myOptlyManager.initialize(getApplicationContext(), new OptimizelyStartListener() {
    @Override public void onStart(OptimizelyClient optimizely) {
        // call this to init the Optimizely listener with a valid OptimizelyManager instance
        // myOptlyManager is your own reference to the global OptimizelyManager instance
        TealiumOptimizelyEventListener.init(TEALIUM_INSTANCENAME, myOptlyManager);
        // activate experiment AFTER initializing the Tealium listener.
        // tracking calls are missed if not done in this order.
        Variation v = optimizely.activate("tealiumtest", "userid");
    }
});

Once you have initialized the module, no additional configuration is required. The module listens for notifications from the Optimizely SDK and pass the data to the Tealium SDK as required.

Auto-Tracked Events

There are two types of Optimizely events are passed along to Tealium Collect: experiments and custom events. 

These events are set in the tealium_event variable with the values:

  • Optimizely Experiment Started
    When the Optimizely SDK activates an experiment.
  • Optimizely Event Tracked
    When the Optimizely SDK receives a custom event (generated by manually calling Optimizely’s track method).

Data Layer

The following event attributes are included in the tracked Optimizely events:

Variable Scope Description Example
optimizely_ experiment_key Volatile (session) Optimizely experiment name "Homescreen MVT"
optimizely_ variation_key Volatile (session) Optimizely variation name "Variation A"
optimizely_ user_id Volatile (session) Optimizely user ID "[alice@tealium.com](mailto:alice@tealium.com)"
optimizely_ event _key Hit (single event) Optimizely event name "purchase"
optimizely_ event _value Hit (single event) Optimizely event value "123" (integers only)
optimizely_ XXX Hit (single event) All Optimizely custom attributes are prefixed with "optimizely_" and passed directly to Tealium

Variable Name Overrides (optional)

The default variable names are overridden easily if you prefer a different naming convention. Overriding variable names is done by changing a set of public properties on the TealiumOptimizelyEventListener class.

import com.tealium.optimizelylistener;
//...

TealiumOptimizelyEventListener.OPTIMIZELY_EXPERIMENT_KEYNAME = <your new value>;
TealiumOptimizelyEventListener.OPTIMIZELY_VARIATION_KEYNAME = <your new value>;
TealiumOptimizelyEventListener.OPTIMIZELY_USERID_KEYNAME = <your new value>;
TealiumOptimizelyEventListener.OPTIMIZELY_EVENTKEY_KEYNAME = <your new value>;
TealiumOptimizelyEventListener.OPTIMIZELY_EVENTVALUE_KEYNAME = <your new value>;
TealiumOptimizelyEventListener.OPTIMIZELY_EXPERIMENT_STARTED = <your new value>;
TealiumOptimizelyEventListener.OPTIMIZELY_EVENT_TRACKED = <your new value>;
TealiumOptimizelyEventListener.OPTIMIZELY_ATTRIBUTE_PREFIX = <your new value>;

API Reference

For the complete reference of methods for the Optimizely X Tracking Module, see the TealiumOptimizelyEventListener class in the Tealium SDK for Android API.

Location Module

 
  • Mobile
  • Getting Started
    • Overview
    • Quick Start Guide
    • Mobile Concepts
    • Client-Side
    • Server-Side
    • Tracking Webviews
    • Data Layer
    • Consent Management
    • Event Batching
    • User Location and Geofencing
    • Deep Links
    • Timed Events
    • Trace
    • Hosted Data Layer
    • Feature Comparison
    • Troubleshooting
  • Remote Commands
    • Overview
    • How It Works
    • Integrations
      • AppsFlyer
      • Braze
      • Contentsquare
      • Facebook
      • Firebase
      • Kochava
      • Usabilla
  • Android (Java)
    • Overview
    • Install
    • Track
    • Data Layer
    • Data Management
    • Consent Management
    • Module List
      • Ad Identifier Module
      • Crash Reporter Module
      • Install Referrer Module
      • Lifecycle Tracking Module
      • Location Module
      • Optimizely X Tracking Module
    • Android TV
    • Android Wear
    • API Reference
      • ConsentManager
      • DataSources
      • Lifecycle
      • Tealium
      • Tealium.Config
      • TealiumLocation
    • Release Notes
  • Android (Kotlin)
    • Overview
    • Install
    • Track
    • Data Layer
    • Consent Management
    • Identity Resolution
    • Module List
      • Collect Module
      • Collectors Module
      • Crash Reporter Module
      • Install Referrer Module
      • Lifecycle Tracking Module
      • Location Manager Module
      • Tag Management Dispatcher Module
      • Visitor Service Module
    • Android TV
    • API Reference
      • ConsentCategory
      • ConsentManager
      • CurrentVisit
      • DataLayer
      • Lifecycle
      • LocationManager
      • Tealium
      • TealiumConfig
      • VisitorProfile
      • VisitorService
    • Release Notes
  • Cordova
    • Overview
    • Install
    • Track
    • Data Management
    • Module List
      • Ad Identifier Module
      • Crash Reporter Module
      • Install Referrer Module
    • API Reference
    • Release Notes
  • Flutter
    • Overview
    • Install
    • Track
    • Consent Management
    • Data Management
    • API Reference
    • Release Notes
  • iOS (Objective-C)
    • Overview
    • Install
    • Track
    • Data Layer
    • Data Management
    • Consent Management
    • Tag Management
    • Module List
      • Lifecycle Tracking Module
      • Optimizely X Tracking Module
    • tvOS
    • watchOS
    • API Reference
    • Release Notes
  • iOS (Swift) 1.x
    • Overview
    • Install
    • Track
    • Data Layer
    • Data Management
    • App Extensions
    • Identity Resolution
    • Consent Management
    • Modules
    • Module List
      • AppData Module
      • Attribution Module
      • AutoTracking Module
      • Collect Module
      • Connectivity Module
      • CrashReporter Module
      • DataSource Module
      • DefaultStorage Module
      • Delegate Module
      • DeviceData Module
      • DispatchQueue Module
      • FileStorage Module
      • Lifecycle Module
      • Location Module
      • Logger Module
      • PersistentData Module
      • RemoteCommands Module
      • TagManagement Module
      • VisitorService Module
      • VolatileData Module
    • Feature Comparison
    • Working with Objective-C
    • API Reference
      • TealiumConfig
      • TealiumConsentCategories
      • TealiumConsentManagerDelegate
      • TealiumConsentManager
      • TealiumInstanceManager
      • TealiumPersistentData
      • TealiumVolatileData
      • Tealium
    • Release Notes
  • iOS (Swift) 2.x
    • Overview
    • Install
    • Track
    • Data Layer
    • Consent Management
    • App Extensions
    • Identity Resolution
    • Modules
    • Module List
      • AppData Module
      • Attribution Module
      • AutoTracking Module
      • Collect Module
      • Connectivity Module
      • CrashReporter Module
      • DeviceData Module
      • Lifecycle Module
      • Location Module
      • RemoteCommands Module
      • TagManagement Module
      • VisitorService Module
    • Working with Objective-C
    • API Reference
      • Tealium
      • TealiumConfig
      • TealiumConsentCategories
      • TealiumConsentManager
      • TealiumDataLayer
      • TealiumInstanceManager
    • Release Notes
  • React Native
    • Overview
    • Install
    • Track
    • API Reference
    • Release Notes
  • Unity
    • Overview
    • Install
    • Track
    • API Referencee
  • Xamarin
    • Overview
    • Install
    • Track
    • Data Management
    • Consent Management
    • API Reference
    • Release Notes
  • Web
  • AMP
    • Overview
    • Install
    • Track
    • Data Layer
  • Angular
    • Overview
    • Install
    • Track
    • API Reference
  • Google Tag Manager
    • Overview
    • Install
    • Data Layer
  • JavaScript (Web)
    • Overview
    • Install
    • Track
    • Data Layer
    • Universal Data Object (utag_data)
    • Universal Tag (utag.js)
    • Data Layer Object (b)
    • Single-Page Applications
    • Settings
    • Debugging
    • API Reference
      • Cookie Functions
      • GDPR Functions
      • Tracking Functions
      • Utility Functions
    • Release Notes
  • Server
  • C#
    • Overview
    • Install
    • Track
    • Data Layer
    • API Reference
    • Release Notes
  • HTTP API
    • Overview
    • Endpoint
    • Data Layer
  • Java
    • Overview
    • Install
    • Track
    • API Reference
    • Release Notes
  • Node
    • Overview
    • Install
    • Track
    • API Reference
  • Python
    • Overview
    • Install
    • Track
    • API Reference
  • Roku
    • Overview
    • Install
    • Track
    • API Reference
  • Ruby
    • Overview
    • Install
    • Track
    • API Reference

Was this article helpful?

This page was last updated: August 17, 2020       Thank you for your feedback!
  • Platforms
  • Partners
  • Forums
  • Mobile
  • Getting Started
  • Remote Commands
  • Android (Java)
  • Android (Kotlin)
  • Cordova
  • Flutter
  • iOS (Objective-C)
  • iOS (Swift) 1.x
  • iOS (Swift) 2.x
  • React Native
  • Unity
  • Xamarin
  • Web
  • AMP
  • Angular
  • Google Tag Manager
  • JavaScript (Web)
  • Server
  • C#
  • HTTP API
  • Java
  • Node
  • Python
  • Roku
  • Ruby