Session replay
Session replay records what happened in the browser — DOM mutations, clicks, navigation, console — and plays it back next to the error it produced.
Setup
import * as Sentry from "@sentry/browser";
Sentry.init({
dsn: "https://<public_key>@<your-errora-host>/<project_id>",
integrations: [
Sentry.replayIntegration({
maskAllText: true, // privacy defaults: on
blockAllMedia: true,
maskAllInputs: true,
}),
],
replaysSessionSampleRate: 0.1, // 10% of all sessions
replaysOnErrorSampleRate: 1.0, // 100% of sessions that hit an error
});
Two sample rates, deliberately:
replaysSessionSampleRate— ordinary browsing. Keep it low; every recorded session costs.replaysOnErrorSampleRate— sessions where an error happened. Keep this at1.0: this is the recording you will actually want to watch.
Privacy
Replay records your users' screens, so treat it as sensitive by default:
| Control | Effect |
|---|---|
maskAllText: true | Text nodes are replaced with blocks |
maskAllInputs: true | Input values never leave the browser |
blockAllMedia: true | Images/video are not recorded |
class="sentry-mask" | Mask one specific element |
class="sentry-block" | Do not record the element at all |
class="sentry-ignore" | Record the element but not interactions with it |
Masking happens in the browser, before anything is sent. Turn masking off only for elements you have deliberately reviewed.
Mobile replays
The Android and iOS SDKs record replays too. A mobile replay is video-based: the SDK captures the screen as video segments instead of a DOM recording, and Errora plays it back as video on the Replays page, alongside the recorded touches and breadcrumbs.
// Android
options.sessionReplay.onErrorSampleRate = 1.0
options.sessionReplay.sessionSampleRate = 0.1
// iOS
options.sessionReplay.onErrorSampleRate = 1.0
options.sessionReplay.sessionSampleRate = 0.1
Masking happens on the device, in the SDK, before the video is encoded — text and images
are masked by default. Control it with the SDK's options (options.sessionReplay.maskAllText,
maskAllImages, and per-view masking); nothing is unmasked on the server. Mobile replays are
billed as session replay, exactly like web replays.
In the UI
Replays lists recorded sessions with user, duration, error count, browser and OS. Open one for:
- Playback of the rrweb recording with a timeline
- Visited pages during the session
- Errors raised in that session, linked to their issues
- Linked traces, when tracing is on
From an issue, the Replay panel jumps straight to the moment the error happened. From
user feedback, a replay_id does the same.
API
GET /api/v1/projects/{project_id}/replays?stats_period=24h&limit=&offset=
GET /api/v1/projects/{project_id}/replays/{replay_id}
GET /api/v1/projects/{project_id}/replays/{replay_id}/events
Cost
Replays are metered as the Session Replay service, per recorded session — the most expensive unit in the price list. Sampling is your cost control; see Wallet.
Troubleshooting
| Symptom | Cause / fix |
|---|---|
| No replays at all | replayIntegration() missing, or both sample rates are 0 |
| Replays but no error linkage | The error was captured in a different session/tab, or replay started after the error |
| Blank/broken playback | Cross-origin stylesheets can't be inlined — serve CSS from your own origin or allow CORS |
| Recording is huge | Long sessions on heavy DOMs; lower replaysSessionSampleRate and block noisy widgets with sentry-block |
| Sensitive data visible | Masking was turned off somewhere — audit mask* options and per-element classes |