TrackJS

Integrating LogRocket with TrackJS

Add a LogRocket session recording URL to every TrackJS exception report.

window._trackJs = {
  token: "TOKEN",

  // other stuff
  onError: function (payload, error) {
    payload.metadata.push({
      key: "LogRocket URL",
      value: (LogRocket || {}).sessionURL,
    });

    return true; // Ensure error gets sent
  }
};