tvOS
Learn to install Tealium for tvOS.
tvOS is no longer supported. The Tealium iOS (Swift) library is recommended.
Requirements
- Tealium Customer Data Hub account
- Xcode 7+
- tvOS 9.0+
- 100KB available space in
.ipa
file size - Bitcode compliant framework
Sample Apps
To help familiarize yourself with the Tealium library, tracking methods, and best practice implementation, it is recommended to download the tvOS sample apps.
To abstract the Tealium implementation from the rest of your app, we recommend the use of the sample helper 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 header/method file.
Install
Install and manage Tealium dependencies for tvOS with CocoaPods.
-
Add the following dependency to your Podfile:
pod 'TealiumTVOS'
-
Download and install Tealium for tvOS.
We recommend cloning the library (instead of downloading) to make it easier to update to future releases.
-
Add
TealiumTVOS.framework
to your project’s tvOS Extension target, and copy the framework to the project in the resulting dialog box. -
In the target’s General: Embedded Binaries section, add the framework:
TealiumTVOS.framework
Initialize
In the Application Delegate, or within a helper class setup method, invoke a Tealium instance with the following code:
let config = TEALConfiguration.init(account: "ACCOUNT",
profile: "PROFILE",
environment: "ENV",
datasource: "DATASOURCE")
guard let tealium = Tealium.newInstanceForKey("uniqueInstanceKey", configuration: config) else {
// Any additional failure response here
return
}
TEALConfiguration *configuration = [TEALConfiguration
configurationWithAccount:@"ACCOUNT"
profile:@"PROFILE"
environment:@"ENV",
datasource:@"DATASOURCE"];
Tealium *tealiumInstance1 = [Tealium newInstanceForKey:@"INSTANCE" configuration:configuration];
Parameter | Description | Example |
---|---|---|
account |
Tealium account name | "companyXYZ" |
profile |
Tealium profile name | "main" |
environment |
Tealium environment name | ["dev" , "qa" , "prod" ] |
datasource |
(Optional) data source key | "abc123" |
instance |
Unique Tealium instance identifier (multiple instances are supported) | "tealium_main" |
Track Views
Track screen views by calling trackViewWithTitle()
with two parameters: the name of the screen and (optionally) contextual view data.
In any UIViewController’s viewDidAppear()
method:
Tealium.instanceForKey("uniqueInstanceKey")?.trackViewWithTitle(NSStringFromClass(self.classForCoder), dataSources: [:])
[[Tealium instanceForKey:@"INSTANCE"] trackViewWithTitle:NSStringFromClass([self class]) dataSources:nil];
The screen name is populated in the event data as screen_title
.
Track Events
Track non-view events by calling trackEventWithTitle()
with two parameters: an event name and (optionally) contextual event data.
Tealium.instanceForKey("INSTANCE")?.trackEventWithTitle("EVENT_NAME", dataSources: [:])
[[Tealium instanceForKey:@"INSTANCE"] trackEventWithTitle:@"EVENT_NAME" dataSources:nil];
The event name is populated in the event data as tealium_event
.
API Reference
See the TealiumTVOS Reference API for a complete list of classes and methods.
This page was last updated: January 7, 2023