Module
A Module is the generic protocol that any plugin added to tealium must conform.
Each module, then, can conform to each of the following protocols as well to add extra functionality:
Collector: To enrich the collectedDispatches with extra data.Dispatcher: To send theDispatches and their data outside of this SDK, potentially the Tealium Platform or a 3rd party Vendor.Transformer: The underlying protocol for modules that implement Transformations — data modifications applied to dispatches before they reach dispatchers.
-
A module used by the Tealium SDK to provide some plugin functionality.
See moreDeclaration
Swift
public protocol Module : AnyObject -
A basic factory that can be reused to create modules that have no extra dependencies and can only be initialized once.
BasicModuleFactoryis a generic implementation ofModuleFactorythat simplifies the creation of modules conforming to theBasicModuleprotocol.For detailed guidance on creating custom modules, see Creating Custom Modules.
Important Notes
- The generic
Moduletype must conform toBasicModule - Modules created by this factory cannot be instantiated multiple times (
allowsMultipleInstancesis alwaysfalse) - Use
ModuleSettingsBuildersubclasses for type-safe configuration - Module type constants should be defined in
Modules.Typesfor consistency
Declaration
Swift
public class BasicModuleFactory<Module> : ModuleFactory where Module : BasicModule - The generic
-
Declaration
Swift
public enum ModuleError<SomeError> : ErrorEnum, ErrorWrapping where SomeError : Error -
A
ModuleProxyis to be used for proxying access to modules that are or were available to access from the mainTealiumimplementation.Any external
See moreModuleimplementation that provides functionality expected to be used by a developer should wrap their access toTealiumthrough aModuleProxy.Declaration
Swift
public class ModuleProxy<SpecificModule, Failure> where SpecificModule : Module, Failure : Error -
A base class that adds the enabled setter for SettingsBuilders that are Optional and therefore can be disabled.
See moreDeclaration
Swift
open class ModuleSettingsBuilder -
A class responsible for registering and returning the DataStore instances required by individual modules.
See moreDeclaration
Swift
public class ModuleStoreProvider -
Manages the lifecycle and configuration of modules within the Tealium SDK.
See moreDeclaration
Swift
public class ModulesManager -
A settings builder for a module that supports multiple instances.
See moreDeclaration
Swift
public protocol MultipleInstancesModuleSettingsBuilder -
CollectorSettingsBuilderFrom TealiumPrismCoreA builder for Collector Settings which adds the possibility to set
Rules.Declaration
Swift
open class CollectorSettingsBuilder : ModuleSettingsBuilder, RuleModuleSettingsBuilder -
Base class for command-based dispatchers that route dispatches through an internal command registry.
Provides a concrete implementation for
dispatch()that supports async commands with cancellation viaDisposable, calling completion once perDispatchas it finishes.Usage
See moreclass MyVendorDispatcher: CommandDispatcher { private let vendorInstance: VendorInterface init(context: TealiumContext, vendorInstance: VendorInterface) { self.vendorInstance = vendorInstance super.init( id: "MyVendor", version: "1.0.0", commands: [...], logCategory: "MyVendor", queue: context.queue, logger: context.logger ) } }Declaration
Swift
open class CommandDispatcher : Dispatcher -
A builder for Dispatcher Settings which adds the possibility to set
See moreRules andJSONOperation<MappingParameters>.Declaration
Swift
open class DispatcherSettingsBuilder<M> : ModuleSettingsBuilder, RuleModuleSettingsBuilder where M : Mappings -
Provides context and dependencies for modules within the Tealium SDK.
See moreDeclaration
Swift
public class TealiumContext -
Generic reusable base class for building vendor-specific mappings.
Subclasses
Mappingsand adds overloaded methods that accept type-safeCommandandDestinationenums instead of raw strings.Base
See moreMappingsmethods (acceptingStringandJSONObjectPath) remain available for cases not covered by the enums.Declaration
Swift
open class CommandMappingsBuilder< Command: CommandName, Destination: JSONObjectPathConvertible >: Mappings -
The
Mappingsbuilder is used to build up key/destination mappings used when optionally translating the fullDispatchpayload to just the relevant data for any givenDispatcher.Use the
mapFrommethod to supply the required source “key” and “destination” key, as well as any optional “path” entries required to access keys in nested object.Using the following payload
DataObjectas an example (shown as JSON){ "source" : "value", "path": { "to" : [{ "source": "nested value", }] } }Simple usage for keys in the top level
DataObjectwould look like so:mappings.mapFrom("source", to: "destination")More complex versions requiring accessing keys that exist in nested objects and arrays would look like so:
mappings.mapFrom(JSONPath["path"]["to"][0]["source"], to: JSONPath["path"]["to"]["destination"])Use the
keeputility method to create a mapping where the sourcekeyis the same as thedestination.Simple usage for keys in the top level
DataObjectwould look like so:mappings.keep("source")More complex versions requiring accessing keys that exist in nested objects would look like so:
mappings.keep(JSONPath["path"]["to"][0]["source"])The
mapFromandkeepmethods return aVariableOptionsthat allows for setting optional properties relevant to a mapping like aifValueEquals(:), to only perform the mapping if the value is equal to some specific string.Use the
mapConstantmethod to supply a constant “value” and “destination” key.mappings.mapConstant("value", to: "destination")More complex versions requiring accessing keys that exist in nested objects would look like so:
mappings.mapConstant(value, to: JSONPath["path"]["to"]["destination"])The
See moremapConstantmethod returns aConstantOptionsthat allows for setting optional properties relevant to a mapping like aifValueIn(:equals:), to only perform the mapping if a value at the givenkeyis equal to the giventarget.Declaration
Swift
open class Mappings -
MappingsBuilderFrom TealiumPrismCoreBase builder class for a single mapping operation. Use
Mappingsfactory methods to create instances.Declaration
Swift
public class MappingsBuilder
View on GitHub
Module Reference