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

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

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

可以这样问 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.posthog is defined and __loaded.
  • Which load method was used: head_snippet, snippet, array_js_only, or none.
  • 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_host or api_key than 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 (default https://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 loaded list, full not_loaded list — 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_key values across pages — a page is pointing at the wrong PostHog project.
  • Multiple distinct api_host values — 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_only with no init config — array.js was loaded but posthog.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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能