Session Replay
Record and replay user sessions to understand behavior, debug issues, and improve UX. Session replay is off by default. Turn it on with sessionReplay.enabled: true.
How It Works
- Event-based recording (not video) for smaller data footprint
- DOM snapshots + mouse movements + clicks + scrolls + form inputs
- Pixel-perfect replay of user interactions
- Automatic masking of sensitive data
Basic Configuration
Session replay is off by default. Turn it on and customize it in your init code:
WysLeap.init({
siteId: 'your-site-id',
options: {
_apiKey: 'your-api-key',
sessionReplay: {
enabled: true, // Enable/disable session replay
maskSensitive: true, // Auto-mask passwords, emails, etc.
sampleRate: 0.5 // Record 50% of sessions (default: 1.0, all)
}
}
});Privacy & Data Masking
Automatic Sensitive Data Masking
When maskSensitive: true, (the default), recordings mask:
- All input fields: typed values are never recorded
- Text inside elements marked with
class="sensitive",data-sensitiveordata-private
Custom Masking
Mark any element whose text should be masked with data-sensitive, data-private or class="sensitive". To leave an element out of recordings entirely, add class="rr-block".
<!-- Mask sensitive text content -->
<div data-sensitive>
User's SSN: 123-45-6789
</div>
<!-- Inputs are always masked while maskSensitive is on (the default) -->
<input type="text" placeholder="API Key" />
<!-- Leave an entire section out of the recording -->
<section class="rr-block">
<!-- Not recorded; shown as a placeholder in replays -->
</section>Text masking only applies while maskSensitive is on. If you set maskSensitive: false, inputs and marked text are recorded as-is.
Sampling (Reduce Costs)
Record a fraction of sessions to reduce data usage and costs:
sessionReplay: {
enabled: true,
sampleRate: 0.5 // Record 50% of sessions
}Note: Sampling is deterministic per session (same visitor always gets same decision).
Recording Controls
Toggle which event types are recorded. Disabling event types you don't need reduces data volume and storage costs.
sessionReplay: {
enabled: true,
// Event-type toggles
recordMousemove: false, // Mouse movement tracking (default: off)
recordClick: true, // Click events (default: on)
recordScroll: true, // Scroll events (default: on)
recordInput: true, // Form input changes (default: on)
recordMedia: true, // Media element events (default: on)
}Default Behavior
- recordMousemove is off by default. Mouse movements are typically the largest category of replay data and aren't needed for most click/scroll/funnel analysis. Enable it if you need mouse trail replay.
- All other event types are on by default. The full page is recorded unless you opt into element-level scoping (see next section).
Element-Level Scoping (Advanced, optional)
By default, WysLeap records the entire page. If you need to limit recording to a specific flow (for example, only capturing interactions inside a checkout form for compliance reasons), you can pass an allowlist of CSS selectors to recordElement.
recordElement is an allowlist, not a filter.
When set, the recorder captures only DOM mutations inside the matching elements. Everything outside is dropped, including the rest of the page's content. If your selectors don't match any elements on a given page, the replay for that page will be blank. Leave this unset (or use []) to record the entire page. That's the right choice for almost all customers.
sessionReplay: {
enabled: true,
// Default: record the full page (omit or leave empty)
recordElement: [],
// Advanced: scope recording to specific elements only.
// Use this ONLY when you need to limit replays to a specific flow
// (e.g., a checkout form) for privacy or compliance reasons.
// Anything outside these selectors will NOT appear in the replay.
// recordElement: ['#checkout-form', '.payment-section'],
}When recordElement is set but matches zero elements on a page, WysLeap will log a warning to the browser console naming the selectors, so check DevTools if your replays look empty.
Viewing Session Replays
Once session replay is enabled, you can view recordings in your analytics dashboard:
- Navigate to Analytics Dashboard
- Click on any visitor or session
- Click "Watch Replay" to see the full session recording
Next Steps
Need advanced configuration? Learn about privacy and consent settings, sampling, and more configuration options in Advanced Config.