class Teak
A MonoBehaviour which can be attached to a Unity GameObject to provide access to Teak functionality.
Static Attributes
Name | Type | Description |
---|---|---|
|
Value provided to IdentifyUser to opt out of collecting an IDFA for this specific user. |
|
|
Value provided to IdentifyUser to opt out of collecting a Push Key for this specific user. |
|
|
Value provided to IdentifyUser to opt out of collecting a Facebook Access Token for this specific user. |
Methods
SetChannelState
Assign the opt-out state for a Teak marketing channel.
IEnumerator SetChannelState(Channel.Type channel,
Channel.State state,
System.Action<Channel.Reply> callback);
csharp
You may only assign the values Teak.Channel.Type.OptOut and Teak.Channel.Type.Available to Push Channels; OptIn is not allowed. |
SetCategoryState
Assign the opt-out state for a category on a Teak marketing channel.
IEnumerator SetCategoryState(Channel.Type channel,
string category,
Channel.State state,
System.Action<Channel.Reply> callback);
csharp
You may only assign the values Teak.Channel.Type.OptOut and Teak.Channel.Type.Available to categories. |
IdentifyUser
Please use IdentifyUser(string, UserConfiguration) instead. |
Tell Teak how it should identify the current user.
void IdentifyUser(string userIdentifier,
string email);
csharp
This will also begin tracking and reporting of a session, and track a daily active user.
This should be the same way you identify the user in your backend. |
IdentifyUser
Please use IdentifyUser(string, UserConfiguration) instead. |
Tell Teak how it should identify the current user.
void IdentifyUser(string userIdentifier,
List<string> optOut,
string email);
csharp
This will also begin tracking and reporting of a session, and track a daily active user.
This should be the same way you identify the user in your backend. |
IdentifyUser
Tell Teak how it should identify the current user.
void IdentifyUser(string userIdentifier,
UserConfiguration userConfiguration);
csharp
This will also begin tracking and reporting of a session, and track a daily active user.
This should be the same way you identify the user in your backend. |
RefreshPushTokenIfAuthorized
On iOS, if 'TeakDoNotRefreshPushToken' is set to 'true' then this method will tell Teak that the push token is ready, and that the user has authorized push notifications. If the user has not authorized push notifications, this will have no effect.
void RefreshPushTokenIfAuthorized();
csharp
TrackEvent
Track an arbitrary event in Teak.
void TrackEvent(string actionId,
string objectTypeId,
string objectInstanceId);
csharp
IncrementEvent
Increment an arbitrary event in Teak.
void IncrementEvent(string actionId,
string objectTypeId,
string objectInstanceId,
long count);
csharp
RegisterRoute
Method used to register a deep link route.
void RegisterRoute(string route,
string name,
string description,
Action<Dictionary<string, object>> action);
csharp
Parameters
Name | Description |
---|---|
|
The route for this deep link. |
|
The name of this deep link, used in the Teak dashboard. |
|
A description for what this deep link does, used in the Teak dashboard. |
|
A function, or lambda to execute when this deep link is invoked via a notification or web link. |
SetBadgeCount
Method to set the number displayed on the icon of the app on the home screen.
bool SetBadgeCount(int count);
csharp
OpenSettingsAppToThisAppsSettings
Open the settings for your app.
bool OpenSettingsAppToThisAppsSettings();
csharp
OpenNotificationSettings
Open the notification settings for your app.
bool OpenNotificationSettings();
csharp
SetNumericAttribute
Assign a numeric value to a user profile attribute
void SetNumericAttribute(string key,
double value);
csharp
SetStringAttribute
Assign a string value to a user profile attribute
void SetStringAttribute(string key,
string value);
csharp
GetDeviceConfiguration
Get Teak’s configuration data about the current device.
Dictionary<string, object> GetDeviceConfiguration();
csharp
GetNotificationRegistration
Get push notification registration information from Teak.
Dictionary<string, object> GetNotificationRegistration();
csharp
RegisterForProvisionalNotifications
Register for Provisional Push Notifications.
bool RegisterForProvisionalNotifications();
csharp
RegisterForNotifications
Please use RegisterForNotifications(System.Action) instead. |
Register for Push Notifications.
void RegisterForNotifications();
csharp
This is a compatibility method which simply wraps RegisterForNotifications(System.Action) in a StartCoroutine()
RegisterForNotifications
Register for Push Notifications.
IEnumerator RegisterForNotifications(System.Action<bool> callback);
csharp
This is a Coroutine and will not return until the player grants or denies push permissions.
ProcessDeepLinks
Indicate that your app is ready for deep links.
void ProcessDeepLinks();
csharp
Deep links will not be processed sooner than the earliest of:
-
IdentifyUser(string, UserConfiguration) is called
-
This method is called
HandleDeepLinkPath
Manually pass Teak a deep link path to evalute.
bool HandleDeepLinkPath(string url);
csharp
Return
true if the deep link was handled by Teak.
This path should be prefixed with a forward slash, and can contain query parameters, e.g. /foo/bar?fizz=buzz It should not contain a host, or a scheme.This function will only execute deep links that have been defined through Teak. It has no visibility into any other SDKs or custom code.
Static Methods
Init
Manually initialize Teak.
Teak Init();
csharp
Under normal circumstances it is not necessary to call this, and you can simply use Teak.Instance (which calls this method). |
Properties
Name | Type | Description | Access |
---|---|---|---|
Gets the Teak singleton. |
Get |
||
|
Teak SDK version. |
Get |
|
|
Teak App Id. |
Get/Set |
|
|
Teak API Key. |
Get/Set |
|
|
UNIX Timestamp. |
Get |
|
|
The user identifier for the current user. |
Get |
|
State of push notifications. |
Get |
||
|
Get Teak’s configuration data about the current app. |
Get |
|
|
Teak will log all Unity method calls to the Unity log if true. |
Get/Set |
|
|
Determine if Teak can open directly to the settings for this app. |
Get |
|
|
Determine if Teak can open directly to the notification settings for this app. |
Get |
Events
OnLaunchedFromNotification
An event which gets fired when the app is launched via a push notification.
System.Action<TeakNotification> OnLaunchedFromNotification;
csharp
OnReward
An event which gets fired when a Teak Reward has been processed (successfully or unsuccessfully).
System.Action<TeakReward> OnReward;
csharp
OnForegroundNotification
An event which gets fired when a push notification is received while the app is in the foreground.
System.Action<TeakNotification> OnForegroundNotification;
csharp
OnConfigurationData
An event which gets fired when Teak remote configuration is ready.
System.Action<ConfigurationData> OnConfigurationData;
csharp
OnLogEvent
An event which is dispatched for each log event from the Teak SDK
System.Action<Dictionary<string, object>> OnLogEvent;
csharp
OnAdditionalData
An event which is dispatched when additional data is available for the current user.
System.Action<Dictionary<string, object>> OnAdditionalData;
csharp
OnUserData
An event which is dispatched when user data becomes available or is changed.
System.Action<Teak.UserData> OnUserData;
csharp
OnLaunchedFromLink
An event which is dispatched when the app is launched from a link created by the Teak dashboard.
System.Action<Dictionary<string, object>> OnLaunchedFromLink;
csharp
OnPostLaunchSummary
An event which is dispatched each time the app is launched, with info about the launch.
System.Action<TeakPostLaunchSummary> OnPostLaunchSummary;
csharp
Enums
NotificationState
Possible push notification states.
Name | Description |
---|---|
|
Unable to determine the notification state. |
|
Notifications are enabled, your app can display notifications. |
|
Notifications are disabled, your app cannot display notifications. |
|
Provisional notifications are enabled, your app can receive notifications but they will only display in the Notification Center (iOS 12+ only). |
|
The user has not been asked to authorize notifications (iOS only). On Android the NotificationState will be Disabled if permissions have never been requested, due to OS limitations. |