To link New Relic sessions with Noibu's sessions, add the Noibu session ID as a header to your API calls. You can get the Noibu session ID from local storage where it is stored under the key n_browser_data
with the field BrowserId
. With this link established, you'll be able to trace user actions across both systems for more efficient debugging and analytics.
To start, retrieve the Noibu session ID from local storage with the code snippet below:
// Retrieve the Noibu session ID from local storage
let noibuData = JSON.parse(localStorage.getItem('n_browser_data'));
let noibuSessionId = noibuData ? noibuData.BrowserId : '';
Next, make an API call with New Relic's APM installed and add the Noibu session ID as a header. In the snippet below, replace someAPICallhere
with your actual API endpoint.
fetch(someAPICallhere, {
headers: {
// other headers
'X-Noibu-Session-ID': noibuSessionId,
},
});
If done properly, this will attach the Noibu session ID as a header to your backend request, allowing you to correlate data between New Relic and Noibu.