Tealium Class Reference

Inherits from NSObject
Declared in Tealium.h

Overview

Tealium is the main class for the Tealium Library.

Currently implements a multiton pattern that permits multiple Tealium instances.

Internally the entire library runs inside its own serial queue so there is no need call Tealium methods from a background thread, it takes care of that on its own.

Core Methods

+ newInstanceForKey:configuration:

Starts an instance of the Tealium Mobile Library for a given key with the given configuration object.

+ (_Nonnull instancetype)newInstanceForKey:(NSString *_Nonnull)key configuration:(TEALConfiguration *_Nonnull)configuration

Parameters

key

NSString identifier for the library instance

configuration

TEALConfiguration instance with valid Account/Profile/Enviroment properties.

Declared In

Tealium.h

+ instanceForKey:

Returns an instance of the library for the given key, or NIL if such an instance has not been previously initialized.

+ (_Nullable instancetype)instanceForKey:(NSString *_Nonnull)key

Parameters

key

NSString identifier for the library instance.

Declared In

Tealium.h

+ destroyInstanceForKey:

Removes and nils out an instance of the library with the given key.

+ (void)destroyInstanceForKey:(NSString *_Nonnull)key

Parameters

key

NSString identifier for the library instance to remove.

Declared In

Tealium.h

– delegate

Optional delegate primarily for monitoring or manipulating dispatch data.

- (id<TealiumDelegate> _Nullable)delegate

Return Value

The current delegate of the library instance

Declared In

Tealium.h

– setDelegate:

Set the library delegate for overriding and or monitoring dispatch processes.

- (void)setDelegate:(id<TealiumDelegate> _Nullable)delegate

Parameters

delegate

Any object that implements one or more optional Tealium Delegate protocols.

Declared In

Tealium.h

– trackEventWithTitle:dataSources:

Sends an event to Collect. Event are packaged with any custom key/value data sources passed in along with the default datasources provided by the library.

- (void)trackEventWithTitle:(NSString *_Nonnull)title dataSources:(NSDictionary *_Nullable)customDataSources

Parameters

title

String title of event

customDataSources

Dictionary of custom datasources (key/value pairs) to be included in the event dispatch. If a value is an array, be sure to use an array of strings.

Declared In

Tealium.h

– trackViewWithTitle:dataSources:

Sends a view to Collect. Views are packaged with any custom key/value data sources passed in along with the default datasources provided by the library.

- (void)trackViewWithTitle:(NSString *_Nonnull)title dataSources:(NSDictionary *_Nullable)customDataSources

Parameters

title

String title of view

customDataSources

Dictionary of custom datasources (key/value pairs) to be included in the event dispatch. If a value is an array, be sure to use an array of strings.

Declared In

Tealium.h

– trackType:title:dataSources:completion:

Sends an event to Collect. Events are packaged with any custom key/value data sources passed in along with the default datasources provided by the library.

- (void)trackType:(TEALDispatchType)eventType title:(NSString *_Nonnull)title dataSources:(NSDictionary *_Nonnull)clientDataSources completion:(TEALDispatchBlock _Nullable)completion

Parameters

Eventtype

enum: (TEALDispatchTypeActivity, TEALDispatchTypeConversion,TEALDispatchTypeDerived, TEALDispatchTypeInteraction, TEALDispatchTypeView)

CustomDataSources

Dictionary of custom datasources (key/value pairs) to be included in the event dispatch. If a value is an array, be sure to use an array of strings.

Title

String title of view

completion:

Optional completion handler returns dispatch status

Declared In

Tealium.h

– volatileDataSourcesCopy

Copy of all non persistent, UI object and dispatch specific data sources captured by a Tealium library instance at time of call.

- (NSDictionary *_Nonnull)volatileDataSourcesCopy

Return Value

NSDictionary of Tealium Data Source keys and values at time of call.

Declared In

Tealium.h

– addVolatileDataSources:

Adds additional data to the temporary data sources dictionary. This command is added to the end of the current Tealium background queue for writing.

- (void)addVolatileDataSources:(NSDictionary *_Nonnull)additionalDataSources

Parameters

additionalDataSources

New or overwrite data sources to add to the volatile data sources store. These key values can only be superceded by the custom data sources added to track calls. If a value is an array, be sure to use an array of strings.

Declared In

Tealium.h

– removeVolatileDataSourcesForKeys:

Removes key-value pairs from the library instance’s volatile memory

- (void)removeVolatileDataSourcesForKeys:(NSArray *_Nonnull)dataSourceKeys

Parameters

dataSourceKeys

An NSArray of string keys to remove

Declared In

Tealium.h

– persistentDataSourcesCopy

Copy of all long term Tealium data source data written to and read from disk, specific to a given library instance.

- (NSDictionary *_Nonnull)persistentDataSourcesCopy

Return Value

NSDictionary of Tealium Data Source keys and values at time of call.

Declared In

Tealium.h

– addPersistentDataSources:

