Analyzing experiment session replays

From PostHog/skills · View interactive version

Analyzing experiment session replays is an AI agent skill from the GitHub repository PostHog/skills. Analyze session replay patterns across experiment variants to understand user behavior differences. Use when the user wants to see how users interact with different experiment variants, identify usability issues, compare behavior patterns between control and test groups, or get qualitative insights

How to use this skill

Skill file

Analyzing experiment session replays

This skill guides you through analyzing session recordings for experiment variants to understand behavioral differences between control and test groups.

When to use this skill

Use this skill when:

Prerequisites

Before analyzing session replays:

  1. The experiment must be launched (not in draft state)
  2. Session replay must be enabled for the project
  3. Users must have been exposed to the experiment variants
  4. The experiment must have a start date

Workflow

1. Get experiment details and feature flag variants

First, retrieve the experiment information and the feature flag variants (source of truth).

Step 1a: Get experiment metadata

You can either:

SELECT
    e.id,
    e.name,
    f.key AS feature_flag_key,
    e.start_date,
    e.end_date
FROM system.experiments e
JOIN system.feature_flags f ON f.id = e.feature_flag_id
WHERE e.id = <experiment_id>

From the experiment data, extract:

Step 1b: Get variants from the feature flag

IMPORTANT: Always get variants from the feature flag, NOT from experiment.parameters.feature_flag_variants.

The parameters can be out of sync or deprecated. The feature flag is the source of truth.

Query the feature flag to get the current variants:

SELECT filters.multivariate.variants AS variants
FROM system.feature_flags
WHERE key = '<feature_flag_key>'

Select the variants path directly — selecting the whole filters object gets truncated in results for flags with large targeting configs.

Example structure: [{"key": "control", "name": "Control", "rollout_percentage": 50}, {"key": "test", ...}]

The variant key values (e.g., "control", "test", "variant_a") are what you'll use to filter session recordings.

2. Build session recording filters for each variant

For each variant in the experiment, construct recording filters that match users exposed to that variant.

Filter structure for a variant (input to query-session-recordings-list):

{
  "date_from": "<experiment.start_date>",
  "date_to": "<experiment.end_date or current time>",
  "filter_test_accounts": true,
  "properties": [
    {
      "type": "event",
      "key": "$feature/<feature_flag_key>",
      "operator": "exact",
      "value": ["<variant_key>"]
    }
  ]
}

Key points:

3. Retrieve recordings for each variant

Use the query-session-recordings-list tool with the filters constructed in step 2.

Call the tool once per variant to get recordings for each group:

The tool returns a list of recordings with metadata including:

4. Compare and analyze

Compare the recordings between variants by looking for:

Quantitative patterns:

Qualitative insights:

5. Present findings

Summarize the behavioral differences between variants, highlighting:

6. Observing shows behavior; asking adds what users think of it

Watching sessions and asking users are different instruments, not substitutes. Recordings show what people

did with the change; a short survey, shown when they finish the experimented flow, captures what they

thought of it — a rating and an optional comment, readable per variant. For a user-facing change of real size, the two

together make a fuller qualitative read than either alone, so mention the option when the behavioral

comparison in step 4 leaves opinion unaccounted for, or when a pattern in the recordings is a hypothesis

worth checking with the people who produced it. Once per conversation at most; drop it if declined.

Default to asking every exposed user rather than one variant: a popover shown to only one arm is itself a

difference between the arms, and the response event carries the variant anyway, so the split survives.

→ See CODE0 in [[diagnosing-experiment-health]]

Example interaction

User: "How are users behaving in my checkout experiment?"
Agent steps:
1. Query experiment details (ID: 123, feature_flag_key: "checkout-flow-test", date range: 2025-01-01 to 2025-01-31)
2. Query feature flag "checkout-flow-test" to get variants from filters.multivariate.variants
3. Extract variant keys: "control" and "new-checkout"
4. Build filters for control variant:
   - Property filter: { type: "event", key: "$feature/checkout-flow-test", operator: "exact", value: ["control"] }
   - Date range: 2025-01-01 to 2025-01-31
5. Call query-session-recordings-list with control filters → 147 recordings found
6. Build filters for new-checkout variant and call query-session-recordings-list → 152 recordings found
7. Compare patterns:
   - Control: Average 3m 45s session duration, 12% console errors
   - New-checkout: Average 2m 30s session duration, 5% console errors
8. Present findings:
   "I analyzed session replays for your checkout experiment. The new checkout flow shows:
   - 33% faster completion (2m 30s vs 3m 45s)
   - 58% fewer console errors (5% vs 12%)
   - Users in the new variant navigate directly to payment, while control users often backtrack to review cart
   - Recommendation: The new checkout flow reduces friction and errors"

Important notes

Do not make assumptions:

Filter construction:

Error handling:

Related tools

Related skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.