Overview
replayIntegration records what the user sees — DOM changes, mouse movement, scrolling, input — with rrweb, so you can watch the session leading up to an error instead of reconstructing it from logs. Every event sent from the page is tagged with the replay.id context, which links an issue to its replay on the dashboard.
A session is recorded in one of two modes:
- Full session — with probability
sessionSampleRate, the whole session is uploaded from the start, in segments everyflushIntervalms. - On error — every other session is only buffered in memory, keeping the last
checkoutEveryNmsms or so. When an exception is captured, with probabilityonErrorSampleRatethe buffer is uploaded and recording continues from there on. Sessions without errors never leave the browser.
Usage
ts
import { use } from '@buglapse/browser'
import { replayIntegration } from '@buglapse/browser/integrations'
use(replayIntegration({
sessionSampleRate: 0.1,
onErrorSampleRate: 1,
}))Privacy
All <input> values are masked by default (maskAllInputs). To hide more of the page, add a class to the elements themselves:
html
<div class="buglapse-block">Not recorded at all — shown as an empty placeholder</div>
<p class="buglapse-mask">Text is recorded as asterisks</p>Options
| Option | Type | Default | Description |
|---|---|---|---|
sessionSampleRate | number | 0.1 | Share of sessions (0–1) recorded from the start |
onErrorSampleRate | number | 1 | Chance (0–1) that an exception starts uploading a buffered session |
flushInterval | number | 5000 | How often, in ms, a recording session uploads a segment |
maxSegmentEvents | number | 300 | Upload a segment early once it holds this many rrweb events |
checkoutEveryNms | number | 30000 | How often, in ms, a full DOM snapshot is taken; also bounds how far back an on-error replay reaches |
maskAllInputs | boolean | true | Mask the values of all form inputs |
blockClass | string | 'buglapse-block' | Class that excludes an element from the recording |
maskTextClass | string | 'buglapse-mask' | Class that masks an element's text |
recordCanvas | boolean | true | Record <canvas> content; without it canvases replay blank |
canvasFps | number | 4 | Frame rate canvas content is captured at |
rrweb is a sizeable dependency — import replayIntegration only in apps where you actually use it.