To migrate your application to JS SDK 4.0:
- Update the host configuration in your JavaScript snippet with the new records.in base URL.
For example, US developers will configure the ingest endpoint to "https://us01.records.in.treasuredata.com". For a list of new ingest endpoints by region, see Treasure Data Sites and baseURLs.
Example
var foo = new Treasure({
database: 'your_database',
writeKey: 'your_write_only_key',
// Remove old ingest endpoint
// host: 'in.treasuredata.com'
host: 'us01.records.in.treasuredata.com'
}); - (Optional) Write SQL to get values for td_browser, td_browser_version,td_os, and td_os_version from td_user_agent.
Example
SELECT
td_user_agent,
TD_PARSE_USER_AGENT(td_user_agent, 'os_family') AS td_os
,TD_PARSE_USER_AGENT(td_user_agent, 'os_major') AS td_os_version_major
,TD_PARSE_USER_AGENT(td_user_agent, 'os_minor') AS td_os_version_minor
,TD_PARSE_USER_AGENT(td_user_agent, 'ua_family') AS td_browser
,TD_PARSE_USER_AGENT(td_user_agent, 'ua_major') AS td_browser_version_major
,TD_PARSE_USER_AGENT(td_user_agent, 'ua_minor') AS td_browser_version_minor
FROM
pageview; 