Skip to main content
Session Replay lets you watch a video-like reproduction of user sessions, helping you understand exactly what users experienced when issues occurred.

Setup

Enable Session Replay during SDK initialization:
Session Replay requires the @sentry/replay package or using a bundle that includes it (like @sentry/browser).

Sampling

Session Sample Rate

Percentage of all sessions to record:

Error Sample Rate

Percentage of sessions with errors to record:

Combined Strategy

Start with high errorSampleRate (1.0) and low sessionSampleRate (0.01-0.1) to capture issues while managing costs.

Recording Modes

Session Mode

Continuously records the entire session:

Buffer Mode (Error-Only)

Only keeps the last 60 seconds in memory, saves to Sentry when an error occurs:
Buffer mode is more efficient as it only uploads replay data when an error actually happens.

Configuration Options

Basic Options

Privacy Options

Privacy Controls

Masking Text

Mask sensitive text automatically:
Or configure via JavaScript:

Blocking Elements

Completely block elements from being recorded:
Or configure via JavaScript:

Unmasking Elements

Unmask specific elements when maskAllText is enabled:
Carefully review what data is captured. Always err on the side of privacy when handling sensitive user information.

Network Recording

Capture Network Requests

Network Privacy

Console Logs

Include console logs in replays:

Canvas Recording

Record canvas elements (experimental):
Canvas recording is experimental and may impact performance. Use only when necessary.

Manual Control

Start/Stop Recording

Conditional Recording

Integration with Errors

Replays are automatically linked to errors:

Integration with Performance

Combine replays with performance monitoring:
Replays show performance spans as part of the timeline.

Performance Impact

Optimization Tips

  1. Use buffer mode: Only record when errors occur
  2. Lower sample rates: Record fewer sessions
  3. Block media: Reduce data capture size
  4. Mask text: Use CSS masking instead of JS
  5. Limit network detail: Only capture essential APIs

Example Configurations

Development

Production

E-commerce

Viewing Replays

Replays appear in the Sentry UI:
  1. Issues: Linked to error events
  2. Replays Tab: Browse all recorded sessions
  3. Performance: Associated with transactions
Each replay includes:
  • Visual recording of the session
  • Console logs
  • Network activity
  • Performance data
  • Breadcrumbs
  • Custom events

Best Practices

  1. Start conservative: Low sample rates, high privacy
  2. Monitor costs: Replays can increase data volume significantly
  3. Respect privacy: Mask sensitive data by default
  4. Test thoroughly: Verify masking works as expected
  5. Use buffer mode: More efficient for error debugging
  6. Combine with performance: Get complete context
  7. Review regularly: Ensure no PII is captured
Privacy Checklist:
  • Mask all text inputs
  • Block sensitive media
  • Don’t capture auth tokens
  • Exclude third-party content
  • Review captured network data
  • Comply with GDPR/privacy laws

Troubleshooting

Replays Not Recording

High Memory Usage

Next Steps

Error Monitoring

Link replays with error events

Performance

Combine replays with performance data

Breadcrumbs

Track user actions in replays

User Feedback

Collect feedback during sessions