Swift Class: TealiumConfig

Swift Class: TealiumConfig

by Community Manager ‎02-01-2017 02:22 PM - edited ‎02-02-2017 03:48 PM (185 Views)

This guide specifies the syntax of the functions available in the TealiumConfig class of the Tealium for Swift library.

Table of Contents Placeholder

TealiumConfig()

Constructor for a TealiumConfig object. This object is required to initialize the library for your specific account.

var config = TealiumConfig(account: "your_account", profile: "your_profile", environment: "dev_qa_or_prod")
Parameters Type Description
account String Tealium account name
profile String Tealium profile name (usually "main")
environment String Tealium environment: "dev", "qa", or "prod"
log level Integer Log level: 0=None, 1=Errors, 2=Warnings, 3=All

 

setOptionalData()

Use to set or override config settings. Currently, this can be used to override the destination URL for tracking calls using the tealiumKey_overrideCollectURL key.

config.setOptionalData(key: tealiumKey_overrideCollectURL, value:"https://aleternate.destionation.url")
Parameters Type Description
key String The key of the data item to set
value String The value to set

getOptionalData()

Use to retrieve data that was previously set with setOptionalData().

// SAMPLE
if let value = config.getOptionalData(key: tealiumKey_overrideCollectURL) as? String {
print("Override url has been set to: \(value)")
}
Parameters Type Description
key
String The key of the data item to get