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 to complement quantitative experiment results.
Add this skill
npx mdskills install PostHog/analyzing-experiment-session-replays@PostHog? Sign in with GitHub to claim this listing.Comprehensive session replay analysis with precise filtering logic and actionable steps
1---2name: analyzing-experiment-session-replays3description: '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 to complement quantitative experiment results.'4---56# Analyzing experiment session replays78This skill guides you through analyzing session recordings for experiment variants to understand behavioral differences between control and test groups.910## When to use this skill1112Use this skill when:1314- The user asks to analyze session replays for an experiment15- The user wants to understand how users behave differently across experiment variants16- The user asks to compare user behavior between control and test variants17- The user wants qualitative insights to complement experiment metrics18- The user asks questions like "How are users behaving in my experiment?" or "Show me session replays for variant X"1920## Prerequisites2122Before analyzing session replays:23241. The experiment must be **launched** (not in draft state)252. Session replay must be enabled for the project263. Users must have been exposed to the experiment variants274. The experiment must have a start date2829## Workflow3031### 1. Get experiment details and feature flag variants3233First, retrieve the experiment information and the feature flag variants (source of truth).3435**Step 1a: Get experiment metadata**3637You can either:3839- **Option A**: Use the `experiment-get` tool if you already have the experiment ID from context40- **Option B**: Query the experiments table via HogQL:4142```sql43SELECT44 e.id,45 e.name,46 f.key AS feature_flag_key,47 e.start_date,48 e.end_date49FROM system.experiments e50JOIN system.feature_flags f ON f.id = e.feature_flag_id51WHERE e.id = <experiment_id>52```5354From the experiment data, extract:5556- `feature_flag_key`: The feature flag controlling the experiment57- `start_date` and `end_date`: The experiment's time range5859**Step 1b: Get variants from the feature flag**6061**IMPORTANT**: Always get variants from the feature flag, NOT from `experiment.parameters.feature_flag_variants`.62The parameters can be out of sync or deprecated. The feature flag is the source of truth.6364Query the feature flag to get the current variants:6566```sql67SELECT filters.multivariate.variants AS variants68FROM system.feature_flags69WHERE key = '<feature_flag_key>'70```7172Select the variants path directly — selecting the whole `filters` object gets truncated in results for flags with large targeting configs.73Example structure: `[{"key": "control", "name": "Control", "rollout_percentage": 50}, {"key": "test", ...}]`7475The variant `key` values (e.g., "control", "test", "variant_a") are what you'll use to filter session recordings.7677### 2. Build session recording filters for each variant7879For each variant in the experiment, construct recording filters that match users exposed to that variant.8081**Filter structure for a variant** (input to `query-session-recordings-list`):8283```json84{85 "date_from": "<experiment.start_date>",86 "date_to": "<experiment.end_date or current time>",87 "filter_test_accounts": true,88 "properties": [89 {90 "type": "event",91 "key": "$feature/<feature_flag_key>",92 "operator": "exact",93 "value": ["<variant_key>"]94 }95 ]96}97```9899**Key points:**100101- The `$feature/<flag_key>` event property records which variant the user saw — filtering on it matches recordings containing at least one event from that variant102- `value` is an array of variant key strings (e.g. `["control"]`); for boolean flags use `["true"]` or `["false"]`103- Avoid the `type: "flag"` / `flag_evaluates_to` property filter for variant scoping — the recordings query accepts it but silently ignores it, returning unfiltered results (last verified 2026-06-10). If you want to try it anyway, verify it actually filters first: a query with a nonexistent flag key should return zero recordings104- Set the date range to the experiment's start and end dates105- Enable `filter_test_accounts: true` to exclude test users106107### 3. Retrieve recordings for each variant108109Use the `query-session-recordings-list` tool with the filters constructed in step 2.110111Call the tool once per variant to get recordings for each group:112113- Variant "control" → recordings for control group114- Variant "test" → recordings for test variant115- Additional variants if the experiment has more than 2116117The tool returns a list of recordings with metadata including:118119- `distinct_id` — the person's distinct ID120- `recording_duration`, `active_seconds`, `inactive_seconds`121- `click_count`, `keypress_count`, `mouse_activity_count`122- `console_log_count`, `console_warn_count`, `console_error_count`123- `start_url` — first page URL visited124- `start_time` / `end_time`, `activity_score`125126### 4. Compare and analyze127128Compare the recordings between variants by looking for:129130**Quantitative patterns:**131132- Session duration differences133- Activity levels (clicks, keypresses)134- Console error rates135- Bounce rates136137**Qualitative insights:**138139- User confusion or frustration indicators140- Different navigation paths141- Feature discovery patterns142- Error recovery behavior143144### 5. Present findings145146Summarize the behavioral differences between variants, highlighting:147148- Total recordings per variant149- Notable behavior patterns unique to each variant150- Usability issues or friction points observed151- Recommendations based on the qualitative data152153## Example interaction154155```text156User: "How are users behaving in my checkout experiment?"157Agent steps:1581. Query experiment details (ID: 123, feature_flag_key: "checkout-flow-test", date range: 2025-01-01 to 2025-01-31)1592. Query feature flag "checkout-flow-test" to get variants from filters.multivariate.variants1603. Extract variant keys: "control" and "new-checkout"1614. Build filters for control variant:162 - Property filter: { type: "event", key: "$feature/checkout-flow-test", operator: "exact", value: ["control"] }163 - Date range: 2025-01-01 to 2025-01-311645. Call query-session-recordings-list with control filters → 147 recordings found1656. Build filters for new-checkout variant and call query-session-recordings-list → 152 recordings found1667. Compare patterns:167 - Control: Average 3m 45s session duration, 12% console errors168 - New-checkout: Average 2m 30s session duration, 5% console errors1698. Present findings:170 "I analyzed session replays for your checkout experiment. The new checkout flow shows:171 - 33% faster completion (2m 30s vs 3m 45s)172 - 58% fewer console errors (5% vs 12%)173 - Users in the new variant navigate directly to payment, while control users often backtrack to review cart174 - Recommendation: The new checkout flow reduces friction and errors"175```176177## Important notes178179**Do not make assumptions:**180181- Always verify the experiment has recordings before analyzing182- Check that the experiment is launched (has a start_date)183- If no recordings are found, inform the user clearly184185**Filter construction:**186187- The `$feature/<flag_key>` event property is how you scope recordings to a variant188- One filter per variant — call the tool once per variant with its own filter189- For boolean flags, use `["true"]`/`["false"]` as the value instead of a variant key190191**Error handling:**192193- If the experiment is in draft state, tell the user it hasn't started yet194- If no recordings exist, suggest enabling session replay or waiting for user traffic195- If the variant count is unexpected, double-check the experiment configuration196197## Related tools198199- `query-session-recordings-list`: Core tool for retrieving session recordings with filters200- `experiment-get`: Get experiment metadata; `experiment-results-get` for statistical results201- `execute-sql`: Query experiments table for details via HogQL202
Full transparency — inspect the skill content before installing.