Docs / Session replay

Docs · By hand

Record what visitors saw and did

At the end your site records sessions, and every error on the issue page opens its recording at the moment it happened.

Before you start

You need a Vinktar project and @vinktarhq/browser 0.5.0 or later. A recording is the page's DOM and every change to it, captured with rrweb and rebuilt in the player. It is not video. A minute of activity usually comes to tens of kilobytes.

Set it up with your agent

Paste this into a coding agent with Vinktar connected. It asks what to record and what to hide before it changes anything, then checks that the first recording arrived.

Set up Vinktar session replay on this site, for the Vinktar project your-project.

1. Connect the Vinktar MCP server at https://mcp.vinktar.com/mcp and sign in when it asks. If you cannot add an MCP server, run `npx @vinktarhq/cli login` and use `vinktar call <tool> key=value` for every tool below.
2. Ask me before changing anything: whether to record every session, a share of them, or only sessions that hit an error or a named event; which pages must never be recorded; and which elements must never be seen (payment, health, account or other personal details). Inputs are masked by default; say so.
3. Call `get_install_guide` with section "replay" and follow it: add `replay()` from `@vinktarhq/browser/replay` beside `init`, with no options, and the write key from `get_project_keys`. Put `vk-block` on the elements I named. Never ask me to paste a key.
4. Call `configure_replay` with enabled true and what I chose: `sampleRate` (0 records only sessions with an error or a trigger event), `excludedPages`, `triggerEvents`, and `maskAllText` if I asked for text to be hidden.
5. Run the site, click and type for more than 5 seconds, then call `get_setup_status` and work down it until its session replay check says recordings arrive.

End with what you installed, the options you set and why, what is blocked or masked, and the link to the recordings.

1. Add the integration

import { init } from '@vinktarhq/browser';
import { replay } from '@vinktarhq/browser/replay';

init({ writeKey: 'vnk_pk_YOUR_KEY', integrations: [replay()] });

The replay code is about 25 kB and is only loaded when you import it. With the script tag, add data-replay and it loads from beside vinktar.min.js, at the same version.

<script
  src="https://unpkg.com/@vinktarhq/browser/dist/vinktar.min.js"
  data-key="vnk_pk_YOUR_KEY"
  data-replay
  defer
></script>

2. Choose what is recorded

These live in the project's settings under Session replay. The SDK reads them on each page load before it records anything, so a change needs no deploy. An agent changes them with configure_replay, and an option passed to replay() in your code wins over the setting.

SettingDefaultWhat it does
Accept recordingsOnOff refuses new recordings within a minute, and the SDK stops.
Sessions recorded from the start100%Decided once per session.
Other sessions recorded when an error happens100%They send the 60 seconds before the error, then the rest of the session.
Shortest recording sent5 secondsA recording started by an error is always sent.
MaskingInputsAll text masks every word on the page as well.
Pages never recordedNonePath patterns, with * as a wildcard.
Events that start a recordingNoneSuch as checkout_started, with the 60 seconds before it.

When a recording starts

  • From the first page view, for the share of sessions recorded from the start.
  • On an error, for every other session. The SDK keeps the last 60 seconds in memory and sends nothing until an exception is captured. That error then carries the recording's id. The 60 seconds survive a full page load in the same tab.
  • On one of the project's trigger events, the same way.

A recording belongs to one tab. It pauses after five minutes without input and ends with the session. To keep your page fast, it stops at 10,000 DOM changes in one go.

Masking and what is never recorded

Inputs are masked in the browser before anything is sent, and passwords always are. Page text is recorded as shown unless masking is set to All text. Mark anything else in your markup, as a class or as the data- attribute of the same name:

In your markupWhat it does
vk-blockRecords the element as an empty box of the same size.
vk-maskMasks the text inside it.
vk-unmaskShows the element again when masking is on.
vk-ignoreLeaves out what is typed into it.

Put vk-block on payment forms and on anything that shows health, financial or account details.

Nothing is recorded for a visitor who is cookieless, has not yet answered your cookie banner under cookielessMode: 'on_reject', or has opted out. An opt-out also drops what the SDK held in memory. Browsers without CompressionStream are not recorded.

Where recordings show up

  • On the issue page, a Replay tab opens the recording 5 seconds before the error, with the error marked on the timeline.
  • On Replays, filtered by user, page, length, errors, rage clicks and date. The ones you have not watched are marked.
  • From an event in Explore, a funnel step's drop-off, and one person's events.
  • For agents, get_replay reads a recording as a timeline: pages, clicks, typing (never what was typed), console lines, failed requests and errors.

Beside the player run the clicks, requests and console lines the SDK already collects, your product events, and rage and dead clicks. A rage click is one element clicked three times within a second. A dead click is a link or button that changes nothing for seven seconds.

Limits

Each plan includes a number of recordings a month and keeps them for a set number of days. The numbers are on the pricing page. A recording counts once, when its first part arrives. Past the plan's amount, recordings carry on to twice that, then stop until the next month. Events and errors are counted on their own and are not affected.

Recordings are stored in Helsinki with the rest of your data. Deleting a project deletes its recordings.

Next