@spotify-confidence/session-recording. Recordings supports
web browsers only.
For the end-to-end setup, including roles and recording policies, see
record user sessions.
Install
Initialize the Recorder
clientSecretis a browser client secret for the environment you want to record.appVersionstores an application version or commit hash on the recording.contextholds custom dimensions. Confidence uses context to evaluate recording rules before capture starts, and you can filter recordings by it. Don’t add direct personal identifiers, access tokens, or secrets to context.
initSessionRecorder always returns a recorder and doesn’t throw setup errors to the application.
The SDK masks input values by default. Review privacy and data masking
before you enable recording in a production environment.
Configuration Options
sanitize options before you enable them.
Capture Modes
Inautomatic mode, the default, the SDK starts capture when the session matches an active recording
rule.
Use manual mode to control when recording starts, for example after the user gives consent. start()
applies the same rule, allocation, and sampling checks as automatic mode, so Confidence can still skip
the session.
Recorder API
See custom data for how to use tags and measurements.
Debug Logs
Pass a logger while you set up the SDK:[CSR].
To turn on logging without changing code, run this in the browser console and reload the page:
sessionStorage.removeItem('CSR_DEBUG').
Content Security Policy
The SDK uploads data from a Web Worker. If your site uses a Content Security Policy, allow these directives:
If your policy blocks both
data: and blob:, copy the worker file to your static assets and pass its
URL:
WORKER MISMATCH
warning through debugLogger.

