Treasure Data recommends that you implement any new features or functionality at your site using the Treasure Data JavaScript SDK version 3. 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.


  • Basic knowledge of JavaScript and HTML

  • Basic knowledge of Treasure Data

  • Basic knowledge of Treasure Data JavaScript SDK

  • You need at least JavaScript SDK v1.7.1

  • Validate that you want to track 3rd party cookies from web browsers that allow them


Treasure Data’s Cross Domain Tracking relies on 3rd party cookie mechanism. For more details, see Anonymous IDs. It’s particularly important to understand the limitation of 3rd party cookies because it doesn’t work for Mobile and PC Safari browsers.

Enabling Cross-Domain Tracking

Cross-Domain tracking must be enabled to be active for JavaScript SDK.

  1. Call td.set('$global', 'td_global_id', 'td_global_id'); to enable the feature.

<script type="text/javascript">
  // Configure an instance for your database
  var td = new Treasure({
    host: '',
    database: 'DATABASE_NAME'
  // Enable cross-domain tracking
  td.set('$global', 'td_global_id', 'td_global_id');
  // Track pageview information to 'pageviews' table

This line adds an additional column called td_global_id to the destination table.

  1. Optionally, review Sessionization functions to count sessions in:

  • No labels