Skip to content
Skillpedia
Testing41k · #6987

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.md

Copy 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

Use this skill to help me: https://github.com/PostHog/posthog/blob/master/tools/traffic-sim/skills/simulate-returning-user/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

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_id across page views in a session (no fresh anonymous IDs per page).
  • Confirm $pageview fires 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 (default 3) — number of page views in the session.
  • interval (default 5.0) — seconds between page views.
  • posthog_host (default https://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: true and pageviews >= page_views — the session works.
  • Same distinct_id across all pageviews (visible in PostHog UI under the run_id query param) — session stitching works.
  • Different distinct_id per visit — likely a cookie domain or storage-permissions issue. Inspect the raw posthog_requests for $session_id values 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

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills