The article describes the following SDKs.

With these SDKs, you can import data on your application into Treasure Data. In that case, you don’t need to build servers.

Treasure Data recommends that you implement any new features or functionality at your site using the Treasure Data JavaScript SDK version 3 Beta. It manages cookies differently. Be aware when referring to most of these articles that you need to define the suggested event collectors and Treasure Data JavaScript SDK version 3 calls in your solutions.

For example, change // to //

Mobile SDKs Features

The SDK has the following functions:

  • Add the event that occurs in the application (buffering at the client side)(addEvent/addEventWithCallback)

    • Encrypt/Decrypt the buffered data with arbitrary common key automatically (initializeEncryptionKey, default:disable)

  • Upload the buffered events to TD (To avoid the data loss, the buffered data is cleared only when the upload is success.)(uploadEvents/uploadEventsWithCallback)

    • Retry the upload a certain number of times in the case of an upload failure(Exponential backoff) (enableRetryUploading/disableRetryUploading, default:enable)

      • The uploaded data is automatically compressed to one eighth of its original size(enableEventCompression/diableEventCompression, default:enable)

  • Register which of the Callbacks to call, depending on the success or failure of the operation(Event adding or Uploading)(addEventWithCallback/uploadEventsWithCallback)

  • The SDK generates a unique ID for each device. Since this ID is added to each event automatically, it makes aggregating each device’s data easy.(enableAutoAppendUniqId/disableAutoAppendUniqId, default:disable)

  • Add OS version or device model information to each event automatically.(enableAutoAppendModelInformation/disableAutoAppendModelInformation, default:disable)

  • The SDK generates a session id for each session initiation/termination. Since the session id is added to each event automatically, you can aggregate per a sequence of events that occurred in application.(startSession/endSession)

  • Detect the first running of applications, since SDK monitors whether applications were running or not.(isFirstRun/clearFirstRun)

  • Prevent data duplication even if you update multiple times by executing de-duplication at server side. (Currently, executing de-duplication every day)

The string which is described at the end of each function is the SDK API name (TreasureData class' method name in concrete terms.). You need to configure the database and the table for registering events in the SDKs. They work with the destination database and the destination table in Treasure Data.

For example, the following picture shows a part of sample data on Treasure Data when using startSession and endSession with activating enableAutoAppendUniqId and enableAutoAppendModelInformation.

Account Management for Mobile SDKs

Treasure Data requires API Keys for authentication when you import data or issue a query. In the case of using SDK for mobile SDKs (also Javascript SDK), recommend the following steps.

  • Create a database on Treasure Data for importing from SDKs.

  • Associate a user who is granted access to the above database, with a Treasure Data user.

    • You can associate the user with the Treasure Data user by using “Add Team Member” from

  • Generate ‘Write-only’ API keys for the above user.

  • Use generated “Write-only" API keys on SDKs.

Selecting the “My Profile” in the TD Console.

Insert your password under the “API Keys” panel.

Generate “Write-only” API keys.

More On Mobile SDKs

  • No labels