Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents
maxLevel1

GDPR compliance

To support compliance with national and global data privacy requirements such as the European General Data Privacy Regulation, our SDK provides methods that control the collection and tracking of personal data and metadata in applications and websites. When your company defines data privacy policies around personal data, you can use these methods in your code to implement default data collection behaviors, and add controls for individuals to use to manage data collection and privacy themselves.

NOTE: Customers of Treasure Data must ensure that their usage of the SDK, including its use that collects personal data, complies with the legal agreement that governs access to and use of the Treasure Data service, including specifically Treasure Data's current Terms of Service (https://www.treasuredata.com/terms/), privacy policy (https://www.treasuredata.com/privacy/), and Privacy Statement for Customer Data (https://www.treasuredata.com/td-downloads/Privacy-Statement-for-Customer-Data.pdf).

Prerequisites

  • Basic knowledge of Unity Development

  • Basic knowledge of Treasure Data

Install the Library

Download the most recent version of our Unity package and import it into your Unity project using Assets -> Import Package -> Custom Package.

For iOS Application development

On Xcode, you must complete the following steps:

  • In Build Phases -> Link Binary With Libraries, add libz.tbd

  • In Build Phases -> Compile Sources add -fno-objc-arc compile flag to NativePlugin.mm

Initialize the Library

Next, initialize the library in your app as follows.

...

  • When the current screen is closing or moving to background

  • When closing the application

Send Events to the Cloud

Next, call the AddEvent() function at the appropriate time within your applications. The following example shows an event is sent to the table table_b within the database database_a.

...

NOTE: IP whitelist won't be applied to any import from iOS or Android SDK. Also we've seen a lot of cases where a lot of iOS or Android devices have an invalid timestamp (like 1970/01/01), so we're currently ignoring the log which has a timestamp older than 7 days, and newer than 3 days ahead.

Tracking Application Lifecycle Events

Optionally, you can enable the Unity SDK to automatically capture app lifecycle events (disabled by default). You must explicitly enable this option. You can set the target table through DefaultTable:

...

Code Block
{
    "td_unity_event": "TD_UNITY_APP_UPDATE",
    "td_app_ver": "1.1",
    "td_app_previous_ver": "1.0",
    ...
}

Tracking In-App Purchase Events

If enabled, Treasure Data SDK can automatically track IAP events without having to listen and call addEvent yourself. Enable this tracking feature by:

...

Consult Treasure Data Android SDK - IAP Tracking and Treasure Data iOS SDK - IAP Tracking for the further details of these columns' value.

Opt-out

Respecting your user's privacy is critical to any business. Treasure Data SDK can opt-out all events tracking for a particular device and de-identify users by resetting (or disabling completely) the td_uuid. You can change the td_uuid. to a different id for all subsequent events:

...

Code Block
{
    "td_unity_event": "forget_device_uuid",
    "td_uuid": <old_uuid>,
    <configured_additional_parameters...>
}

Advanced Tips

Retry uploading and deduplication

This SDK imports events in exactly once style with the combination of these features.

...

As for the deduplication window is 1 hour by default, so it’s important not to keep buffered events more than 1 hour to avoid duplicated events.

Next Steps

For transparency, we are making our Unity SDK available as open source on Github. Check the repository to ensure that you have the most recent SDK.

...