Configuration
If you have any questions, feedback or would like to report a bug, please open a GitHub issue with a link to a relevant replay or, if possible, a publicly accessible URL to the page you're attempting to record a replay of.
General Integration Configuration
The following options can be configured on the root level of your browser-based Sentry SDK, in init({})
:
Key | Type | Default | Description |
---|---|---|---|
replaysSessionSampleRate | number | 0 | The sample rate for replays that begin recording immediately and last the entirety of the user's session. 1.0 collects all replays, and 0 collects none. |
replaysOnErrorSampleRate | number | 0 | The sample rate for replays that are recorded when an error happens. This type of replay will record up to a minute of events prior to the error and continue recording until the session ends. 1.0 captures all sessions with an error, and 0 captures none. |
The following options can be configured as options to the integration, in new Replay({})
:
Key | Type | Default | Description |
---|---|---|---|
stickySession | boolean | true | Keep track of the user across page loads. Note, a single user using multiple tabs will result in multiple sessions. Closing a tab will result in the session being closed as well. |
Identifying Users
You can use the Sentry SDK to set the user of a session. To associate a user identity to a session replay, refer to the Identifying User Docs.
Sentry.setUser({ email: "jane.doe@example.com" });
Start and Stop Recording
Replay recording starts if it's included in the integrations
array when calling Sentry.init
or, when addIntegration
is called from a Sentry client instance. To stop recording, call stop()
:
const replay = new Replay();
// Load replay when you configure Sentry SDK
Sentry.init({
integrations: [replay],
});
// Or if you want to defer loading Replay
getCurrentHub()
.getClient()
.addIntegration(replay);
// sometime later
await replay.flush(); // wait for any pending recording data to be sent
replay.stop();
replay.start();
Privacy
We take privacy seriously, so we provide a number of privacy-oriented settings. Learn more about these in our our Session Replay privacy documentation.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").
- Package:
- npm:@sentry/svelte
- Version:
- 7.45.0
- Repository:
- https://github.com/getsentry/sentry-javascript