Rollbar
How to integrate Rollbar with OpenReplay and see backend errors alongside session replays.
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
Paste your Access Token
in OpenReplay dashboard under 'Preferences > Integration'.
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 snippetheaders['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 exceptionsrollbar.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.