本文へスキップ
Skillpedia
テスト41k · #6987

simulate-returning-user

できること

このスキルは、1つのブラウザセッションで複数ページの訪問をシミュレートし、各ページのPostHogのイベントを確認します。訪問者の行動が正しくつながっているかを確かめたい開発者向けです。

使う場面

  • ✓複数のページビューにわたり、同じユーザーIDが維持されるか確認したいとき。
  • ✓最初のページだけでなく、すべてのページでページビューが記録されるか確認したいとき。
  • ✓1人の訪問者の行動が、複数のユーザーに分かれているという報告があったとき。

スキルのリンク

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

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/PostHog/posthog/blob/master/tools/traffic-sim/skills/simulate-returning-user/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“訪問者がサイトの3ページを見る様子をシミュレートし、PostHogが3つのページビューを1人のユーザーに関連づけているか確認してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、ページビューの間もCookieとストレージを保持する1つのブラウザセッションを実行するので、訪問は実際の人の閲覧に近くなります。イベントとユーザーIDを報告し、各ページビューが記録されたかを確認します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Simulate returning-user traffic

Drives a single browser context across N page views (cookies and localStorage persist), navigating between pages and reporting which PostHog events fired. This matches the behavior of a single visitor browsing multiple pages on the same site.

When to use

  • Confirm that PostHog reuses the same distinct_id across page views in a session (no fresh anonymous IDs per page).
  • Confirm $pageview fires on every page view, not just the first.
  • Reproduce "session not stitching" or "events split across multiple users" reports.

How to invoke

Call the simulate_returning_user MCP tool with:

  • url (required) — the page to visit each iteration.
  • page_views (default 3) — number of page views in the session.
  • interval (default 5.0) — seconds between page views.
  • posthog_host (default https://us.i.posthog.com).

To exercise multi-page navigation, call the tool once per URL — the cookies won't carry across calls (each call is a separate Playwright context). For true multi-page browsing within one session, edit the URL list passed to the underlying CLI: traffic-sim returning-user --url A --url B --url C.

Interpreting the result

The structured response shape matches simulate_new_user. Key signals:

  • verified: true and pageviews >= page_views — the session works.
  • Same distinct_id across all pageviews (visible in PostHog UI under the run_id query param) — session stitching works.
  • Different distinct_id per visit — likely a cookie domain or storage-permissions issue. Inspect the raw posthog_requests for $session_id values to diagnose.
よくある質問

新規ユーザーのテストとどう違いますか?

このテストは、ページビューの間でCookieを保持するため、初回訪問時の動作ではなく、訪問がどのようにつながるかを確認します。

1つのセッションで複数のページを訪問できますか?

各呼び出しは1つのページアドレスを使うため、複数のページを訪問するには、ツールに渡すURLの一覧を変更する必要があります。

ここで検証済みとは何を意味しますか?

要求されたページビューの数以上を、PostHogが記録したことを意味します。

詳細

作者による元の説明

Send synthetic single-session multi-page traffic to a URL and confirm PostHog $pageview events fire across page views. Use when verifying that cookies persist correctly, that the same distinct_id is reused across navigations, or when debugging session-stitching issues.

repo: PostHog/posthog

人気

GitHubのスター
41k
ランキング
#6987
ライセンス
—
更新日
2026/11/2

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル