TD JavaScript SDK (TD JS SDK) allows Treasure Data to store first-party cookies on your domain’s website and to then track your website’s users across the other platforms and collect information. By using the TD JS SDK, you don’t have to install anything server-side to track website activities.
Treasure Data recommends you verify the implementation of any new features or functionality at your site using the Treasure Data JavaScript SDK version 3 before you start using it in production. 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 //cdn.treasuredata.com/sdk/2.5/td.min.js to //cdn.treasuredata.com/sdk/3.0.0/td.min.js.
Learn more at Getting Started with Web Tracking and Web Tracking Using the TD JavaScript SDK Tutorial. Additional information on setting up and configuring TD JS SDK version 2.5.0 is available on GitHub.
This topic contains:
- Version 2.5.0 Updates
- Consent Management Extensions
- Treasure Data JavaScript SDK Version 2.5.0 Log Parameters
- Version 2.4.2 Updates
You can also use TD SDK Consent extensions for your consent management activities, including the ability to collect consumer consent, define different categories of data use, and present consumer consent preferences in the browser, which are viewable from their browser.
Learn more about configuring your Consent Manager.
The TD JS SDK uses the function trackPageview to log the following parameters.
| Parameter | Description | Default |
|---|---|---|
| td_version | td-js-sdk's version | X |
| td_client_id | client's uuid | NO |
| td_charset | character set | X |
| td_description | description meta tag | X |
| td_language | browser language | X |
| td_color | screen color depth | X |
| td_screen | screen resolution | X |
| td_viewport | viewport size | X |
| td_title | document title | X |
| td_url | document url | X |
| td_user_agent | browser user agent | X |
| td_platform | browser platform | X |
| td_host | document host | X |
| td_path | document pathname | X |
| td_referrer | document referrer | X |
| td_ip | request IP (server) | NO |
| td_browser | client browser (server) | X |
| td_browser_version | client browser version (server) | X |
| td_os | client operating system (server) | X |
| td_os_version | client operating system version (server) | X |
| td_global_id | 3rd party cookie | NO |
| td_ssc_id | Server Side Cookie | No |
The default parameters tracked do not include td_client_id , td.ip , and td_global_id to ensure compliance with global privacy laws. You can enable them by calling the td.set command.
Cookie IDs
In Treasure Data, 1st party cookies are called td_client_id, and 3rd party cookies are called td_global_id.
Chrome and Firefox enforce a secure-by-default cookie classification system. This system treats cookies with no declared SameSite value as SameSite=Lax. Only cookies set as SameSite=None; Secure are available in third-party contexts, provided they are accessed from secure connections. Treasure Data JS SDK version 2.4.2 uses SameSite=None; Secure cookies by default to adapt the new cookie enforcement. When you upgrade TreasureData JS SDK to version 2.4.2, you must call resetUUID or fetchGlobalID for the new update to take effect.
Additionally, in version 2.4.2, the Client ID cookie is disabled in Anonymous mode. If the startInSignedMode option is false or td.setAnonymousMode() is called, the _td cookie will be disabled. This prevents _td cookie from being attached to requests when the user has opted out of device identification.