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
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:Blocking Elements
Completely block elements from being recorded:Unmasking Elements
Unmask specific elements whenmaskAllText is enabled:
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:Performance Impact
Optimization Tips
- Use buffer mode: Only record when errors occur
- Lower sample rates: Record fewer sessions
- Block media: Reduce data capture size
- Mask text: Use CSS masking instead of JS
- Limit network detail: Only capture essential APIs
Example Configurations
Development
Production
E-commerce
Viewing Replays
Replays appear in the Sentry UI:- Issues: Linked to error events
- Replays Tab: Browse all recorded sessions
- Performance: Associated with transactions
- Visual recording of the session
- Console logs
- Network activity
- Performance data
- Breadcrumbs
- Custom events
Best Practices
- Start conservative: Low sample rates, high privacy
- Monitor costs: Replays can increase data volume significantly
- Respect privacy: Mask sensitive data by default
- Test thoroughly: Verify masking works as expected
- Use buffer mode: More efficient for error debugging
- Combine with performance: Get complete context
- Review regularly: Ensure no PII is captured
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