Unity Editor

Add Teak

You can use Unity Package Manager (See Unity Package Manager).

Or…​

Download the latest Teak.unitypackage from https://sdks.teakcdn.com/unity/Teak.unitypackage

Import it into your project in Unity using Assets  Import Package  Custom Package

Then select Teak.unitypackage

What This Does

Importing the Teak.unitypackage will add the Unity scripts needed to interact with Teak, the native libraries required for Teak functionality, and the other files that Teak needs to function.

Configure Teak

Open the Teak configuration in the Unity Inspector using Edit  Teak

Put in your Teak App Id and Teak API Key. Your Teak App Id and API Key can be found in the Settings for your app on the Teak dashboard.

Make sure the Inspector tab is visible in your Unity window.

What This Does

This stores the Teak App Id and API Key for use by Teak’s runtime, and helpers.

Tell Teak how to Identify The Current User

Call the IdentifyUser function and pass it a string which uniquely identifies the current user. This will also begin tracking and reporting of a session, and track a daily active user.

void IdentifyUser(string userIdentifier,
                  UserConfiguration userConfiguration);
Example
// ...
// As soon as you know the id for the current user.
UserConfiguration userConfiguration = new UserConfiguration {
    Email = "email@user.com"
};
Teak.Instance.IdentifyUser("user_123456", userConfiguration);
The userIdentifier value should be the same as you send to your back-end for a user id.

Opting Out of Tracking

If the user has opted out of data collection completely, do not call IdentifyUser, and Teak will not track the user at all.

If the user has opted out of specific data collection, set the corresponding opt-out to true in the user configuration.

What This Does

Identifying the user will allow Teak to start sending information to the remote Teak service and allow Teak to function.

Testing It

You can now run your game in the Unity Editor, and look in the Unity Log window.

You Should See

[Teak] IdentifyUser(): a unique user identifier