• 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

  • Class: Tealium
    • addPersistentData()
    • deletePersistentData()
    • getDataManager()
    • getPersistentData()
    • getSessionId()
    • resetSessionId()
    • track()
  • Class: Tealium.Builder
    • build()
    • Builder()
    • setDatasource()
    • setEnvironment()
    • setPersistentData()
JAVA

API Reference

Reference guide for classes methods provided by Tealium for Java.

Class: Tealium

The following summarizes the commonly used methods of the Java Tealium class.

Method Description
addPersistentData() Use the DataManager to make data available across multiple app sessions
deletePersistentData() Use the DataManager to delete previously persisted data by providing a list of keys to delete
getDataManager() Get the DataManager object which processes call time data and handles persistent data
getPersistentData() Use the DataManager to retrieve data that has been persisted
getSessionId() Use the DataManager to fetch the current session ID
resetSessionId() Use the DataManager to reset the session ID
track() Track events

addPersistentData()

Use the DataManager to make data available across multiple app sessions.

addPersistentData(data)
Parameters Type Description Example
data Map<String, Object> Required map data to add to the existing persistent Udo ["key":"value"]
Udo data = new Udo();
data.put("KEY", "VALUE");
tealium.getDataManager().addPersistentData(data);

deletePersistentData()

Use the DataManager to delete previously persisted data by providing a list of keys to delete.

deletePersistentData(list)
Parameters Type Description Example
list List<String> List of keys as Strings ["key1", "key2"]
List<String> list = new List<>();
list.append("key_to_delete");
tealium.getDataManager().deletePersistentData(list);

getDataManager()

Get the DataManager object which processes call time data and handles persistent data.

getDataManager()
Return Type Description
DataManager Instance of the Tealium DataManager object
DataManager dm = tealium.getDataManager()

getPersistentData()

Use the DataManager to retrieve data that has been persisted.

getPersistentData()
Return Type Description Example
Udo Universal Data Object (UDO) of persistent data ["key1", "key2"]
Udo persistentData = tealium.getDataManager().getPersistentData()

getSessionId()

Use the DataManager to fetch the current session ID. A session ID is created on initialization of the Tealium object.

getSessionId()
Return Type Description Example
String Representation of a timestamp in milliseconds "1473371215123"
tealium.getDataManager().getSessionId() 

resetSessionId()

Use the DataManager to reset the session ID. Used when you need to start a new session other than at app start time.

resetSessionId()
Return Type Description Example
String New String representation of a timestamp in milliseconds that is added to all dispatches for the remainder of the current session. The returned String is for monitoring convenience as it is automatically added to the volatile data store when this method is called. "1473371215123"
tealium.getDataManager().resetSessionId()

track()

Track events.

track(eventTitle)

Track events with optional parameters for data and a callback.

track(eventTitle, data, callback)
Parameter Type Description Example
eventTitle String Title of event (becomes the tealium_event and event_name event attribute values) "Some Event"
data Udo (Optional) Universal Data Object (UDO) with event data as key-value pairs udoObject
callback DispatchCallback (Optional) Object with a function assigned to the “callback” key dispatchCallbackObject

Class: Tealium.Builder

The following summarizes the commonly used methods of the Java Tealium.Builder class.

Method Description
build() Executes the build, and sets the persistent data and collect dispatcher
Builder() Constructor to instantiate a Tealium object
setDatasource() Data source key
setEnvironment() Sets the Tealium environment name
setPersistentData() Sets the persistent data

build()

Executes the build. Sets the persistent data if it hasn’t been explicitly set with the setPersistentData() method. Sets the collect dispatcher if it hasn’t been explicitly set with the setCollectDispatcher() method.

tealium.build();

Builder()

Constructor to instantiate a Tealium object.

Tealium.Builder(account, profile, environment).build()
// Init Tealium
Tealium tealium = new Tealium.Builder(account, profile)
    .setEnvironment(environment)
    .setDatasource(datasource)
    .build();
Parameters Type Description Example
account String Tealium account name "companyXYZ"
profile String Tealium profile name "main"
environment String Tealium environment name ["dev", "qa", "prod"]
datasource String (Optional) data source key (Set to null if none) "abc123"

setDatasource()

Sets the data source key. Set to null if none.

tealium.setEnvironment(datasource);
Parameters Type Description Example
datasource String Data source key (Set to null if none) "abc123"

setEnvironment()

Sets the Tealium environment name

tealium.setEnvironment(environment);
Parameters Type Description Example
environment String Tealium environment name ["dev", "qa", "prod"]

setPersistentData()

Sets the persistent data.

tealium.setPersistentData(persistentData);
Parameters Type Description Example
persistentData PersistentUdo Persistent Udo data object persistentUdoObj
Track
Release Notes

 
  • 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
      • Ad Identifier Module
      • Collect Module
      • Collectors Module
      • Crash Reporter Module
      • Install Referrer Module
      • Lifecycle Tracking Module
      • Location Manager Module
      • RemoteCommands 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
    • 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
  • NativeScript
    • Overview
    • Install
    • Track
    • API Reference
      • Tealium
      • TealiumConfig
    • Release Notes
  • React Native 1.x
    • Overview
    • Install
    • Track
    • API Reference
    • Release Notes
  • React Native 2.x
    • 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
  • Getting Started
    • Overview
    • Quick Start Guide
    • Web Concepts
  • Adobe Launch
    • Overview
    • Install
    • Data Layer
  • AMP
    • Install
    • Track
    • Data Layer
    • Overview
  • Angular
    • Install
    • Track
    • API Reference
    • Overview
  • Google Tag Manager
    • Overview
    • Data Layer
    • Install
  • JavaScript (Web)
    • Install
    • Track
    • Data Layer
    • Overview
    • 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: January 23, 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
  • NativeScript
  • React Native 1.x
  • React Native 2.x
  • Unity
  • Xamarin
  • Web
  • Getting Started
  • Adobe Launch
  • AMP
  • Angular
  • Google Tag Manager
  • JavaScript (Web)
  • Server
  • C#
  • HTTP API
  • Java
  • Node
  • Python
  • Roku
  • Ruby