simulate-returning-user
What it does
This skill sends simulated multi-page visits in one browser session and checks PostHog events on each page. It is for developers who want to confirm that a visitor's activity is linked together correctly.
When to use it
- ✓When you want to confirm that the same user ID is kept across page views.
- ✓When you want to check that a pageview is recorded on every page, not just the first.
- ✓When people report that one visitor's activity is split across several users.
Skill link
https://github.com/PostHog/posthog/blob/master/tools/traffic-sim/skills/simulate-returning-user/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Please simulate a visitor browsing three pages on our site and check that PostHog links all three pageviews to one user.”
5 new skills a week. 1 minute to read.
How it works
The agent runs one browser session that keeps cookies and storage between page views, so the visit behaves like a person browsing. It reports the events and the user ID, then confirms whether each pageview was captured.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Simulate returning-user traffic
Drives a single browser context across N page views (cookies and localStorage persist), navigating between pages and reporting which PostHog events fired. This matches the behavior of a single visitor browsing multiple pages on the same site.
When to use
- Confirm that PostHog reuses the same
distinct_idacross page views in a session (no fresh anonymous IDs per page). - Confirm
$pageviewfires on every page view, not just the first. - Reproduce "session not stitching" or "events split across multiple users" reports.
How to invoke
Call the simulate_returning_user MCP tool with:
url(required) — the page to visit each iteration.page_views(default3) — number of page views in the session.interval(default5.0) — seconds between page views.posthog_host(defaulthttps://us.i.posthog.com).
To exercise multi-page navigation, call the tool once per URL — the cookies
won't carry across calls (each call is a separate Playwright context). For
true multi-page browsing within one session, edit the URL list passed to the
underlying CLI: traffic-sim returning-user --url A --url B --url C.
Interpreting the result
The structured response shape matches simulate_new_user. Key signals:
verified: trueandpageviews >= page_views— the session works.- Same
distinct_idacross all pageviews (visible in PostHog UI under the run_id query param) — session stitching works. - Different
distinct_idper visit — likely a cookie domain or storage-permissions issue. Inspect the rawposthog_requestsfor$session_idvalues to diagnose.
FAQ
How is this different from the new user test?
This test keeps cookies between page views, so it checks how visits are linked rather than first-visit behavior.
Can it visit several pages in one session?
Each call uses one page address, so visiting several pages needs a change to the list of URLs passed to the tool.
What does verified mean here?
It means PostHog captured at least as many pageviews as the number of page views requested.
Details
Original description by the author
Send synthetic single-session multi-page traffic to a URL and confirm PostHog $pageview events fire across page views. Use when verifying that cookies persist correctly, that the same distinct_id is reused across navigations, or when debugging session-stitching issues.
repo: PostHog/posthog
Popularity
- GitHub stars
- 41k
- Ranking position
- #6987
- License
- —
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
depot-ci
41kHelps your agent set up and run Depot CI workflows, a GitHub Actions alternative, including migrating existing workflows and reading run logs.
depot-container-builds
41kHelps your agent build Docker images on Depot's remote builders, including multi-platform images, pushing to registries, and fixing build failures.
depot-github-runners
41kHelps your agent move GitHub Actions jobs to Depot-managed runners, choosing runner sizes and labels, and troubleshooting runner setup issues.
editing-agents-md
41kHelps your agent decide whether a rule belongs in an AGENTS.md or CLAUDE.md file, and write it so it sticks without bloating the file.
Similar skills
test-driven-development
311kTeaches your agent to write a failing test first, watch it fail, then write the smallest code that passes, before building any feature or fix.
verification-before-completion
311kTeaches your agent to run real checks and read their output before claiming that a task, fix, or build is complete or passing.
migrate-to-shoehorn
310kReplaces risky type casts in your test files with the shoehorn library, so tests can use partial data and still pass type checks.