check-posthog-loading
它能做什么
这项技能检查一系列网页,确认每一页上都正确安装并设置了 PostHog 的 JavaScript 库。适合希望确保各处追踪都正常工作的网站所有者。
适用场景
- ✓当你刚安装好 PostHog,想确认它在每个页面上都能正常工作的时候。
- ✓当页面模板发生变化,你怀疑某个页面丢失了追踪代码片段的时候。
- ✓当某些页面向与其他页面不同的 PostHog 项目或主机发送数据的时候。
技能链接
https://github.com/PostHog/posthog/blob/master/tools/traffic-sim/skills/check-posthog-loading/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请检查我的关键页面,确认 PostHog 安装正确,并且都发送到同一个项目。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会在真实浏览器中打开每个页面,等待 PostHog 启动,并报告它是否已加载、以何种方式添加以及使用的设置。然后它会总结哪些页面正常,哪些页面有问题。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Check PostHog loading
For each URL, navigates a real browser to the page, waits for PostHog to initialize, and reports:
- Whether
window.posthogis defined and__loaded. - Which load method was used:
head_snippet,snippet,array_js_only, ornone. - Where in the document the snippet lives (
head/body). - The init config:
api_key,api_host,person_profiles. - Runtime state including the assigned
distinct_id.
When to use
- Sanity-check a fresh install — does the snippet actually load on every page?
- After a page-template change — did one page lose the snippet?
- When investigating split data — are some pages pointing at a different
api_hostorapi_keythan others? - Onboarding a new customer — confirm SDK is wired up before debugging events.
How to invoke
Call the check_posthog_loading MCP tool with:
urls(required) — list of URLs to inspect.posthog_host(defaulthttps://us.i.posthog.com).
Returns a structured summary with which URLs loaded successfully, which didn't, and the load-method distribution.
Interpreting the result
Look for these red flags:
- Empty
loadedlist, fullnot_loadedlist — snippet not present anywhere. Re-run install or check that the layout includes the snippet. - Mixed
loaded/not_loaded— snippet missing from some pages. Common cause: a page rendered by a different template or layout. - Multiple distinct
api_keyvalues across pages — a page is pointing at the wrong PostHog project. - Multiple distinct
api_hostvalues — a page is pointing at the wrong ingestion endpoint (e.g. EU cloud vs US cloud, or vs a self-hosted reverse proxy). This causes events to land in different projects than expected. load_method: array_js_onlywith no init config —array.jswas loaded butposthog.init()was never called. Common with manual installs that miss the second half.
常见问题
报告会为每个页面显示什么?
PostHog 是否已加载、添加方式、项目密钥和主机,以及它分配的用户 ID。
如果没有任何页面加载说明什么?
很可能网站缺少追踪代码片段,所以下一步应是重新安装或检查页面布局。
它会比较哪些设置?
项目密钥和主机,这样你就能发现哪些页面把数据发送到了别处。
详情
作者的原始描述
Inspect how the PostHog JavaScript SDK is loaded across a list of URLs. Use to confirm consistent installation across pages, find pages missing the snippet, detect mismatched API keys or hosts between pages, and verify the load method (head snippet vs deferred vs array.js).
repo: PostHog/posthog
热度
- GitHub 星标
- 41k
- 排名
- #6985
- 许可证
- —
- 更新时间
- 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,并以不会让文件臃肿的方式写下,确保规则真正生效。