Skip to main content
Pass a configuration object to SessionRecorder.init(). Only apiKey is required; every other option has a sensible default.

Core options

Privacy options

See Privacy and masking for how these behave and what is covered by default.

Delivery and session options

Callbacks

Runtime API

The recorder instance returned by init() exposes a small runtime API.

identify(userId, traits?)

Attach your own user ID and traits to the current session. See Identifying users.

track(eventName, properties?)

Record a custom event into the session timeline:
Custom events are stored alongside the replay events and carry the page URL and a timestamp. track() works as soon as recording has started, even before the network handshake completes.

flush()

Force-flush the current event buffer immediately instead of waiting for the next flushInterval.

takeSnapshot()

Force a fresh full DOM snapshot. You rarely need this: snapshots are taken automatically on init, on route changes, and periodically as checkpoints.

getSessionId()

Returns the current backend session ID, or undefined if the session has not been created yet.

getStats()

Returns a diagnostic snapshot: current session info, buffer stats, whether recording is active, error count, and circuit breaker state. Useful when debugging with debug: true.

destroy()

Stops recording, flushes remaining events, and tears the recorder down. A destroyed recorder cannot be restarted; create a new instance instead.