Session Replay Quickstart

Install the SDK, configure privacy settings, and start viewing user sessions in your Sentry dashboard.

1
Install

More SDKs...
npx @sentry/wizard@latest -i nextjs
Video thumbnail

2
Setup

Configure your Sentry SDK with the Replay integration. Set your DSN and customize replay options to start capturing user sessions.

The code snippet shows the basic setup required to enable Session Replay in your application.

Learn more about Session Replay setup
Click to Copy
import * as Sentry from '@sentry/nextjs'; Sentry.init({ dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0', replaysSessionSampleRate: 0.1, replaysOnErrorSampleRate: 1.0, integrations: [Sentry.replayIntegration()], });

3
Configure

Sample Rates

Control what percentage of sessions to capture. Use replaysSessionSampleRate for regular sessions and replaysOnErrorSampleRate to always capture sessions with errors. Set to higher values during development, lower in production to manage costs.

Learn more about sampling
Click to Copy
import * as Sentry from '@sentry/nextjs'; Sentry.init({ dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0', replaysSessionSampleRate: 0.1, replaysOnErrorSampleRate: 1.0, integrations: [Sentry.replayIntegration()], });

Privacy Controls

All data is masked by default. Control masking with maskAllText and blockAllMedia options. Selectively unmask elements by adding CSS classes: sentry-unmask to show text, or use sentry-mask, sentry-block, and sentry-ignore for fine-grained control.

Learn more about privacy controls
Click to Copy
import * as Sentry from '@sentry/nextjs'; Sentry.init({ dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0', replaysSessionSampleRate: 0.1, replaysOnErrorSampleRate: 1.0, integrations: [ Sentry.replayIntegration({ maskAllText: true, blockAllMedia: true, }), ], });

4
See It In Action

View Your First Replay

After installing, trigger an error in your app to generate your first replay. Go to Issues > [click any error] > Replays tab to see the session. Or view all replays in Explore > Replays. Click the timeline to jump to specific moments, inspect DOM state, and review console logs and network activity.

Learn more about Session Replay features
View Your First Replay

Use AI Summaries to Triage Faster

Open any replay and look for the "Summary" panel at the top. The AI summary highlights key user actions, clicks, and navigation that led to the error. Use this to quickly assess if the replay is worth watching in full.

Learn more about AI Summaries
Use AI Summaries to Triage Faster

Next Steps

Explore the full documentation to learn more about Session Replay features and configuration options.

© 2025 • Sentry is a registered Trademark of Functional Software, Inc.