Chuyển đến nội dung
Skillpedia
Kiểm thử41k · #6985

check-posthog-loading

Skill này làm gì

Skill này kiểm tra một danh sách trang web để xác nhận thư viện JavaScript của PostHog được cài đặt và thiết lập đúng trên từng trang. Skill dành cho chủ website muốn chắc chắn việc theo dõi hoạt động ở mọi nơi.

Khi nào nên dùng

  • ✓Khi bạn vừa cài PostHog và muốn xác nhận nó hoạt động trên mọi trang.
  • ✓Khi một mẫu trang đã thay đổi và bạn nghi ngờ một trang đã mất đoạn mã theo dõi.
  • ✓Khi một số trang gửi dữ liệu đến một dự án hoặc host PostHog khác với các trang còn lại.

Liên kết skill

https://github.com/PostHog/posthog/blob/master/tools/traffic-sim/skills/check-posthog-loading/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/PostHog/posthog/blob/master/tools/traffic-sim/skills/check-posthog-loading/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Hãy kiểm tra các trang chính của tôi để đảm bảo PostHog được cài đúng và gửi đến cùng một dự án.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent mở từng trang trong một trình duyệt thật, chờ PostHog khởi động, rồi báo cáo xem nó đã tải chưa, được thêm bằng cách nào và các cài đặt đang dùng. Sau đó nó tóm tắt trang nào ổn và trang nào không.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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.
Câu hỏi thường gặp

Báo cáo hiển thị gì cho mỗi trang?

Liệu PostHog đã tải chưa, được thêm bằng cách nào, project key và host, cùng user ID mà nó đã gán.

Nếu không trang nào tải thì nghĩa là gì?

Đoạn mã theo dõi có lẽ đang thiếu trên website, nên bước tiếp theo là cài lại nó hoặc kiểm tra bố cục trang.

Nó so sánh những cài đặt nào?

Project key và host, để bạn phát hiện các trang gửi dữ liệu đến nơi khác.

Chi tiết

Mô tả gốc của tác giả

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

Độ phổ biến

Sao GitHub
41k
Vị trí xếp hạng
#6985
Giấy phép
—
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự