Install
Requirements
- Xcode 7.0+
- iOS 8.1+
- Tealium iQ Mobile Profile
- Tealium Customer Data Hub account
Samples Apps
To help familiarize yourself with the Tealium library, tracking methods, and best practice implementation, explore the Tealium for iOS sample apps.
To abstract the Tealium implementation from the rest of your app, we recommend the use of a TealiumHelper
class. This gives you a single entry point from which to initialize and make tracking calls. It also allows you to update the code in your helper file, and not in every single ViewController
or header/method file.
See the TealiumIOS API for a complete listing of Tealium classes and methods for iOS.
Install
Install the Tealium SDK for iOS (Objective-C) with CocoaPods, Carthage, or manually.
CocoaPods
To install Tealium for iOS (Objective-C) for your app with CocoaPods (recommended):
Add the following dependency to your Podfile:
pod "TealiumIOS"
Save the file and run the following in your project directory:
pod install
Use the created
.xcworkspace
file to continue building your app. If you do not use the.xcworkspace
file, you are not able to build the app correctly.
Carthage
To install Tealium for iOS (Objective-C) for your app with Carthage:
Add the following to your Cartfile:
binary "https://tags.tiqcdn.com/dle/tealiummobile/tealium-ios-carthage/tealium-carthage.json"
To download and extract the frameworks, run the following command:
carthage update --platform ios
For the required frameworks to be copied automatically at build-time, verify sure that Carthage is properly integrated into your Xcode project.
Strip simulator support, as necessary, before submitting to the App Store. This step is avoidable if using the “DeviceOnly” builds provided on the GitHub repo, which are also downloaded when using Carthage.
Manual
To install Tealium for iOS (Objective-C) for your app manually:
Add
TealiumIOS.framework
to your project.Copy framework to project in the resulting dialog box.
In the Target go to General > Embedded Binaries and add
TealiumIOS.framework
.For Swift projects go to the Build Settings > Swift Compiler > Objective-C Bridging Header option and include the file
TealiumIOSBridgingHeader.h
.
Initialize
In the Application Delegate or within a helper class setup method use the following initialization code:
// set your account, profile, and environment
let tealConfig = TEALConfiguration.init(account: "ACCOUNT",
profile: "PROFILE",
environment: "ENVIRONMENT",
datasource: "DATASOURCE")
// Initialize with a unique key for this instance
guard let tealium = Tealium.newInstanceForKey("INSTANCE", configuration: tealConfig) else {
// Any additional failure response here
return
}
// import area
@import TealiumIOS;
// Set your account, profile, and environment
TEALConfiguration *tealConfig = [TEALConfiguration configurationWithAccount:@"ACCOUNT"
profile:@"PROFILE"
environment:@"ENVIRONMENT"
datasource:@"DATASOURCE"];
// Initialize with a unique key for this instance
Tealium *tealium = [Tealium newInstanceForKey:@"INSTANCE" configuration:tealConfig];
The log level is set by default from the publish settings from your iQ account. To override this setting set the logLevel
property in the TEALConfiguration instance:
// Set the log verbosity to errors only
tealConfig.logLevel = .prod
// Set the log verbosity to maximum
[tealConfig setLogLevel: TEALLogLevelDev];
The Tealium instance must be configured with the following parameters before it begins tracking:
Parameters | 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) data source key | "abc123" |
instance |
String |
Unique name for your instance (multiple instances are supported) | "tealium_main" |
Submit to the App Store
The mobile library contains slices that run in the simulator and on devices. Unfortunately, the simulator architecture is not allowed by Apple when submitting to the App Store.
When creating your archive be sure to run one of the following two scripts to strip out the simulator:
Or use the Devices Only Builds that do not contain simulator slices.