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

simulate-new-user

它能做什么

这项技能向网页发送模拟的首次访问,并检查触发了哪些 PostHog 事件。适合希望证明追踪对新访客有效的开发者。

适用场景

  • ✓当你想确认首次访问者的页面浏览被正确追踪的时候。
  • ✓当你部署了一项追踪更改,并想对其进行测试的时候。
  • ✓当有人反映新用户的事件没有显示在 PostHog 中的时候。

技能链接

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

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

使用方法

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

可直接粘贴的消息

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

可以这样问 AI

“请以新访客的身份向我们的定价页面发送几次测试访问,并告诉我 PostHog 是否记录了这些访问。”

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

工作原理

智能体会多次打开该页面,每次都使用没有已保存 Cookie 的全新浏览器,并轻微滚动,然后报告 PostHog 收到了哪些事件。只有在记录到页面浏览时,一次访问才算通过验证。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Simulate new-user traffic

Drives a fresh browser context for each visit (no cookies, no localStorage), goes to the given URL, scrolls a bit, and reports which PostHog events fired. Each visit looks to PostHog like a brand-new anonymous visitor.

When to use

  • Confirm $pageview fires on the first visit (no cookies present).
  • Confirm an anonymous distinct_id is generated and a PostHog request is sent within a few seconds of page load.
  • Reproduce "events not showing up for new users" reports.

How to invoke

Call the simulate_new_user MCP tool with:

  • url (required) — the page to visit, e.g. https://example.com/pricing.
  • visits (default 3) — number of fresh-context visits.
  • interval (default 5.0) — seconds between visits.
  • posthog_host (default https://us.i.posthog.com) — set to https://eu.i.posthog.com for the EU cloud, or your self-hosted host (e.g. https://ph.example.com).

Each visit takes ~10s of Playwright time plus the interval, so plan accordingly.

Interpreting the result

The tool returns a structured summary:

{
  "run_id": "a1b2c3d4",
  "scenario": "new-user",
  "total_visits": 3,
  "posthog_requests": 6,
  "posthog_requests_ok": 6,
  "events_by_type": { "$pageview": 3, "$autocapture": 3 },
  "pageviews": 3,
  "errors": [],
  "verified": true,
}
  • verified: true means at least one $pageview was captured per visit and no errors occurred — the new-user flow works.
  • verified: false with pageviews: 0 means PostHog isn't firing pageviews. Run check_posthog_loading next to see whether the snippet is even loaded.
  • posthog_requests_ok < posthog_requests means PostHog returned non-2xx responses. Check the project's ingestion limits and api_host configuration.
常见问题

为什么每次都使用全新浏览器?

这样每次访问在 PostHog 看来都像一个全新的匿名访客。

一次测试需要多长时间?

每次访问大约需要十秒,加上访问之间的等待时间,因此几次访问需要一些时间。

我可以测试欧盟云版的 PostHog 吗?

可以。该技能可以把访问发送到欧盟云,或发送到自托管的 PostHog 地址。

详情

作者的原始描述

Send synthetic first-time-visitor traffic to a URL and confirm that PostHog $pageview events fire. Use when a customer wants to verify that anonymous visitor tracking works, after deploying instrumentation changes, or when debugging "events not arriving" reports.

repo: PostHog/posthog

热度

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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能