Trackjs

Integrating SessionStack with Trackjs

Add a SessionStack recording to every Trackjs exception report.

Add this code anywhere in your app, after SessionStack and Trackjs have been loaded.

window._trackJs = {
  token: 'TOKEN',

  // other stuff

  onError: function (payload, error){
    sessionstack('getSessionId', function(sessionId) {
        if (sessionId) {
            payload.metadata.push({
              key: "SessionStack URL",
              value: 'https://app.sessionstack.com/player/#/sessions/' + sessionId
            });
        }
    });

    return true; // Ensure error gets sent
  }
}