Skip to main content

Recording modes

The replay system operates in three modes:

Trigger events

Replay transitions from BUFFER to RECORDING when one of these events occurs:
  • Error — an unhandled JavaScript error or console.error call
  • Widget open — the user opens the chat widget
This approach minimizes bandwidth — most sessions stay in buffer mode and never upload data.

Enabling replay

Session replay is controlled from the dashboard under Settings → Widget → Features. When enabled, the SDK automatically starts recording in buffer mode on initialization. No code changes are needed — the SDK reads the sessionReplay flag from your widget configuration.

Data handling

  • Batches are gzipped using the browser’s native CompressionStream API before upload
  • Uploads use widget JWT authentication (obtained during the widget auth handshake)
  • Batches include a sequence number for ordered playback
  • If the upload quota is exceeded (HTTP 402/429), recording stops automatically

Privacy & masking

The SDK applies these privacy defaults:

Masking specific elements

Add data-hb-mask to mask text content:
Add data-hb-block to exclude an element entirely:

GDPR opt-out

Call disableReplay() to permanently stop session replay for the current user:
This immediately stops rrweb recording, clears the buffer, and prevents replay from restarting — even on page reload (until destroy() + init() is called again). Use this to honor user privacy preferences or implement a “Do not record” toggle in your application.