Skip to main content

Session Replay

Session replay lets you watch exactly what a user saw and did — mouse movements, clicks, scrolls, and page changes — all reconstructed from recorded DOM events.

Enable replay

haya.init('YOUR_SDK_KEY', {
sessionReplay: true,
maskInputs: true, // Always recommended in production
});

How it works

Haya uses rrweb under the hood. Instead of recording a video, rrweb captures a series of DOM snapshots and mutations. When you play a replay in the dashboard, those events are replayed in a sandboxed iframe — reconstructing the exact DOM state the user saw.

This approach has major advantages over video:

  • Much smaller file size — a 40-second session is typically 50–200 KB, not MB
  • Text is selectable — you can copy content from the replay
  • Privacy-safe — sensitive elements can be masked at the DOM level

The 40-second cap

By default, replay recording stops after 40 seconds per session. Regular event tracking (clicks, scrolls, pageviews) continues indefinitely after the cap.

The cap exists to keep storage costs reasonable. A 40-second window is enough to understand what a user was doing when they hit a bug or dropped off.

To adjust the cap:

haya.init('YOUR_SDK_KEY', {
sessionReplay: true,
replayMaxDuration: 60, // seconds
});

The cap is enforced both client-side (rrweb stops recording) and server-side (backend rejects snapshots beyond the limit), so changing replayMaxDuration beyond your account plan's limit will have no effect.

Privacy and masking

haya.init('YOUR_SDK_KEY', {
sessionReplay: true,
maskInputs: true,
});

With maskInputs: true, every <input>, <textarea>, and <select> shows as *** in the replay. The user's actual data is never captured.

Mask specific elements

Add the haya-block class to any element you want to completely hide in replays:

<div class="haya-block">
<!-- This entire section will appear as a solid block in the replay -->
<p>{{ user.creditCardNumber }}</p>
</div>

Ignore elements from tracking entirely

haya.init('YOUR_SDK_KEY', {
ignoreSelectors: ['.sensitive-widget'],
});

Viewing replays

In your Haya dashboard, go to Sessions and click any session with a replay icon. Sessions without a completed replay are still listed — they just show Replay pending or No replay depending on their status.

A session replay goes through these statuses:

StatusMeaning
activeSession is in progress, replay being collected
replay_processing40s cap hit, uploading to storage
replay_readyReplay available to watch
completedSession ended without enough replay data

Storage

Replays are stored as NDJSON files (one rrweb event per line) in Cloudinary under Haya/replays/. The replayUrl on the session document points directly to the file. Replay files follow the same 90-day retention policy as all other analytics data.