configuring-experiment-analytics
できること
このスキルは、実験の分析に含める人と、実験の効果を示す数字を設定します。A/Bテストの計測の側面を設定する人向けです。
使う場面
- ✓実験で、どのユーザーを数えるべきか決める必要があるとき。
- ✓テストの主要指標と副次指標を選びたいとき。
- ✓実験内で複数のバリアントを見るユーザーを扱う必要があるとき。
スキルのリンク
https://github.com/PostHog/posthog/blob/master/products/experiments/skills/configuring-experiment-analytics/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“決済の実験を、支払いページに到達したユーザーだけが数えられるように設定し、主要指標としてコンバージョンを追跡してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
分析に入る人を決める露出のルールを設定し、効果を測る指標を追加します。複数のバリアントを見るユーザーの扱い方も説明します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Configuring experiment analytics
This skill answers: Who is included in the analysis? and How to measure impact?
Exposure criteria
Exposure criteria determine which users are counted in the experiment analysis.
Exposure event
Two options:
- Default exposure event — users are included when the experiment's default exposure event fires for the experiment's flag:
$feature_flag_called, or$experiment_exposurefor newer experiments. Which one applies is resolved server-side — readresolved_exposure_eventfromexperiment-getrather than assuming either name (both events carry the same properties). When it is$feature_flag_called, also read$experiment_exposure(event IN ('$feature_flag_called', '$experiment_exposure')), and count persons, not rows. This is the standard approach — it means a user is included only when they actually encounter the feature flag in your code. - Custom exposure event — users are included when a specific custom event fires. Use this when you want tighter control over who enters the analysis (e.g., only users who actually visit the page where the experiment runs).
Filters on the exposure event remove individual events, not users.
A user still counts as long as one of their exposure events passes the filters.
To keep users out of the experiment, exclude them in the flag's release conditions before launch (see configuring-experiment-rollout).
Multiple variant handling
When a user is exposed to multiple variants (e.g., due to flag changes or race conditions):
- Exclude from analysis — removes these users from the analysis entirely. Cleaner data, smaller sample.
- Use first seen variant — assigns users to the first variant they were exposed to. Keeps all users in the analysis. Note that "first seen" can introduce other biases as behavior cannot be clearly attributed to a single variant and is not recommended unless necessary.
Bias risk on uneven splits. "Exclude from analysis" combined with an uneven variant split can introduce bias — multi-variant users are dropped asymmetrically and the smaller variant loses a larger fraction of its assignments. If those users behave differently from the rest, the smaller variant's metrics will be skewed.
The right mitigation depends on experiment state:
- Not yet launched, or only exposed to a few users so far — switch to an even variant split and
use the overall rollout percentage to limit test-variant exposure. This removes the bias and
preserves statistical power. See
configuring-experiment-rollout. - Live experiment with significant exposures — changing the split mid-run reassigns users across variants, which is bad for user experience and data quality. Switch this setting to "Use first seen variant" instead — it keeps already-assigned users in their original variant (no reassignment) and removes the asymmetric exclusion.
Filter test accounts
exposure_criteria.filterTestAccounts (default: true) — excludes internal/test users from the analysis.
Resolving experiments
Metric changes require an experiment ID. If the user refers to an experiment by name
or description (e.g. "add metrics to the checkout test"), load the finding-experiments
skill to resolve it to a concrete ID before proceeding.
Metrics
A metric reaches an experiment one of two ways, both via experiment-update:
- Inline metric — defined directly on the experiment. Sent in the
metricsarray, which replaces the entire inline list, so always get the current experiment first viaexperiment-getto preserve existing metrics. - Shared (saved) metric — a reusable metric object that can be attached to many experiments.
Attached by ID via
saved_metrics_ids(this list also replaces the experiment's existing saved-metric links, so resend the full set — see Step 1).
Prefer reusing a shared metric over duplicating it inline. Build a new inline metric only when no suitable shared metric already exists.
Step 1: Check for an existing shared metric (REQUIRED — match by definition, not name)
Before building any new inline metric, you MUST check whether the project already has a shared (saved) metric that measures the same thing, and reuse it. Duplicating a metric that already exists as a shared metric fragments measurement and is exactly what we want to avoid.
*Reuse is decided by the metric definition — the event or action plus the metric type — not the name.
よくある質問
露出イベントとは何ですか?
ユーザーがフィーチャーフラグを見たことを示すイベントです。そのユーザーが分析に含まれます。
露出イベントをフィルターするとユーザーは除外されますか?
いいえ。個々のイベントが除外されるだけです。露出イベントのいずれかが条件を満たせば、そのユーザーは引き続き数えられます。
どんな指標の種類がサポートされていますか?
件数、合計、比率、継続率の指標がサポートされています。
詳細
作者による元の説明
Configures the analytics side of a PostHog experiment — exposure criteria (server-resolved default exposure event vs custom exposure events), primary and secondary metrics, the supported metric types (count, sum, ratio with `math` and `math_property`, retention with `retention_window_start` and `start_handling`), multivariate user handling ("Exclude from analysis" vs "Use first seen variant"), and how to read results once the experiment is live. Use when the user adds or edits a primary or secondary metric (e.g. "add a secondary metric tracking 'downloaded_file' per user"), sets up a ratio met
repo: PostHog/posthog
人気
- GitHubのスター
- 41k
- ランキング
- #6875
- ライセンス
- —
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
depot-ci
41kエージェントが、GitHub Actionsの代替であるDepot CIのワークフローを設定し実行できるよう支援します。既存のワークフローの移行や、実行ログの確認も含みます。
depot-container-builds
41kエージェントが、Depotのリモート・ビルダーでDockerイメージを作れるよう支援します。マルチプラットフォームのイメージ、レジストリへのプッシュ、ビルド失敗の修正を含みます。
depot-github-runners
41kエージェントが、GitHub Actionsのジョブを Depot が管理するランナーに移し、ランナーのサイズとラベルを選び、ランナー設定の問題を解決できるよう支援します。
editing-agents-md
41kエージェントが、AGENTS.mdとCLAUDE.mdのどちらにルールを書くべきかを判断し、ファイルを膨らませずに守られやすい形で書けるよう支援します。
似ているスキル
gitcrawl
394k保存されたGitHubのイシューとプルリクエストのアーカイブを検索し、重複をまとめ、GitHub上の現在の状態を確認するようエージェントを支援します。
slacrawl
394kローカルのSlackアーカイブ内のメッセージを検索して件数を数え、アーカイブの新しさを確認し、必要に応じて更新するようエージェントを支援します。
goplaces
394kGoogle Placesを使って、場所を検索し、詳細や口コミを取得し、場所の名前を解決するようエージェントを支援します。スクリプト用にJSON出力もできます。