Adds key-value info into the library instance’s persistent data store. Use this to track lifetime values or seldom-changed global data sources.

- (void)addPersistentDataSources:(NSDictionary *_Nonnull)additionalDataSources

Parameters

additionalDataSources

An NSDictionary of string keys and values. If a value is an array, be sure to use an array of strings.

Declared In

Tealium.h

– removePersistentDataSourcesForKeys:

Removes all keys from array parameter.

- (void)removePersistentDataSourcesForKeys:(NSArray *_Nonnull)dataSourceKeys

Parameters

dataSourceKeys

An NSArray of strings of the target keys to remove from the persistence store.

Declared In

Tealium.h

– joinTraceWithToken:

Joins an AudienceStream trace if either the Collect or TagManagement service are enabled.

- (void)joinTraceWithToken:(NSString *_Nonnull)token

Parameters

token

String value should match the code provided via the AudienceStream web UI.

Declared In

Tealium.h

– leaveTrace

Stops sending trace data for the provided token in the joinTraceWithToken: method.

- (void)leaveTrace

Parameters

completion

An optional completion block.

Declared In

Tealium.h

Collect Methods

– profileURL

The visitor profile url associated with the current user.

- (NSURL *_Nullable)profileURL

Return Value

NSURL An optional NSURL object.

Declared In

Tealium+Collect.h

– profileDefinitionURL

Where Collect will retrieve profile definitions.

- (NSURL *_Nullable)profileDefinitionURL

Return Value

NSURL An optional NSURL object.

Declared In

Tealium+Collect.h

– visitorIDCopy

Copy of the Unique visitor ID per Account / Device combination.

- (NSString *_Nullable)visitorIDCopy

Return Value

String value of the visitorID for the Account the library was enabled with.

Declared In

Tealium+Collect.h

– cachedVisitorProfileCopy

Last retrieved profile instance. This is updated every time the profile is queried. Depending on the settings the library was enabled with, this could be after every sendEvent:customData: call or only on explicit request.

- (TEALVisitorProfile *_Nullable)cachedVisitorProfileCopy

Return Value

Returns valid TEALVisitorProfile object. Its properties might be nil of nothing is loaded into them yet.

Declared In

Tealium+Collect.h

– fetchVisitorProfileWithCompletion:

Retrieves the current visitor profile from AudienceStream.

- (void)fetchVisitorProfileWithCompletion:(void ( ^ _Nullable ) ( TEALVisitorProfile *_Nullable profile , NSError *_Nullable error ))completion

Parameters

completion

Completion block with retrieved TEALVisitorProfile instance and an error should any problems occur.

Declared In

Tealium+Collect.h

TagManagement Methods

– addRemoteCommandID:description:targetQueue:responseBlock:

Adds a remote command block that can be triggered by the instance’s TIQ templates.

- (void)addRemoteCommandID:(NSString *_Nonnull)commandID description:(NSString *_Nullable)description targetQueue:(dispatch_queue_t _Nonnull)queue responseBlock:(void ( ^ _Nonnull ) ( TEALRemoteCommandResponse *_Nonnull response ))responseBlock

Parameters

commandID

NSString that identifies this code block

description

Optional NSString description of the command block

queue

The dispatch queue to run the command on. Note, any UI commands must be done on the main thread.

responseBlock

An optional block that returns a TEALRemoteCommandResponse object whenever the command is executed.

Declared In

Tealium+TagManagement.h

– removeRemoteCommandID:

Removes a remote command block for the given commandID

- (void)removeRemoteCommandID:(NSString *_Nonnull)commandID

Parameters

commandID

NSString identifier for the command block to remove.

Declared In

Tealium+TagManagement.h

WatchKit Methods

+ instanceAvailableForMessage:

  • Check message from a watchKit extension sendMessage call to determine if any it specifies any content for Tealium processing, and if so, if a Tealium instance specified is available to process. *
  • @param message Origin NSDictionary message. *
  • @return Boolean indicating whether the Tealium instance specified in the message exists.
+ (BOOL)instanceAvailableForMessage:(NSDictionary<NSString*,id> *)message

Declared In

Tealium+WatchKit.h

– session:didReceiveMessage:

  • Called on the delegate of the receiver. Will be called on startup if the incoming message caused the receiver to launch. *
  • @param session WCSession responding.
  • @param message Message from Watch Extension.
- (void)session:(WCSession *)session didReceiveMessage:(NSDictionary<NSString*,id> *)message

Declared In

Tealium+WatchKit.h

– session:didReceiveMessage:replyHandler:

  • Called on the delegate of the receiver when the sender sends a message that expects a reply. Will be called on startup if the incoming message caused the receiver to launch. *
  • @param session WCSession responding.
  • @param message Message from Watch Extension.
  • @param replyHandler Block responding.
- (void)session:(WCSession *)session didReceiveMessage:(NSDictionary<NSString*,id> *)message replyHandler:(void ( ^ ) ( NSDictionary<NSString*,id> *replyMessage ))replyHandler

Declared In

Tealium+WatchKit.h