Track JS Destination

Segment makes it easy to send your data to Track JS (and lots of other destinations). Once you've tracked your data through our open source libraries we'll translate and route your data to Track JS in the format they understand. Learn more about how to use Track JS with Segment.

Getting Started

When you toggle on Track JS as a destination in Segment, this is what happens:

  • Our CDN is updated within 5-10 minutes. Then our snippet will start asynchronously loading Track JS onto your page. This means you should remove Track JS’ snippet from your page.
  • Track JS will automatically start recording error data.

Since Track JS only records data about errors, it does not collect any of the data represented by our API.

Non-supported options

We do not currently support Track JS’ onError and serialize options because they pose a XSS vulnerability.

To work around this issue, however, you can directly set these options in the window._trackJs object on your page. These options will be merged with the settings you have configured in the interface once the Track JS script is loaded.

We also do not support version, or sessionId. These can either be set prior to initialization as described above, or can be set after the snippet has been loaded with the ready callback

  window.trackJs.configure({ sessionId: '123456', version: '1.0' });

Note that the userId parameter is automatically determined.

Supported Sources and Connection Modes

📱 Device-based
☁️ Cloud-based

To learn more about about Connection Modes and what dictates which we support, see here.


Segment lets you change these destination settings via your Segment dashboard without having to touch any code.

Application Key

Optional. The name of the section of your application that this Segment project encompasses. For more info see here

Callback BindStack

Whether TrackJS should record the stacktrace for how a callback came to be bound, allowing the creation of an ‘async stacktrace’ in the TrackJS UI. This gives you more context of how the application arrived at the function that failed. Enabling this has a nontrivial performance penalty, test before enabling in production

Callback Enabled

Whether TrackJS should watch for errors on host-function callbacks, such as addEventListener, and setTimeout. Disabling this greatly decreases the likelihood of recording a stacktrace for an error.

Console Display

Whether calls to console.log and other console functions should be displayed into the browser’s console.

Console Enabled

Whether TrackJS should wrap and watch the console for events. If disabled, window.console is not guaranteed to exist in all browsers.

Console Error

Whether TrackJS should transmit errors on calls to console.error.


Whether to enable TrackJS for the page. If false, the TrackJS watchers will not be set up. The window.trackJs API will still be available and function locally, but no errors will be transmitted from the browser

Network Enabled

Whether TrackJS should wrap and watch AJAX calls. If disabled, network events will not appear in your Telemetry Timeline.

Network Error

Whether TrackJS should transmit errors when an AJAX call completes with a ‘failing’ status code, 400 or greater. If you wish to customize the list of status codes you want to capture errors from, set this to true and filter out status codes using the onError callback.


You can find your token under Track JS setup page.

Visitor Enabled

Whether TrackJS should watch visitor interaction events, such as clicks and field input.

Window Enabled

Whether TrackJS should watch window.onerror for global errors

Questions? Need help? Contact us!
Can we improve this doc?
Email us:!