Skip to main content

Overview

Session recording captures everything users do on your site—clicks, scrolls, mouse movements, and DOM changes—so you can replay sessions and understand exactly what happened. This is invaluable for debugging issues, improving UX, and understanding user behavior. MentiQ SDK uses rrweb for high-fidelity session recording with built-in privacy controls.

Installation

1

Install Dependencies

Install the MentiQ SDK and rrweb:
2

Enable Recording

Set enableSessionRecording: true in your analytics config:
Recording starts automatically when the SDK initializes if enableSessionRecording is enabled.
3

View Recordings

Access session recordings in your MentiQ dashboard. Each session includes:
  • Full replay of user interactions
  • Timeline scrubbing
  • Session metadata (duration, URL, user ID)
  • Associated events and errors

Manual Control

Control recording programmatically with the useAnalytics hook:

Privacy & Data Masking

Session recordings can capture sensitive user data. Use privacy controls to protect user information and ensure GDPR/CCPA compliance.

Automatic Input Masking

By default, all input values are masked. This can be customized:

Privacy CSS Classes

Use these CSS classes to control what gets recorded:

Block Elements (Default: mentiq-block)

Completely blocks an element from recording:

Mask Text (Default: mentiq-mask)

Masks text content while preserving layout:

Ignore Elements (Default: mentiq-ignore)

Skips recording this section entirely:

Example: Protecting Sensitive Forms

Configuration Options

Customize recording behavior:

Configuration Reference

Upload & Storage

Automatic Upload

Recordings are automatically uploaded to your backend:
  • Upload Frequency: Every 10 seconds
  • Endpoint: POST /api/v1/sessions/:session_id/recordings
  • Final Upload: When recording stops or max duration is reached
From src/session-recording.ts:211-280:

Upload Payload

Use Cases

Debug User-Reported Issues

Record Critical User Flows

Conditional Recording

Only record sessions for specific users or scenarios:

Performance Considerations

Session recording is optimized for minimal performance impact:
  • Events are batched and compressed
  • Mouse movements and scrolls are sampled, not recorded continuously
  • DOM mutations are efficiently captured using MutationObserver
  • Typical overhead: less than 1% CPU, less than 5MB memory

Reduce Recording Size

For better performance on high-traffic sites:

Compliance

GDPR/CCPA Requirements:
  • Inform users about session recording in your privacy policy
  • Provide opt-out mechanisms
  • Use privacy classes to mask sensitive data
  • Consider requiring explicit consent before recording
  • Implement data retention policies

Troubleshooting

Recording Not Starting

  1. Verify rrweb is installed: npm list rrweb
  2. Check for console errors with debug: true
  3. Ensure enableSessionRecording: true is set

Missing Styles in Replay

Set inlineStylesheet: true to include CSS in recordings:

High Memory Usage

Reduce maxDuration or increase checkoutEveryNms to limit event accumulation.