Tealium Class Reference
public class Tealium
The main class for the Tealium SDK.
This class provides the primary interface for interacting with the Tealium SDK. It handles initialization, tracking events, managing visitor IDs, and accessing various modules like data layer, deep linking, and tracing.
-
Creates a new Tealium instance with the provided configuration.
Declaration
Swift
public static func create(config: TealiumConfig, completion: ((InitializationResult<Tealium>) -> Void)? = nil) -> TealiumParameter Description configThe configuration for the Tealium instance.
completionA closure that is called when initialization completes, providing either the Tealium instance or an error.
Return Value
A new Tealium instance.
-
Executes the provided completion handler when
Tealiumis ready for use, from theTealiuminternal thread.Usage of this method is incentivised in case you want to call multiple
Tealiummethods in a row. Every one of those methods, if called from a different thread, will cause the execution to move into our own internal queue, causing overhead. Calling those methods from the completion of this method, instead, will skip all of those context switches and perform the operations synchronously onto our thread.Declaration
Swift
public func onReady(_ completion: @escaping (Tealium) -> Void)Parameter Description completionA closure that is called with the
Tealiuminstance when it’s ready. In case of an initialization error the completion won’t be called at all. -
Tracks an event with the specified name, type, and data.
Declaration
Swift
@discardableResult public func track(_ name: String, type: DispatchType = .event, data: DataObject? = nil) -> SingleResult<TrackResult, TealiumError>Parameter Description nameThe name of the event to track.
typeThe type of dispatch to use (default is .event).
dataAdditional data to include with the event (optional).
Return Value
A
Singleonto which you can subscribe to receive the completion with the eventual error or theTrackResultfor this track request. -
Flushes any queued events from the system when it is considered safe to do so by any
Barriers that may be blocking, i.e. when theirisFlushablereturnstrue.Attention
This method will not override those
Barrierimplementations whoseisFlushablereturnsfalse. But when non-flushable barriers open, a flush will still occur.Declaration
Swift
@discardableResult public func flushEventQueue() -> SingleResult<Void, TealiumError> -
Resets the current visitor ID to a new anonymous one.
Note. the new anonymous ID will be associated to any identity currently set.
Declaration
Swift
@discardableResult public func resetVisitorId() -> SingleResult<String, TealiumError>Return Value
A
Singleonto which you can subscribe to receive the completion with the eventual error or the new visitor ID. -
Removes all stored visitor identifiers as hashed identities, and generates a new anonymous visitor ID.
Declaration
Swift
@discardableResult public func clearStoredVisitorIds() -> SingleResult<String, TealiumError>Return Value
A
Singleonto which you can subscribe to receive the completion with the eventual error or the new visitor ID. -
Manager for trace-related functionality.
Declaration
Swift
public private(set) lazy var trace: Trace { get set } -
Manager for deep link functionality.
Declaration
Swift
public private(set) lazy var deepLink: DeepLinkHandler { get set } -
Interface for accessing and manipulating the data layer.
Declaration
Swift
public private(set) lazy var dataLayer: DataLayer { get set } -
Creates a
ModuleProxyfor the given module to allow for an easy creation of Module Wrappers.This method should only be used when creating a
Modulewrapper. Use the already prebuilt wrappers for modules included in the SDK.Declaration
Swift
public func createModuleProxy<T, E>(for module: T.Type = T.self) -> ModuleProxy<T, E> where T : Module, E : ErrorParameter Description moduleThe
Moduletype that the Proxy needs to wrap.Return Value
The
ModuleProxyfor the given module. -
lifecycle()From TealiumPrismLifecycle -
momentsAPI()From TealiumPrismMomentsAPIProvides access to the Moments API module functionality.
Declaration
Swift
func momentsAPI() -> MomentsAPIReturn Value
The Moments API module instance