ExpoReact
Home › Technical Guides › Observability
Observability

Session Replay and Privacy-First Masking in Unified Applications

Reconstruct user journeys to diagnose complex UI bugs while enforcing strict on-device PII redaction and sampling budgets.

How Mobile and Web Session Replay Capture Works

Unlike crash logs that capture only the final stack frame, session replay records a synchronized timeline of UI snapshots or DOM mutations alongside touch gestures, network timings, and console events. On the web, recorders serialize incremental DOM diffs; on native iOS and Android, recorders traverse the native view hierarchy or capture masked wireframe layouts.

This visual context eliminates guesswork when diagnosing multi-step state bugs—such as a disabled submit button hidden behind a soft keyboard or a layout race condition triggered by rapid double-taps—while keeping payload sizes compact compared to raw video.

On-Device Redaction and Zero-Trust Masking Rules

Privacy compliance requires that sensitive personal data never leaves the user's device—not even temporarily for server-side blurring. Default to a mask-all-text or strict allow-list posture for sensitive workflows, automatically obscuring password fields, payment forms, national identifiers, and private messages inside the native view tree prior to serialization.

Provide declarative masking attributes inside your shared design-system components so product engineers mark sensitive containers once and enforce uniform redaction across iOS, Android, and web. Pause capture completely on third-party payment or authentication WebViews.

Controlling CPU, Battery, and Bandwidth Overhead

Capturing view trees on every animation frame can steal precious milliseconds from the UI thread and drain mobile batteries. Production replay SDKs throttle snapshot intervals—such as 1 to 2 frames per second or on interaction boundaries—and pause telemetry uploads when devices operate on metered cellular connections or low battery mode.

Pair continuous in-memory ring-buffer recording with error-triggered uploads: keep only the last 30 to 60 seconds of masked interaction state in RAM and transmit the replay solely when an unhandled error, crash, or user-submitted support report occurs.

Consent, Retention Windows, and Audit Controls

Session replay intersects directly with privacy regulations such as GDPR and CCPA. Gate recorder initialization behind explicit user telemetry consent flags where applicable, honor mid-session opt-out toggles immediately by discarding buffered frames, and enforce short automated server retention windows such as 14 to 30 days.

Validate masking rules systematically during staging QA before every major release by inspecting sample replay recordings across onboarding, login, profile, and checkout screens to confirm zero plaintext PII leakage.

Session Replay Privacy & Performance Modes

Capture ModeData CapturedBandwidth / CPUBest Use Case
Mask-All-Text DefaultMasked blocks + tap structureLow CPU, tiny payloadFintech, healthcare, auth flows
Selective Input MaskPublic labels; inputs maskedLow–ModerateE-commerce & SaaS workflows
Error Ring BufferLast 45s uploaded on errorMinimal upload trafficHigh-scale production triage
Sampled Session (1–5%)Full masked session cohortModerateUX funnel & onboarding audits
Paused on SensitiveRecorder halted on checkoutZero overheadPCI-DSS / strict compliance

Privacy-first configuration tradeoffs for cross-platform session replay instrumentation.

Worked Illustration: Error-Triggered Bandwidth Budgeting

Illustrative scenario: An app with 100,000 daily sessions compares unconditional replay uploads against an error-triggered 45-second ring buffer.

  1. Step 1 (Illustrative full capture): Average 4-minute sessions emit ~280 KB compressed diffs; uploading 100% of 100,000 sessions costs 28.0 GB/day.
  2. Step 2 (Illustrative error rate): Assume 1.5% of sessions encounter an unhandled error or API 5xx failure (1,500 sessions/day).
  3. Step 3 (Illustrative ring buffer): Uploading only the final 45 seconds before each error (~65 KB) across 1,500 sessions totals 97.5 MB/day.
  4. Step 4 (Illustrative savings): Bandwidth drops by 99.6% while retaining 100% of error context and keeping all TextInput values masked on-device.

Engineering Takeaway: Error-buffered capture provides visual triage context at under 0.4% of the network and storage footprint.

Session Replay Privacy & Safety Checklist

  • Mask all password, email, token, and payment inputs automatically on-device.
  • Pause replay capture completely on third-party payment and auth WebViews.
  • Gate recorder initialization behind regional user consent preferences.
  • Throttle snapshot intervals and defer uploads during low-battery states.
  • Prefer error-triggered ring buffers or low sampling rates in production.
  • Audit staging replay recordings before every release to confirm zero PII leakage.

Frequently Asked Questions

Does mobile session replay record the device screen like screen-sharing?

No. Modern SDKs serialize masked view-tree structures rather than raw video, avoiding OS screen-recording prompts and keeping payloads tiny.

How do you prevent custom components from leaking sensitive text?

Attach shared masking attributes inside your design system so custom labels displaying account numbers or names inherit redaction automatically.

Can session replay slow down list scrolling?

Only if snapshots run synchronously during fast flings. Debounce snapshots until scroll settles or run view serialization asynchronously.

How long should session replays be retained?

Keep retention as short as operationally useful—typically 14 to 30 days—and align automated deletion with your privacy policy.

Primary References & Standards

  • GDPR Article 25 & Article 32 — Data Protection by Design and Default
  • OWASP Mobile Application Security Verification Standard (MASVS) — Data Storage & Privacy
  • PCI Security Standards Council — Scope Reduction & Sensitive Authentication Data Guidance

Related Technical Guides