# About Javascript SDK Version 3.1 Starting from JavaScript SDK v3.1, a new ingestion endpoint is supported in order to improve security and removes ingestion bottlenecks. By using this new endpoint, the following enhancements and changes are introduced: * [Visible Changes](/products/customer-data-platform/integration-hub/streaming/td-javascript-sdk/about-javascript-sdk-version-3-1#visible-changes) * [Treasure Data JavaScript SDK Version 3.1 Log Parameters](/products/customer-data-platform/integration-hub/streaming/td-javascript-sdk/about-javascript-sdk-version-3-1#treasure-data-javascript-sdk-version-31-log-parameters) * [How to use a new endpoint](/products/customer-data-platform/integration-hub/streaming/td-javascript-sdk/about-javascript-sdk-version-3-1#how-to-use-a-new-endpoint) * [FAQ](/products/customer-data-platform/integration-hub/streaming/td-javascript-sdk/about-javascript-sdk-version-3-1#h1__728891130) * [Limitations & Changed Behavior](/products/customer-data-platform/integration-hub/streaming/td-javascript-sdk/about-javascript-sdk-version-3-1#limitations--changed-behavior) # Visible Changes * These values will not be populated anymore, customers needs to obtain them using TD_PARSE_AGENT function by Presto and Hive from **td_user_agent** : * **td_browser**: client browser * **td_browser_version**: client browser version * **td_os**: client operating system * **td_os_version**: client operating system version * NOTE: **td_user_agent** is populated using JavaScript via *navigator.userAgent* API * **JSSDK/version** will be added to the end of **td_user_agent** property * i.e. `td_user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36;JSSDK/3.1.1"` * The new endpoint will validate APIKEY once a request is received. If APIKEY is invalid, it will return 401 error immediately. * `{"code":401,"message":"Credentials are required to access this resource."}` # Treasure Data JavaScript SDK Version 3.1 Log Parameters 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 | Default parameters tracked do not include **td_client_id** , **td.ip** , and **td_global_id** in order to ensure compliance with global privacy laws. You can enable them by calling the td.set command. # How to use a new endpoint We introduce a new option to opt-in to our new JavaScript endpoint, named useNewJavaScriptEndpoint , which has a true or false value. When you enable this option, you need to change the host configuration as well, so that it will point to our new endpoint. The host configuration should have the following value, depending on the environment that will be used: * AP02 Region: **[ap02.records.in.treasuredata.com](http://ap02.records.in.treasuredata.com)** * Tokyo Region: **[ap01.records.in.treasuredata.com](http://ap01.records.in.treasuredata.com)** * US Region: **[us01.records.in.treasuredata.com](http://us01.records.in.treasuredata.com)** * EU01 Region: **[eu01.records.in.treasuredata.com](http://eu01.records.in.treasuredata.com/)** When you opt-out of this feature by either setting the *`useNewJavaScriptEndpoint`* to `false` or not setting it, make sure that you update the `host` to the old configuration. ```javascript var td = new Treasure({ database: 'foo', writeKey: 'your_write_only_key', useNewJavaScriptEndpoint: true, host: 'us01.records.in.treasuredata.com' }); ``` # FAQ * Can I use existing functions that are supported by previous versions? * Yes. The functionalities are same as-is. * How can I retrieve td_browser, td_browser_version, td_os, td_os_version by queries? ```sql -- Presto -- element_at can handle even if the key is missing. SELECT element_at( td_parse_agent(td_user_agent) , 'name' ) AS td_browser, element_at( td_parse_agent(td_user_agent) , 'version' ) AS td_browser_version, element_at( td_parse_agent(td_user_agent) , 'os' ) AS td_os, element_at( td_parse_agent(td_user_agent) , 'os_version' ) AS td_os_version FROM web_access -- OR, The following works for both Hive and Presto SELECT td_parse_agent(td_user_agent) ['name'] AS td_browser, td_parse_agent(td_user_agent) ['version'] AS td_browser_version, td_parse_agent(td_user_agent) ['os'] AS td_os, td_parse_agent(td_user_agent) ['os_version'] AS td_os_version FROM web_access ``` # Limitations & Changed Behavior Using Real-time segmentation requires routing enablement from the Backend. Please reach out to Treasure Data Support and give us the account, database, and table to enable routing for, and we can do that from the backend. We will remove this limitation in the future release.