Rollbar
How to integrate Rollbar with OpenReplay and see backend errors alongside session replays.
1. Create Project Access Tokens
Section titled 1. Create Project Access Tokens- Login to your Rollbar account.
- Select your project from the dropdown (top left).
- Go to Settings > Project Access Tokens.
- Click on Create new access tokens.
- In the Scope select
read
; in name putopenreplay
; and leave the Rate Limit to default. - Copy your new token.
2. Enable Rollbar in OpenReplay
Section titled 2. Enable Rollbar in OpenReplayPaste your Access Token
in OpenReplay dashboard under ‘Preferences > Integration’.
3. Propagate openReplaySessionToken
Section titled 3. Propagate openReplaySessionTokenTo 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;
Have questions?
Section titled Have questions?If you encounter any issues, connect to our Slack or check out our Forum and get help from our community.