Rollbar

How to integrate Rollbar with OpenReplay and see backend errors alongside session replays.

1. Create Project Access Tokens

  1. Login to your Rollbar account.
  2. Select your project from the dropdown (top left).
  3. Go to Settings > Project Access Tokens.
  4. Click on Create new access tokens.

Rollbar Project Access Tokens

  1. In the Scope select read; in name put openreplay; and leave the Rate Limit to default.
  2. Copy your new token.

Rollbar Active Token

2. Enable Rollbar in OpenReplay

Paste your Access Token in OpenReplay dashboard under 'Preferences > Integration'.

Rollbar Integration in OpenReplay

3. Propagate openReplaySessionToken

To link a Rollbar 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 Rollbar log entry with the recorded user session, a unique token has to be propagated as an extra_data to each backend error you wish to track.

Below is an example in Rollbar's Python API.

rollbar.report_message("A LOG ENTRY", level='error', extra_data={"openReplaySessionToken": OPENREPLAY_SESSION_TOKEN})
# or if you are catching the exceptions
rollbar.report_exc_info(sys.exc_info(), level='error', extra_data={"openReplaySessionToken": str(OPENREPLAY_SESSION_TOKEN)})

The name of the tag openReplaySessionToken is case sensitive;

Troubleshooting

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