New Relic

How to integrate New Relic with OpenReplay and see backend errors alongside session recordings.

  1. Login to your New Relic account.
  2. In the top left, select the INSIGHTS dashboard.
  3. In the INSIGHTS dashboard, go to “Manage Data” then select API Keys.
  4. Click on the + button of Query Keys.

New Relic API Keys

  1. In the Notes put openreplay.
  2. Copy the Account ID and the Key.
  3. Click on Save your notes.

New Relic Query Key

2. Enable NewRelic in OpenReplay

Section titled 2. Enable NewRelic in OpenReplay

Paste your Application ID and Key in OpenReplay dashboard under ‘Preferences > Integration’.

New Relic Integration in OpenReplay

3. Propagate openReplaySessionToken

Section titled 3. Propagate openReplaySessionToken

To link a New Relic event with the recorded user session, a unique token has to be propagated from your frontend to your backend on each request you want to track. This can be done using a custom HTTP header. In the below example, we use the fetch function to send that header.

const headers = {
  Accept: 'application/json',
  'Content-Type': 'application/json',
};
if (tracker.getSessionToken()) { // or window.OpenReplay instead of tracker if you're using the snippet
  headers['X-OpenReplay-SessionToken'] = tracker.getSessionToken(); // Inject openReplaySessionToken
}
fetch('www.your-backend.com', {
  'GET',
  headers,
});

In order for OpenReplay to associate a New Relic log entry with the recorded user session, a unique token has to be propagated as a custom_parameter to each backend error you wish to track.

Below is an example in NewRelic’s Python API.

newrelic.agent.add_custom_parameter("openReplaySessionToken", OPENREPLAY_SESSION_TOKEN)

The name of the tag openReplaySessionToken is case sensitive.

If you encounter any issues, connect to our Slack or check out our Forum and get help from our community.