Need help upgrading to Ionic Framework 4.0? Get assistance with our Enterprise Migration Services EXPLORE NOW

Tealium

Improve this doc

This plugin provides a TypeScript wrapper around the Tealium Cordova plugin for Ionic Native.

For full documentation, see https://community.tealiumiq.com/t5/Mobile-Libraries/Tealium-for-Cordova/ta-p/17618

Repo: https://github.com/Tealium/cordova-plugin

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ''
    $ npm install --save @ionic-native/tealium@4
    
  2. Add this plugin to your app's module

Supported platforms

Usage

import { Tealium, TealConfig } from '@ionic-native/tealium';


constructor(private tealium: Tealium) { }

...

let tealConfig: TealConfig = {
 account: "<your-account>",
 profile: "<your-profile>",
 environment: "<your-environment>", // usually "dev", "qa" or "prod"
 isLifecycleEnabled: "true", // pass "false" to disable lifecycle tracking
 isCrashReporterEnabled: "false", // pass "true" to enable crash reporter (Android only)
 instance: "<your-instance-name" // an arbitrary instance name. use the same instance name for all subsequent API calls
}

this.tealium.init(tealConfig).then(()=>{
  this.tealium.trackView({"screen_name": "homescreen"});
});

Instance Members

init(config)

This function initializes the Tealium Cordova plugin. This should usually be done inside the “deviceReady” handler.

Param Type Details
config TealConfig

Returns: Promise<any> Returns a promise that resolves when something happens

trackView(dataObject, instanceName)

This function tracks a view event in the Tealium Cordova plugin

Param Type Details
dataObject any

The JSON data object containing your key-value pairs

instanceName string

Your arbitrary Tealium instance name provided at init time

Returns: Promise<any> Returns a promise that resolves when something happens

trackEvent(dataObject, instanceName)

This function tracks a link event in the Tealium Cordova plugin

Param Type Details
dataObject any

The JSON data object containing your key-value pairs

instanceName string

Your arbitrary Tealium instance name provided at init time

Returns: Promise<any> Returns a promise that resolves when something happens

track(eventType, dataObject, instanceName)

This function tracks a custom event in the Tealium Cordova plugin

Param Type Details
eventType string

The event type, link or view

dataObject any

The JSON data object containing your key-value pairs

instanceName string

Your arbitrary Tealium instance name provided at init time

Returns: Promise<any> Returns a promise that resolves when something happens

addPersistent(keyName, value, instanceName)

This function adds data to the Tealium persistent data store

Param Type Details
keyName string

The key name that this data will be stored under for later retrieval

value any

The value to be stored as persistent data

instanceName string

Your arbitrary Tealium instance name provided at init time

Returns: Promise<any> Returns a promise that resolves when something happens

addVolatile(keyName, value, instanceName)

This function adds data to the Tealium volatile data store

Param Type Details
keyName string

The key name that this data will be stored under for later retrieval

value any

The value to be stored as volatile data

instanceName string

Your arbitrary Tealium instance name provided at init time

Returns: Promise<any> Returns a promise that resolves when something happens

removeVolatile(keyName, instanceName)

This function removes data from the Tealium volatile data store

Param Type Details
keyName string

The key name that this data will removed from the Tealium data store

instanceName string

Your arbitrary Tealium instance name provided at init time

Returns: Promise<any> Returns a promise that resolves when something happens

removePersistent(keyName, instanceName)

This function removes data from the Tealium persistent data store

Param Type Details
keyName string

The key name that this data will removed from the Tealium data store

instanceName string

Your arbitrary Tealium instance name provided at init time

Returns: Promise<any> Returns a promise that resolves when something happens

getPersistent(keyName, instanceName, callback)

This function retrieves a value from the Tealium Persistent data store

Param Type Details
keyName string

The key name that this data will retrieved from the Tealium data store

instanceName string

Your arbitrary Tealium instance name provided at init time

callback any

A callback function that will be called when the data has been retrieved

Returns: Promise<any> Returns a promise that resolves when something happens

getVolatile(keyName, instanceName, callback)

This function retrieves a value from the Tealium Volatile data store

Param Type Details
keyName string

The key name that this data will retrieved from the Tealium data store

instanceName string

Your arbitrary Tealium instance name provided at init time

callback any

A callback function that will be called when the data has been retrieved

Returns: Promise<any> Returns a promise that resolves when something happens

addRemoteCommand(commandName, instanceName, callback)

This function adds a remote command for later execution

Param Type Details
commandName string

The command name for this Remote Command

instanceName string

Your arbitrary Tealium instance name provided at init time

callback any

A callback function that will be called when the data has been retrieved

Returns: Promise<any> Returns a promise that resolves when something happens

getVisitorId()

This function retrieves the Tealium Visitor ID

Returns: Promise<any> Returns a promise that resolves when something happens

TealConfig

Param Type Details
account string

Your Tealium account name

profile string

Your Tealium profile name

environment string

Your Tealium environment name (dev, qa, prod)

instance string

Arbitrary instance name string. Must be consistent for all calls to Tealium API.

isLifecycleEnabled string

Enables ("true") or disables ("false") lifecycle reporting. Default true if omitted.

(optional)
collectDispatchURL string

Not usually required. Sets a custom URL override for dispatches to UDH.

(optional)
collectDispatchProfile string

Your Tealium UDH profile. Only active if you do not have collectDispatchURL set.

(optional)
isCrashReporterEnabled string

Enables ("true") or disables ("false") Crash Reporter module for Android. Default false if omitted.

(optional)

API

Native

General