API Definition

API Definition

by on ‎03-22-2018 08:41 AM (197 Views)

Parameters for JavaScript methods are given in the order the plugin expects them, e.g. for function somefunction(a,b,c){}, the parameters a,b,c will be listed top to bottom in the following tables.

Method: init

This function initializes the Tealium Cordova plugin

Parameter Data Type Description/Usage
config JavaScript Object* See separate table
successCallback Function Overrides the default Success Callback to allow custom success handling
errorCallback Function Overrides the default Success Callback to allow custom success handling

*The config object

Parameter Data Type Description/Usage Example Value
account String Tealium Account Name "tealium"
profile String Tealium Profile Name "main"
environment String Tealium Environment Name "dev"
instance String Arbitrary Tealium instance name "main"
dataSourceId String Optional alphanumeric data source ID generated in UDH "3obb8c"
isLifecycleEnabled String representation of Boolean (e.g. "false") Enables or disables automatic lifecycle tracking "false"
logLevel Integer (Enum) Sets the log level of the Cordova plugin (does not affect core SDK log level). Defaults to tealium.logLevels.DEV if not specified. tealium.logLevels.DEV (Info, Warnings, Errors)
tealium.logLevels.QA (Warnings, Errors)
tealium.logLevels.PROD (Errors Only)
tealium.logLevels.SILENT (No Logs)
collectDispatchURL String Overrides the default Tealium Collect dispatch URL "https://collect.tealiumiq.com/vdata/i.gif?tealium_account=tealium&tealium_profile=mobile"
collectDispatchProfile String Overrides the default Tealium Collect dispatch profile (default is always "main") "mobile"
isCrashReporterEnabled String If set, enables the crash reporter module (default disabled) "true"

Method: trackView

This function initiates a screen view tracking request to the Tealium Cordova plugin

Parameter Data Type Description/Usage Example Value
Data Object JavaScript/JSON object Populates the data layer for this tracking call with the key/value pairs specified {"screen_name": "Homescreen"}
instance String Arbitrary instance name constant, used to refer to a specific tracking instance. "main"

Method: trackEvent

This function initiates an event tracking request to the Tealium Cordova plugin

Parameter Data Type Description/Usage Example Value
Data Object JavaScript/JSON object Populates the data layer for this tracking call with the key/value pairs specified {"event_name": "Click to call"}
instance String Arbitrary instance name constant, used to refer to a specific tracking instance. "main"

track

This function initiates a tracking request to the Tealium Cordova plugin

Parameter Data Type Description/Usage Example Value
Event Type String Tealium event type "link" (event) or "view" (screen view)
Data Object JavaScript/JSON object Populates the data layer for this tracking call with the key/value pairs specified {"screen_name": "Homescreen"}
instance String Arbitrary instance name constant, used to refer to a specific tracking instance. "main"

Method: addPersistent

This function adds data to the Tealium persistent data store

Parameter Data Type Description/Usage Example Value
Key Name String Key name of value to be persisted "user_hashed_email"
Value String or Array of strings The value to be persisted for this key "293c2529495b45cbbc7b451df5720e8c"
instance String Arbitrary instance name constant, used to refer to a specific tracking instance. "main"

Method: addVolatile

This function adds data to the Tealium volatile data store

Parameter Data Type Description/Usage Example Value
Key Name String Key name of value to be stored in volatile memory "user_hashed_email"
Value String or Array of strings, Object/Dictionary The value to be stored in volatile memory for this key "293c2529495b45cbbc7b451df5720e8c"
instance String Arbitrary instance name constant, used to refer to a specific tracking instance. "main"

Method: removePersistent

This function removes data from the Tealium persistent data store

Parameter Data Type Description/Usage Example Value
Key Name String Key name of value to be removed from persistent storage "user_hashed_email"
instance String Arbitrary instance name constant, used to refer to a specific tracking instance. "main"

Method: removeVolatile

This function removes data from the Tealium volatile data store

Parameter Data Type Description/Usage Example Value
Key Name String Key name of value to be removed from volatile memory "user_hashed_email"
instance String Arbitrary instance name constant, used to refer to a specific tracking instance. "main"

Method: getPersistent

This function retrieves a value from the Tealium Persistent data store Returns: Persisted data with the same data type that was originally stored (String or Array of strings)

Parameter Data Type Description/Usage Example Value
Key Name String Key name of value to be retrieved from persistent storage "user_hashed_email"
instance String Arbitrary instance name constant, used to refer to a specific tracking instance. "main"

Method: getVolatile

This function retrieves a value from the Tealium Volatile data store Returns: Stored data with the same data type that was originally stored (String, Array of strings, or Object/Dictionary)

Parameter Data Type Description/Usage Example Value
Key Name String Key name of value to be retrieved from volatile storage "user_hashed_email"
instance String Arbitrary instance name constant, used to refer to a specific tracking instance. "main"

Method: addRemoteCommand

This function adds a remote command for later execution, initiated by Tealium iQ

Parameter Data Type Description/Usage Example Value
Remote Command ID String ID of the remote command. Matching id must be used in Tealium iQ to trigger the code block "changeBackgroundColor"
instance String Arbitrary instance name constant, used to refer to a specific tracking instance. "main"
Code block Function A function literal or reference, which will be available for later remote execution from Tealium iQ function (message) { //do something}

Method: getVistorId

This function returns the current Tealium visitor ID for the current user. It takes no parameters. Returns: String representation of the current visitor ID.