Skip to content

Session replay

Record what visitors saw and did, with field values, passwords and scripts never recorded. Off until you turn it on.

A recording is the page a visitor saw, rebuilt in your browser from the changes the recorder sent: the page, every change to it, the pointer, clicks, scrolling, the window size and typing as its length. It plays on the Replay screen, next to the session it belongs to. Nothing is sent anywhere to play it.

Turning it on

Replay is off for every site. Two things turn it on, and both are needed:

  1. The switch. In Settings → Tracking setup, under Session replay, turn on Record sessions and save.
  2. The attribute. Add data-replay to the script tag. The snippet on the same screen includes it while the switch is on.
html
<script defer data-site="1" data-replay src="/mf.js"></script>

With the npm package, pass replay: true to init().

The tracker then loads the replay plugin. Before it records anything, the plugin asks GET /api/track/replay whether this visit is recorded. When the answer is no, it does nothing more.

Turn the switch off and the server refuses every recording at once, also from pages whose tag still asks for one. The tag then costs each page one small request, so remove the attribute too.

Who is recorded

  • People only. A visit the bot check does not call human is never recorded.
  • A share of visitors. Visitors recorded is a percent, 100 by default. The server draws it from the visitor hash, so it holds for every page a visitor opens that day and is drawn again the next day. Nothing is stored to make it.
  • The tracker’s own gates. Opt-out, data-sample, data-exclude and data-respect-dnt apply as they do to a pageview. A page the tracker does not report is not recorded. When a single-page app goes to such a page, the recording pauses, and it starts again with a new snapshot on the next page the tracker reports.

What is never recorded

These rules apply in the browser, before anything is sent. No setting turns them off.

  • Field values. A text field or a text area is recorded as *, one per character, and typing is recorded as its length only. A password field and a hidden field have no value at all. For a checkbox, a radio button, a select and a file field, the choice is not recorded.
  • Scripts. A <script> or <noscript> element is recorded as an empty comment. Its content and its attributes are not kept.
  • Inline event handlers (onclick and the rest) and javascript: links.
  • Embedded pages. An iframe, frame, object or embed is recorded as an empty box of the same size.

Blocking and masking your own elements

html
<div data-mf-block>…</div>   <!-- or class="mf-block": an empty box of the same size -->
<div data-mf-mask>…</div>    <!-- the text becomes *, the layout stays -->
  • Blocked elements are recorded as an empty box. Nothing inside them is recorded: no text, no changes, no typing. A click inside one is recorded as a click on the box.
  • Masked elements keep their layout, and each character of their text but white space becomes *. The title, alt, placeholder and aria-* label attributes are masked too. Anything a visitor can edit (contenteditable, a text area) is always masked.

Masking all text

Turn on Mask all text in the settings to mask every text on every page. To do it from the tag instead, for one deployment or one set of pages, add data-replay-mask-text:

html
<script defer data-site="1" data-replay data-replay-mask-text src="/mf.js"></script>

Either one is enough. Stylesheets are not text and stay as they are.

Addresses

The page address in a recording is the address the tracker reports, so data-mask and data-strip-query apply to it. Link targets inside the page are recorded as they are written. If a link target carries an identifier, mask or block the element that holds it.

What the player needs

Stylesheets that the page can read are copied into the recording, with their url() references made absolute, so the player draws the page without asking your site for its CSS. A stylesheet from another origin that does not allow it to be read keeps its address, and the player loads it from there. Images and fonts are loaded from their addresses too.

The recorder does not record the content of a shadow root, a canvas or a video, or a stylesheet a page adopts without an element.

Limits

Limit Value
Longest recording of one page view 60 minutes
No input (pointer, keys, scrolling, typing) 30 minutes ends the recording
Frames per page view 20,000
Data per page view 8 MB
One frame 2 MB
Data per session, on the server 32 MB
Pointer positions one per 50 ms, sent every 500 ms
Scrolling one reading per box per 100 ms
Batches every 5 seconds, on page hide, and early at 48 KB

When a page view reaches a limit, its recording stops there. A recording with a gap in it cannot be played, so the recorder does not skip and continue. A page whose first snapshot is over 2 MB sends nothing.

A recording belongs to the session of the visit, the same session the visit’s pageviews belong to. A frame that arrives when the visit has no session is dropped: a recording never starts or extends a session, so turning replay on does not change how many sessions a site has.

The plugin is a separate file of about 4 KB gzipped. The 3 KB core does not grow.

Retention

Recordings expire on their own clock, 30 days by default, set with MICAFORGE_REPLAY_RETENTION_DAYS. It is separate from the event retention on purpose: one recorded session outweighs a month of events on disk. An admin can erase one recording from the player, and erasing a visitor erases their recordings.

The wire format

For proxies and for anybody who reads the traffic:

http
GET  /api/track/replay?s=1&u=<page>&a=<automation>
     200 { "data": { "record": true, "mask_text": false } }

POST /api/track/replay
     { "s": 1, "u": "https://example.com/pricing", "v": "0.1.0", "q": 0,
       "f": [ { "type": 4, "timestamp": 1790000000000, "data": { "href": "…", "width": 1280, "height": 720 } },
              { "type": 2, "timestamp": 1790000000004, "data": { "node": { … }, "initialOffset": { "left": 0, "top": 0 } } } ] }
     204

The frames are rrweb-compatible events: meta (4), full snapshot (2) and incremental (3) with sources mutation (0), mouse move (1), mouse interaction (2), scroll (3), viewport resize (4) and input (5). q is the page’s number of the first frame, which orders frames that share a millisecond. Both routes sit under /api/track, so a proxy that forwards the tracker forwards them too.