Configuration

General Integration Configuration

The following options can be configured on the root level of your browser-based Sentry SDK, in init({}):

KeyTypeDefaultDescription
replaysSessionSampleRatenumber0The 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.
replaysOnErrorSampleRatenumber0The 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({}):

KeyTypeDefaultDescription
stickySessionbooleantrueKeep 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.

Copied
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():

Copied
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.

Help improve this content
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").