TealiumConfig
Class: TealiumConfig
The following summarizes the commonly used methods and properties of the iOS (Swift) TealiumConfig
class.
Method/Property | Description |
---|---|
addRemoteCommand() |
Adds remote commands for later execution |
appDelegateProxyEnabled |
Enables (default) or disables the Tealium AppDelegate proxy |
batchingBypassKeys |
Sets a list of event names for which batching is bypassed (sent as individual events) |
batchingEnabled |
Enables or disables (default) event batching |
batchSize |
Sets the amount of events to combine into a single batch request (max: 10) |
connectivityRefreshEnabled |
If enabled (default), the connectivity module checks for a connection at a specified interval |
connectivityRefreshInterval |
Sets the default connectivity refresh interval in seconds |
consentExpiry |
Sets the expiration time of the user consent selections |
consentLoggingEnabled |
Enables or disables the consent logging feature |
consentPolicy |
Sets the consent policy (defaults to GDPR). e.g. CCPA |
deepLinkTrackingEnabled |
Enables or disables automatic tracking of deep links |
desiredAccuracy |
The accuracy of the location data that your app wants to receive |
diskStorageDirectory |
Sets the directory to be used for disk storage. Default .caches . |
dispatchAfter |
Sets the number of events after which the queue is flushed |
dispatchExpiration |
Sets the batch expiration in days. If the device is offline for an extended period, older events are deleted |
dispatchQueueLimit |
Sets the maximum number of queued events. If this number is reached, and the queue has not been flushed, the oldest events are deleted. |
dispatchListeners |
Provides the option to add custom DispatchListener s to listen for tracking calls just prior to dispatch |
dispatchValidators |
Provides the option to add custom DispatchValidator s to control whether to dispatch, queue, or drop events events |
existingVisitorId |
Sets the existing visitor ID, used as the first party ID in the app extension |
geofenceFileName |
Sets the name of a local geofences JSON file asset. Do not include the file extension. |
geofenceTrackingEnabled |
Disables or enables geofence tracking |
geofenceUrl |
Sets the URL of a hosted JSON file |
hostedDataLayerExpiry |
Sets an expiration on the hosted data layer data |
hostedDataLayerKeys |
Sets the event mappings used by the hosted data layer module when looking up data layer IDs |
isCollectEnabled |
Provides an option to disable the Collect dispatcher |
lifecycleAutoTrackingEnabled |
Enables or disables lifecycle auto tracking. Default is true . If set to false and lifecycle launch/sleep/wake events are desired, they need to be manually called using the public methods in the LifecycleModule |
logger |
Sets a custom logger conforming to the TealiumLoggerProtocol that replaces the current TealiumLogger |
logLevel |
Sets the log level property, which controls how much information is logged |
logType |
Sets a new log type |
memoryReportingEnabled |
Enables or disables memory reporting in the DeviceData module |
minimumFreeDiskSpace |
Sets the minimum free disk space in Megabytes for Disk Storage to be enabled |
minutesBetweenRefresh |
Determines how often to fetch the publish settings from the CDN |
onConsentExpiration |
Callback to execute once consent selections expire |
overrideCollectProfile |
Overrides the Tealium Collect profile to send data to a different Tealium profile |
overrideCollectURL |
Overrides the Tealium Collect URL to send data to a different endpoint |
overrideCollectBatchURL |
Overrides the Tealium Collect Batch URL to send data to a different endpoint |
overrideCollectDomain |
Overrides the Tealium Collect domain name to send data to a different endpoint |
publishSettingsProfile |
Overrides the publish settings profile |
publishSettingsURL |
Overrides the publish settings URL |
remoteAPIEnabled |
Enables or disables remote_api event. Required for RemoteCommands module if DispatchQueue module in use. |
remoteCommands |
Returns an array of all currently-registered remote commands |
remoteHTTPCommandDisabled |
Disables the built-in remote HTTP command if true |
rootView |
Sets the current UIView for WKWebView to be attached to |
searchAdsEnabled |
Enables or disables the Apple Search Ads API in the Attribution module |
shouldAddCookieObserver |
Determines whether to add a WKWebView cookie observer |
shouldUseRemotePublishSettings |
Sets the Mobile Publish Settings (default: enabled) |
skAdAttributionEnabled |
Enables the use SKAdNetwork framework |
skAdConversionKeys |
Defines the event and value for which to call the SKAdNetwork.updateConversionValue() method |
tagManagementOverrideURL |
Overrides the default URL used by the Tag Management module |
TealiumConfig() |
Constructor for a TealiumConfig object |
timedEventTriggers |
A list of TimedEventTrigger objects for automatically tracking timed events |
updateDistance |
Sets the distance interval (meters) in which the location updates are received |
useHighAccuracy |
Sets the location precision to low accuracy (default) or high accuracy |
addRemoteCommand()
Adds remote commands for later execution.
addRemoteCommand(command)
Parameter | Type | Description |
---|---|---|
command |
RemoteCommand |
Instance of a TealiumRemoteCommand to be added |
The following example, placed prior to Tealium initialization, shows how add remote commands:
#if os(iOS)
let remoteCommand = RemoteCommand(commandId: "test",
description: "test") { response in
print("Remote Command 'test' executed")
}
config.addRemoteCommand(remoteCommand)
#endif
appDelegateProxyEnabled
Enables the AppDelegate proxy to automatically deep link tracking and initiate a Tealium trace session from a deep link. The property is enabled and set true
by default. To disable, set property to false
.
config.appDelegateProxyEnabled = false
batchingBypassKeys
Sets a list of event names for which batching is bypassed (sent as individual events).
config.batchingBypassKeys = ["home_screen"]
batchingEnabled
Enables or disables event batching. Disabled by default.
config.batchingEnabled = true
batchSize
Sets the amount of events to combine into a single batch request. Maximum is 10.
config.batchSize = 8
collectors
Sets the list of Collectors
to initialize the Tealium library with.
config.collectors = [Collectors.AppData]
connectivityRefreshEnabled
If enabled (default), the connectivity module checks for a connection at a specified interval (controlled via setConnectivityRefreshInterval
). Queued dispatches are then sent as soon as a connection is resumed.
config.connectivityRefreshEnabled = true
connectivityRefreshInterval
Sets the default connectivity refresh interval in seconds. Default is 30 seconds if not set on the TealiumConfig instance.
config.connectivityRefreshInterval = 30
consentExpiry
Sets the expiration time of the user consent selections. Set this property when initializing Tealium. The default expiration times for consent selections are:
- CCPA: 395 days
- GDPR: 365 days
The following sets the consent expiry to 90 days.
config.consentExpiry = (90, .days)
consentLoggingEnabled
Enables the Consent Logging feature, which sends all consent status changes to Tealium Customer Data Hub for auditing purposes.
config.consentLoggingEnabled = true
consentPolicy
Sets the consent policy (defaults to GDPR). e.g. CCPA. Consent Manager is only enabled if this property is set.
config.consentPolicy = .ccpa
deepLinkTrackingEnabled
Enables or disables automatic tracking of standard deep links, such as links to the app from Facebook or other sources, as well as QR trace. Enabled by default.
config.deepLinkTrackingEnabled = true
desiredAccuracy
The accuracy of the location data that your app wants to receive.
config.desiredAccuracy = .best
The available desiredAccuracy
options are:
desiredAccuracy option |
Description |
---|---|
.bestForNavigation |
Level of accuracy intended for use in navigation apps that require precise position information at all times |
.best |
Very high accuracy but don’t need the same level of accuracy required for navigation apps |
.nearestTenMeters |
Accuracy to the nearest 10 meters |
.nearestHundredMeters |
Accuracy to the nearest 100 meters |
.reduced |
Accuracy within 1-20 kilometers |
.withinOneKilometer |
Accuracy to the nearest 1 kilometer |
.withinThreeKilometers |
Accuracy to the nearest 3 kilometers |
Learn more about Apple’s desired accuracy constants.
diskStorageDirectory
Sets the directory to be used for disk storage. Default .caches
.
config.diskStorageDirectory = .documents
dispatchListeners
Provides the option to add custom DispatchListener
s to listen for tracking calls just prior to dispatch.
config.dispatchListeners = [self]
dispatchValidators
Provides the option to add custom DispatchValidator
s to control whether to dispatch, queue or drop events.
config.dispatchValidators = [self]
dispatchAfter
Number of events after which to automatically flush the queue.
config.dispatchAfter = 20
dispatchExpiration
Sets the dispatch expiration in days. If the device is offline for an extended period. Older events are deleted.
config.dispatchExpiration = 5
dispatchQueueLimit
Sets the maximum number of events to store in the event queue. If this number is reached, and the queue has not been flushed, the oldest events are deleted.
config.dispatchQueueLimit = 50
existingVisitorId
Sets the existing visitor ID, used as the first party ID in the app extension |
config.existingVisitorId = id
geofenceFileName
Sets the name of a local geofences file asset. Do not include the file extension.
config.geofenceFileName = <String>
Type | Description | Example |
---|---|---|
String |
The JSON file name | geofences.jsom |
geofenceTrackingEnabled
Disables or enables geofence tracking.
config.geofenceTrackingEnabled = false
Type | Description | Example |
---|---|---|
String |
The JSON file name | geofences.json |
geofenceUrl
Sets the URL of a hosted geofences file.
config.geofenceUrl = <String (url)>
Type | Description | Example |
---|---|---|
String |
The URL of a geofences file | https://example.com/.../geofences.json |
hostedDataLayerExpiry
Sets an expiration on the hosted data layer data. If this property isn’t set, hosted data layer items persist for 7 days by default, and are re-downloaded from the CDN once this period has expired.
config.hostedDataLayerExpiry = (1, unit: .minutes)
Setting a shorter expiration time reduces mobile device battery life due to increased network requests.
hostedDataLayerKeys
Sets the hosted data layer keys (lookup variables) used by the hosted data layer module when retrieving data layer IDs.
config.hostedDataLayerKeys = ["product_view" : "product_id"]
isCollectEnabled
Provides option to disable the collect dispatcher. Mainly intended for use by remote publish settings.
config.isCollectEnabled = false
lifecycleAutoTrackingEnabled
Enables or disables lifecycle auto tracking. Default is true
. If set to false
and lifecycle launch/sleep/wake events are desired, they need to be manually called using the public methods in the LifecycleModule
.
config.lifecycleTrackingEnabled = false
logger
Sets a custom logger conforming to the TealiumLoggerProtocol
that replaces the current TealiumLogger
.
The following example shows how to set your custom logger on the config object:
class CustomLogger: TealiumLoggerProtocol {
// ... conforming to the TealiumLoggerProtocol
// plus your own custom methods
}
class TealiumHelper {
let config = TealiumConfig(...)
var tealium: Tealium?
let customLogger = CustomLogger()
// ...
private init() {
config.logger = customLogger
// ...
tealium = Tealium(config: config)
}
}
logLevel
Sets the log level property, which controls how much information is logged, to one of the following values:
Log Level | Log Activity Description |
---|---|
.debug |
Debug-level events used for debugging an application (recommended for development environment) |
.info |
Informational events that highlight the progress of the application |
.error |
Error events such as critical errors and failures |
.fault |
Fault or severe events such as system-level or multi-process errors |
.silent |
No logging |
config.logLevel = .debug
View your development logs in the Xcode console or the Mac Console app. View your production logs with the Console app by connecting your iOS device.
logType
Sets a new logger type. The default is .os
or OSLog
The following example shows how to set the log level to print
:
config.logType = .print
memoryReportingEnabled
Enables or disables memory reporting in the DeviceData module (default: disabled).
config.memoryReportingEnabled = true
minimumFreeDiskSpace
Sets the minimum free disk space in Megabytes for Disk Storage to be enabled
config.minimumFreeDiskSpace = 25
minutesBetweenRefresh
Determines how often to fetch the publish settings from the CDN
config.minutesBetweenRefresh = 15
onConsentExpiration
Callback to execute once consent selections expire.
config.onConsentExpiration = {
// display consent modal
}
overrideCollectProfile
Overrides the Tealium Collect profile to send data to a different Tealium profile.
config.overrideCollectProfile = "main"
overrideCollectURL
Overrides the Tealium Collect URL to send data to a different endpoint. If using the event batching feature, also override the overrideCollectBatchURL property.
config.overrideCollectURL = url
Property value | Type | Description |
---|---|---|
url |
String |
The URL to override |
The default URL is:
https://collect.tealiumiq.com/event/
The property is used to set a custom hostname or to set a specific region hostname. The following example sets the Tealium Collect base URL to stay within the EU Central region:
let url = "https://collect-eu-central-1.tealiumiq.com/event/"
config.overrideCollectURL = url
overrideCollectBatchURL
Overrides the Tealium Collect batch URL to send data to a different endpoint.
config.overrideCollectBatchURL = url
Property value | Type | Description |
---|---|---|
url |
String |
The URL to override |
The default URL with event batching is:
https://collect.tealiumiq.com/bulk-event/
The method is typically used to set a custom hostname, or to set a specific region hostname. The following example sets the Tealium Collect base URL to stay within the EU Central region:
let url = "https://collect-eu-central-1.tealiumiq.com/bulk-event/"
config.overrideCollectBatchURL = url
overrideCollectDomain
Overrides the default Collect domain. Set the value to a hostname with the protocol excluded, such as my-company.com
. Use this property for both batch and single event dispatches. If overrideCollectURL
or overrideCollectBatchURL
is populated, this property takes precedence.
config.overrideCollectDomain = "my-company.com"
publishSettingsProfile
Overrides the publish settings profile.
config.publishSettingsProfile = "main"
publishSettingsURL
Overrides the publish settings URL.
config.publishSettingsURL = "https://www.example.com/custom/publish/settings.html"
remoteAPIEnabled
Enables or disables remote_api
event. Required for RemoteCommands module if DispatchQueue module in use. Default false
.
config.remoteAPIEnabled = true
remoteCommands
Returns an array of all currently-registered remote commands.
The following example shows how to get an array of all currently-registered remote commands:
let remoteCommands = config.remoteCommands
remoteHTTPCommandDisabled
Disables the built-in remote HTTP command (see Swift Module: RemoteCommands).
config.remoteHTTPCommandDisabled = true
rootView
Sets the current UIView
for WKWebView
to be attached to. Only required if you have a complex view hierarchy, such as with a push notification, where auto-detection may fail.
let view = self.view
config.rootView = view
searchAdsEnabled
Enables or disables the Apple Search Ads API in the Attribution module (default: disabled).
config.searchAdsEnabled = true
shouldAddCookieObserver
If set to true
(default), this method determines whether to add a WKWebView
cookie observer in order to successfully migrate all cookies. If set to false
, if multiple cookie observers are present then only one of them is called, which may cause some cookies to not migrate.
config.shouldAddCookieObserver = false
The shouldAddCookieObserver
property permits using your own cookie observer during cookie synchronization, which requires a cookie observer to retrieve cookies on the main thread after setting them. This issue is caused by bugs in WKWebView
, which prevents your own observer from being called.
shouldUseRemotePublishSettings
Sets the Mobile Publish Settings (version 1.9.0+) to enabled (default) or disabled.
config.shouldUseRemotePublishSettings = false
Mobile Publish Settings are enabled by default, and must be disabled if you don’t wish to use them. Configure the Mobile Publish Settings in iQ Tag Management, or disable the feature using config.shouldUseRemotePublishSettings = false
in the Swift installation. Failure to do causes initialization failures and prevents tracking.
skAdAttributionEnabled
Enables or disables the Apple SKAdNetwork API in the Attribution module (default: disabled).
config.skAdAttributionEnabled = true
skAdConversionKeys
Dictionary defining the event for which to call the SKAdNetwork.updateConversionValue()
method and the key to use as the conversion value.
config.skAdConversionKeys = ["purchase": "number_of_coins"]
In this case, the below event will equate to: SKAdNetwork.updateConversionValue(40)
tealium?.track("purchase", dataLayer: ["number_of_coins": 40])
tagManagementOverrideURL
Overrides the default URL used by the Tag Management module. This is needed if you are self-hosting your Tealium JavaScript files.
The following example shows how to override the default URL used by the Tag Management module.
let url = "https://tags.mycdn.com/utag/myaccount/myprofile/myenv/mobile.html"
config.tagManagementOverrideURL = url
TealiumConfig()
Constructor for a TealiumConfig
object. This object is required to initialize the library for your specific account.
TealiumConfig(account:String, profile:String, environment:String, optionalData:Dictionary, dataSource:String)
Parameter | Type | Description | Example |
---|---|---|---|
account |
String |
Tealium account name | companyXYZ |
profile |
String |
Tealium profile name | main |
environment |
String |
Tealium environment name | [dev , qa , prod ] |
datasource |
String |
(Optional) Tealium data source key from CDH | abc123 |
timedEventTriggers
A list of TimedEventTrigger
objects for automatically tracking timed events.
config.timedEventTriggers = [TimedEventTrigger(start: "START_EVENT",
stop: "STOP_EVENT",
name: "TIMED_EVENT_NAME")]
The following are TimedEventTrigger
parameters:
Parameter | Type | Description |
---|---|---|
start |
String |
Name of the TealiumEvent to start the timed event |
stop |
String |
Name of the TealiumEvent to stop the timed event |
name |
String? |
(Optional) Name of timed event (default: "START_EVENT::STOP_EVENT" ) |
updateDistance
Sets the distance interval (meters) in which location updates are received.
Only use this method if useHighAccuracy
is set to true
.
config.updateDistance = <Double>
Type | Description | Example |
---|---|---|
Double |
The distance interval (meters) in which location updates are received | 150.0 |
Usage example:
func start() {
let config = TealiumConfig(account: "ACCOUNT",
profile: "NAME",
environment: "ENVIRONMENT",
datasource: "DATASOURCE",
optionalData: nil)
// Tealium Location module config methods
config.useHighAccuracy = true
config.updateDistance = 150.0
}
useHighAccuracy
Sets the location precision to low accuracy (default) or high accuracy.
The property is disabled by default, which sets the location precision to low accuracy. If the location enabled device moves 500 meters or more, then this is considered a significant location changes causing a location update. Location updates typically take longer than five minutes with this setting.
Learn more about Apple’s significant-change location service.
If enabled, the property sets the location of data precision to the highest possible accuracy. The initial event is delivered as quickly as possible and then continues to determine the location and delivers additional events, as necessary, when that data is available.
Learn more about Apple’s accuracy of location data.
Using high accuracy results in greater battery consumption for your device than low accuracy, due to more frequent location updates.
config.useHighAccuracy = <Bool>
Type | Description | Example |
---|---|---|
Boolean |
Sets the location data accuracy | true |
Usage example:
func start() {
let config = TealiumConfig(account: "ACCOUNT",
profile: "NAME",
environment: "ENVIRONMENT",
datasource: "DATASOURCE",
optionalData: nil)
// Tealium Location module config methods
config.useHighAccuracy = true
config.updateDistance = 150.0
}