跳到正文
Skillpedia
测试41k · #6987

simulate-returning-user

它能做什么

这项技能在同一个浏览器会话中发送模拟的多页面访问,并检查每个页面上的 PostHog 事件。适合希望确认访客的活动被正确关联在一起的开发者。

适用场景

  • ✓当你想确认页面浏览之间保持同一个用户 ID 的时候。
  • ✓当你想检查每个页面而不仅仅是第一个页面都被记录了页面浏览的时候。
  • ✓当有人反映同一位访客的活动被拆分到了多个用户的时候。

技能链接

https://github.com/PostHog/posthog/blob/master/tools/traffic-sim/skills/simulate-returning-user/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/PostHog/posthog/blob/master/tools/traffic-sim/skills/simulate-returning-user/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请模拟一位访客在我们网站上浏览三个页面,并检查 PostHog 是否把这三次页面浏览都关联到同一个用户。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会运行一个在页面浏览之间保留 Cookie 和存储的浏览器会话,使访问过程像真人浏览一样。它会报告事件和用户 ID,然后确认每次页面浏览是否被记录。

技术内容(原始 SKILL.md)

作者在 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.
常见问题

它与全新用户测试有何不同?

此测试在页面浏览之间保留 Cookie,因此它检查的是访问如何被关联,而不是首次访问的行为。

它可以在一次会话中访问多个页面吗?

每次调用只使用一个页面地址,因此要访问多个页面,需要修改传给工具的 URL 列表。

这里的已验证是什么意思?

指 PostHog 记录的页面浏览数至少等于所请求的页面浏览数。

详情

作者的原始描述

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

热度

GitHub 星标
41k
排名
#6987
许可证
—
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能