# Migrating to TD JS SDK 4 0

To migrate your application to JS SDK 4.0:

1. 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](https://us01.records.in.treasuredata.com)". For a list of new ingest endpoints by region, see [Treasure Data Sites and baseURLs](/apis/endpoints/endpoints).

Example


```javascript
    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'  
    });
```

1. (Optional) Write SQL to get values for td_browser, td_browser_version,td_os, and td_os_version from td_user_agent.


Example


```sql
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;
```

![](/assets/img0001.82336ede1a4f735b47694aa5033bcde7398be4d114d20b8078002823d0fd1b7b.ef656343.png)