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。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 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
$pageviewfires on the first visit (no cookies present). - Confirm an anonymous
distinct_idis 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(default3) — number of fresh-context visits.interval(default5.0) — seconds between visits.posthog_host(defaulthttps://us.i.posthog.com) — set tohttps://eu.i.posthog.comfor 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: truemeans at least one$pageviewwas captured per visit and no errors occurred — the new-user flow works.verified: falsewithpageviews: 0means PostHog isn't firing pageviews. Runcheck_posthog_loadingnext to see whether the snippet is even loaded.posthog_requests_ok < posthog_requestsmeans 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
评论
- …
同一仓库的更多技能
depot-ci
41k帮你的智能体设置并运行 Depot CI 工作流(GitHub Actions 的替代方案),包括迁移现有工作流和读取运行日志。
depot-container-builds
41k帮你的智能体在 Depot 的远程构建器上构建 Docker 镜像,包括多平台镜像、推送到镜像仓库,以及修复构建失败。
depot-github-runners
41k帮你的智能体把 GitHub Actions 任务迁移到 Depot 托管的运行器上,选择运行器规格和标签,并排查运行器设置问题。
editing-agents-md
41k帮你的智能体判断某条规则应写入 AGENTS.md 还是 CLAUDE.md,并以不会让文件臃肿的方式写下,确保规则真正生效。