Esta página se muestra en inglés. Una traducción al español está en curso.
KnowledgeMay 8, 2026·4 min de lectura

PostHog Session Replay — Watch Users Hit Your AI Features

PostHog Session Replay records UI interactions, console logs, network requests. Watch what a user did before clicking your AI chat. PII auto-masked.

Listo para agents

Este activo puede ser leído e instalado directamente por agents

TokRepo expone un comando CLI universal, contrato de instalación, metadata JSON, plan según adaptador y contenido raw para que los agents evalúen compatibilidad, riesgo y próximos pasos.

Needs Confirmation · 64/100Política: confirmar
Superficie agent
Cualquier agent MCP/CLI
Tipo
Knowledge
Instalación
Single
Confianza
Confianza: New
Entrada
Asset
Comando CLI universal
npx tokrepo install 7398300f-ae4a-47af-8fd6-b9b986d7ca7a
Introducción

PostHog Session Replay records user interactions in your app — clicks, scrolls, console logs, network requests — playable as video. When a user reports 'the AI gave wrong answer', you replay their full session, see the prompt they typed, the model's reply, and what they did next. Best for: support and product teams debugging AI feature usability. Works with: web (JS SDK), iOS, Android, React Native. Setup time: 5 minutes.


Enable session replay

import posthog from "posthog-js";

posthog.init("phc_...", {
  api_host: "https://us.posthog.com",
  session_recording: {
    maskAllInputs: false,    // record what users type (mask in PII fields)
    maskTextSelector: ".pii", // anything with class="pii" is masked
    recordCrossOriginIframes: true,
    blockClass: "no-record",  // anything with class="no-record" is blocked
  },
});

posthog.identify("user_42", { plan: "pro" });

Capture LLM-specific context

// Annotate the recording with LLM events for richer playback timeline
posthog.capture("llm_call_started", {
  model: "claude-3-5-sonnet",
  prompt_length: 1234,
});

const response = await client.chat.completions.create(...);

posthog.capture("llm_call_completed", {
  model: "claude-3-5-sonnet",
  latency_ms: 1830,
  tokens: 450,
  user_satisfied: null,  // updated when user reacts
});

Filter recordings by AI events

PostHog → Session Replays → Filter:

  • Has event: llm_call_completed where model = claude-3-5-sonnet
  • And: error occurred within 30s after
  • And: user did NOT click positive feedback button

→ A queue of broken-experience replays for triage.

Privacy-first defaults

  • Password / credit-card / email fields auto-masked
  • Custom mask via maskTextSelector / data-private attribute
  • Block entire elements via blockClass
  • Cookie banner consent integration (recordings only start after consent)

What you'll catch

  • Users abandoning your AI chat after 30s of typing
  • Users reading the AI response then immediately searching elsewhere (signal: bad answer)
  • Crashes on specific browsers/OSes
  • Console errors that don't surface in your error tracker

FAQ

Q: Does session replay slow down my site? A: Negligible — recording happens in a Web Worker, payloads are gzipped and sent in batches. Typical overhead is <50ms on first paint and <2KB/min in network usage.

Q: Can users opt out? A: Yes — call posthog.opt_out_capturing() from your settings page or after a cookie banner decline. PostHog also respects DNT headers when configured.

Q: How long are recordings kept? A: Free tier 1 month, paid plans up to 1 year. Self-hosted is configurable. For long retention without cost, export recordings periodically via the API.


Quick Use

  1. posthog.init(...) with session_recording: { maskAllInputs: false }
  2. Add class="pii" to sensitive fields you want masked
  3. PostHog dashboard → Session Replays — filter by event / user / device

Intro

PostHog Session Replay records user interactions in your app — clicks, scrolls, console logs, network requests — playable as video. When a user reports 'the AI gave wrong answer', you replay their full session, see the prompt they typed, the model's reply, and what they did next. Best for: support and product teams debugging AI feature usability. Works with: web (JS SDK), iOS, Android, React Native. Setup time: 5 minutes.


Enable session replay

import posthog from "posthog-js";

posthog.init("phc_...", {
  api_host: "https://us.posthog.com",
  session_recording: {
    maskAllInputs: false,    // record what users type (mask in PII fields)
    maskTextSelector: ".pii", // anything with class="pii" is masked
    recordCrossOriginIframes: true,
    blockClass: "no-record",  // anything with class="no-record" is blocked
  },
});

posthog.identify("user_42", { plan: "pro" });

Capture LLM-specific context

// Annotate the recording with LLM events for richer playback timeline
posthog.capture("llm_call_started", {
  model: "claude-3-5-sonnet",
  prompt_length: 1234,
});

const response = await client.chat.completions.create(...);

posthog.capture("llm_call_completed", {
  model: "claude-3-5-sonnet",
  latency_ms: 1830,
  tokens: 450,
  user_satisfied: null,  // updated when user reacts
});

Filter recordings by AI events

PostHog → Session Replays → Filter:

  • Has event: llm_call_completed where model = claude-3-5-sonnet
  • And: error occurred within 30s after
  • And: user did NOT click positive feedback button

→ A queue of broken-experience replays for triage.

Privacy-first defaults

  • Password / credit-card / email fields auto-masked
  • Custom mask via maskTextSelector / data-private attribute
  • Block entire elements via blockClass
  • Cookie banner consent integration (recordings only start after consent)

What you'll catch

  • Users abandoning your AI chat after 30s of typing
  • Users reading the AI response then immediately searching elsewhere (signal: bad answer)
  • Crashes on specific browsers/OSes
  • Console errors that don't surface in your error tracker

FAQ

Q: Does session replay slow down my site? A: Negligible — recording happens in a Web Worker, payloads are gzipped and sent in batches. Typical overhead is <50ms on first paint and <2KB/min in network usage.

Q: Can users opt out? A: Yes — call posthog.opt_out_capturing() from your settings page or after a cookie banner decline. PostHog also respects DNT headers when configured.

Q: How long are recordings kept? A: Free tier 1 month, paid plans up to 1 year. Self-hosted is configurable. For long retention without cost, export recordings periodically via the API.


Source & Thanks

Built by PostHog. Licensed under MIT.

PostHog/posthog-js — ⭐ 1,500+

🙏

Fuente y agradecimientos

Built by PostHog. Licensed under MIT.

PostHog/posthog-js — ⭐ 1,500+

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados