
analyzing-experiment-session-replays
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. Also covers pairing the observed behavior with a linked survey when the user wants qualitative feedback beyond what recordings show.
- Installs
- 247
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/posthog/ai-plugin --skill analyzing-experiment-session-replays- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads analyzing-experiment-session-replays automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
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:
- The user asks to analyze session replays for an experiment
- The user wants to understand how users behave differently across experiment variants
- The user asks to compare user behavior between control and test variants
- The user wants qualitative insights to complement experiment metrics
- The user asks questions like "How are users behaving in my experiment?" or "Show me session replays for variant X"
Prerequisites
Before analyzing session replays:
- The experiment must be launched (not in draft state)
- Session replay must be enabled for the project
- Users must have been exposed to the experiment variants
- 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:
- Option A: Use the
experiment-gettool if you already have the experiment ID from context - Option B: Query the experiments table via HogQL:
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:
feature_flag_key: The feature flag controlling the experimentstart_dateandend_date: The experiment's time range
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:
- The
$feature/<flag_key>event property records the flag's value on each event — filtering on it matches recordings where the flag was active with that variant. This is an approximation of exposure, broader than the experiment's exposure event ($feature_flag_called, or$experiment_exposureon the new rollout — both deduped per identity): right for browsing behavior across variants, but not an exact mirror of the analysis population — thescanning-experiments-with-replay-visionskill derives that exact filter when you need it valueis an array of variant key strings (e.g.["control"]); for boolean flags use["true"]or["false"]- Avoid the
type: "flag"/flag_evaluates_toproperty 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 recordings - Set the date range to the experiment's start and end dates
- Enable
filter_test_accounts: trueto exclude test users
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:
- Variant "control" → recordings for control group
- Variant "test" → recordings for test variant
- Additional variants if the experiment has more than 2
The tool returns a list of recordings with metadata including:
distinct_id— the person's distinct IDrecording_duration,active_seconds,inactive_secondsclick_count,keypress_count,mouse_activity_countconsole_log_count,console_warn_count,console_error_countstart_url— first page URL visitedstart_time/end_time,activity_score
4. Compare and analyze
Compare the recordings between variants by looking for:
Quantitative patterns:
- Session duration differences
- Activity levels (clicks, keypresses)
- Console error rates
- Bounce rates
Qualitative insights:
- User confusion or frustration indicators
- Different navigation paths
- Feature discovery patterns
- Error recovery behavior
5. Present findings
Summarize the behavioral differences between variants, highlighting:
- Total recordings per variant
- Notable behavior patterns unique to each variant
- Usability issues or friction points observed
- Recommendations based on the qualitative data
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 references/qualitative-feedback.md 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:
- Always verify the experiment has recordings before analyzing
- Check that the experiment is launched (has a start_date)
- If no recordings are found, inform the user clearly
Filter construction:
- The
$feature/<flag_key>event property is how you scope recordings to a variant - One filter per variant — call the tool once per variant with its own filter
- For boolean flags, use
["true"]/["false"]as the value instead of a variant key
Error handling:
- If the experiment is in draft state, tell the user it hasn't started yet
- If no recordings exist, suggest enabling session replay or waiting for user traffic
- If the variant count is unexpected, double-check the experiment configuration
Related tools
query-session-recordings-list: Core tool for retrieving session recordings with filtersexperiment-get: Get experiment metadata;experiment-results-getfor statistical resultsexecute-sql: Query experiments table for details via HogQL
Related skills
diagnosing-experiment-health— the quantitative side: bias checks and significance on the same experimentinvestigating-replay— deep-dive a single session from either variantfinding-sessions-to-watch— general session shortlisting outside the experiment context
FAQ
What does the analyzing-experiment-session-replays skill do?
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. Also covers pairing the observed behavior with a linked survey when the user wants qualitative feedback beyond what recordings show.
How do I install analyzing-experiment-session-replays?
Run npx skills add https://github.com/posthog/ai-plugin --skill analyzing-experiment-session-replays in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/analyzing-experiment-session-replays/ (personal) or .claude/skills/analyzing-experiment-session-replays/ (project).
Which AI agents can use analyzing-experiment-session-replays?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is analyzing-experiment-session-replays safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains analyzing-experiment-session-replays?
It is published by posthog in posthog/ai-plugin, and it is an official skill from the maker of the technology it covers. It has 247 recorded installs.
More from posthog/ai-plugin
instrument-product-analytics
posthog/ai-plugin
Add PostHog product analytics events to track user behavior. Use after implementing new features or reviewing PRs to ensure meaningful user actions are captured. Also handles initial PostHog SDK setup if not yet installed.
instrument-feature-flags
posthog/ai-plugin
Add PostHog feature flags to gate new functionality. Use after implementing features or reviewing PRs to ensure safe rollouts with feature flag controls. Also handles initial PostHog SDK setup if not yet installed.
cleaning-up-stale-feature-flags
posthog/ai-plugin
Identify stale feature flags in a PostHog project and clean up the code that checks them. Use when the user wants to find, audit, or remove unused, fully rolled out, or abandoned feature flags, run a feature flag hygiene review or a weekly cleanup, reduce feature flag tech debt, or asks "which flags can I remove?". When the agent can read and edit a repository it performs the code cleanup itself: tested local changes, and one draft PR per flag when the user authorizes publishing. Agents without repository access generate a tailored cleanup prompt instead. Covers staleness detection, dependency checking, retained-path rules, and the code-first ordering. This skill does not archive or otherwise change a flag in PostHog.
auditing-experiments-flags
posthog/ai-plugin
Audit PostHog experiments and feature flags for configuration issues, staleness, and best-practice violations. Read when the user asks to audit, health-check, or review experiments or feature flags, check flag hygiene, or verify experiment setup.
querying-posthog-data
posthog/ai-plugin
Explains how to query PostHog data, defaulting to typed runners for supported product analytics. Read it before you write HogQL/SQL. Also read it before you call execute-sql against PostHog. Use it to find or aggregate PostHog entities. These entities include insights, dashboards, cohorts, feature flags, experiments, surveys, hog flows, warehouse data, and persons. Use it for trends, funnels, retention, lifecycle, paths, stickiness, web analytics, error tracking, logs, sessions, and LLM traces. Before you calculate a governed business or telemetry measure, check system.informationschema.metrics for an approved definition. Examples include MRR, activation, billable usage, active organizations, and failure rates. Use the approved definition before you derive a measure from raw events or use a typed domain tool. It also covers HogQL differences, system table schemas, functions, query examples, and schema discovery.
creating-experiments
posthog/ai-plugin
Guides agents through experiment creation: reading the project's setup with experiment-setup-context, defining the hypothesis, configuring rollout and bucketing, setting up analytics and running time, and reporting which choices are guesses. Delegates rollout decisions to configuring-experiment-rollout and metric setup to configuring-experiment-analytics. TRIGGER when: user asks to create a new experiment or A/B test, OR when you are about to call experiment-create. DO NOT TRIGGER when: user is updating an existing experiment, managing lifecycle, or only browsing experiments.
Popular testing & qa skills
tdd
mattpocock/skills
Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
grilling
mattpocock/skills
Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.
migrate-to-shoehorn
mattpocock/skills
Migrate test files from as type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace as in tests, or needs partial test data.
run-train
lllllllama/rigorpilot-skills
Rigor Train skill for deep learning research repositories. Use when a documented or selected training command should be run conservatively for startup verification, short-run verification, full kickoff, or resume, with command, config, seed, log, checkpoint, status, and metric evidence written to standardized trainoutputs/. Do not use for environment setup, exploratory sweeps, speculative idea implementation, or end-to-end orchestration.
test-driven-development
obra/superpowers
Use when implementing any feature or bugfix, before writing implementation code
finishing-a-development-branch
obra/superpowers
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work