Install

Install the Tealium plugin in your Unity application.

Tealium for Unity provides the Tealium native mobile libraries, for iOS and Android, in your Unity application.

This is the current version (2.x) of Tealium for Unity. For the previous version, see Tealium for Unity 1.x.

Requirements

Sample app

Explore the iOS or Android sample apps to familiarize yourself with the Tealium library, tracking methods, and best practice implementation.

For the iOS app, open the Examples/TealiumUnity-iOS/Unity-iPhone.xcodeproj file in XCode. For the Android app, open the Examples/TealiumUnity-Android/TealiumUnity-Android.apk file in Android Studio

Alternatively, drag the contents of Assets/Scenes and Assets/Scripts into your project, then import Tealium.unitypackage.

Install

Tealium only supports Android and iOS platforms within Unity.

Package Import

The recommended installation method is to use the TealiumUnityPlugin as a .unitypackage.

  1. Visit the GitHub releases page and download Tealium.unitypackage from the latest release.
  2. Create a new Unity project or open an existing project.
  3. Import the Tealium.unitypackage to your project by selecting Assets > Import Package > Custom Package.
  4. Add the following import statement to your project:
    using TealiumCommon;
    

Manual

To manually install Tealium for Unity, for iOS or Android, into your Unity application:

  1. Clone the GitHub repo.
  2. Copy the Assets/Plugins and Assets/Tealium folders into your project.
  3. Add the following import statement to your project:
    using TealiumCommon;
    

iOS

After you build and run your project for the first time, manually link the Tealium frameworks within XCode:

  1. Click on the Unity-iPhone project.
  2. Click on the Build Phases tab.
  3. Expand the Embedded Frameworks section.
  4. Copy all the frameworks located in the Frameworks/Plugins/iOS folder into the Embedded Frameworks section.

TealiumUnityPlugin has a dependency on the Unity plugin JSON.net to serialize and deserialize objects. If JSON.net is already included in your project, you may need to remove it in order to avoid conflicts.

Initialize

Initialize the Tealium instance with the Initialize() method, as shown in the following example:

private TealiumConfig config = new TealiumConfig("tealiummobile",
                     "demo",
                     TealiumEnvironment.DEV,
                     new List<Dispatchers> {
                        Dispatchers.TagManagement,
                        Dispatchers.Collect,
                        Dispatchers.RemoteCommands },
                     new List<Collectors> {
                        Collectors.AppData,
                        Collectors.DeviceData,
                        Collectors.Lifecycle,
                        Collectors.Connectivity },
                     logLevel: LogLevel.Dev,
                     batchingEnabled: false,
                     visitorServiceEnabled: true);

TealiumUnityPlugin.Initialize(config);

Was this page helpful?

This page was last updated: January 7, 2023