Replay optionsBeta

Turn session replay on in code, choose a sample rate, and control masking.

What gets recorded, what is masked and where to watch replays is covered in Session replay. This page is the SDK side. Replay only runs in a browser.

Options

OptionTypeDefaultWhat it does
replay.enabledbooleanfollows the dashboardRecord sessions or not.
replay.sampleRatenumber0.1 when your code sets enabled; otherwise the dashboard’s rateShare of sessions to record, from 0 to 1.
replay.maskAllInputsbooleantrueRecord every form value as asterisks. Passwords are masked either way.

Whether a session is recorded is decided once, when the logger starts, and doesn’t change if you create the logger again on the same page.

Code or dashboard

  • If your code leaves replay.enabled out, the SDK asks Apperio for the project’s Settings › Session Replay choice when it starts. The answer is cached by the browser for 5 minutes. If the request fails, nothing is recorded.
  • If your code sets replay.enabled, that decides it and the dashboard switch is ignored.
  • A replay.sampleRate in your code always wins over the dashboard’s rate.

Examples

Record 10% of sessions, whatever the dashboard says:

TypeScript
import { Apperio } from 'apperio';

const logger = new Apperio({
  apiKey: 'your-api-key',
  projectId: 'your-project-id',
  replay: { enabled: true, sampleRate: 0.1 },
});

Never record from this app, even if the dashboard switch is on:

TypeScript
import { Apperio } from 'apperio';

const logger = new Apperio({
  apiKey: 'your-api-key',
  projectId: 'your-project-id',
  replay: { enabled: false },
});

Show what visitors type, except passwords (for example, a public search box):

TypeScript
import { Apperio } from 'apperio';

const logger = new Apperio({
  apiKey: 'your-api-key',
  projectId: 'your-project-id',
  replay: { enabled: true, maskAllInputs: false },
});

Think before unmasking inputs

With maskAllInputs: false, everything typed into non-password fields is recorded, including emails and card numbers. Mark sensitive fields with apperio-mask if you turn masking off.

Bundle size

The recorder and rrweb aren’t part of the main SDK bundle. They are loaded with a dynamic import() only when a session is chosen for recording, so bundlers put them in a separate chunk that unrecorded visitors never download.

Checking it is recording

logger.isReplayRecording() returns true once the recorder has loaded and started. It is false for a moment after the page loads, and stays false for sessions that weren’t sampled.