The Metric Hierarchy
The Metric Hierarchy
Not all metrics are created equal. In an A/B test, metrics serve different roles, and confusing these roles leads to bad decisions. A metric hierarchy clarifies which metrics drive the decision, which provide context, and which protect against harm.
Primary Metrics
The primary metric is the single number that determines whether you ship the treatment. It is the metric your experiment is powered to detect a change in. You should have exactly one primary metric per experiment.
The primary metric must be:
- Sensitive: It can detect the effect you care about within your sample size and experiment duration.
- Robust: It is not easily gamed or manipulated by the treatment in a way that does not reflect real user value.
- Decision-relevant: A change in this metric maps directly to a business or product goal.
If you cannot name your primary metric in one sentence, your experiment is not ready to launch.
Secondary Metrics
Secondary metrics provide context for the primary metric result. They help you understand why the primary metric changed and whether the change is real or an artifact.
For example, if your primary metric is conversion rate, secondary metrics might include:
- Average order value (did conversion increase because more people bought, or because they bought cheaper items?)
- Time to purchase (did the new flow speed up checkout?)
- Bounce rate (did users engage more or just leave faster?)
Secondary metrics are not used for the ship/no-ship decision. They are used to build a narrative around the result and to generate hypotheses for future experiments.
Guardrail Metrics
Guardrail metrics are safety checks. They are metrics that must not degrade beyond a predefined threshold. If a guardrail metric breaches its threshold, you do not ship — regardless of how good the primary metric looks.
Guardrails protect against treatments that improve one metric by harming another. A new recommendation algorithm might increase click-through rate but also increase server load. If server load exceeds your threshold, the experiment is a failure, even if CTR improved.
Common guardrail categories:
| Category | Examples | Why it matters |
|---|---|---|
| Performance | Page load time, API latency | Slow experiences drive users away |
| Stability | Error rate, crash rate | Broken features destroy trust |
| Business health | Refund rate, chargeback rate | Short-term gains, long-term losses |
| User trust | Unsubscribe rate, complaint rate | Silent attrition is hard to reverse |
Why You Need All Three
A common mistake is to track only the primary metric. This is like driving a car while looking only at the speedometer. You might be going the right speed, but you are about to run out of gas.
The metric hierarchy works together:
- Primary metric tells you if the treatment works.
- Secondary metrics tell you why it works.
- Guardrail metrics tell you if it is safe.
Without guardrails, you ship treatments that improve a narrow metric while degrading the overall user experience. Without secondary metrics, you ship treatments you do not understand, which makes iteration difficult.
Choosing Metrics That Measure What Matters
Choosing Metrics That Measure What Matters
The hardest part of experiment design is not statistics. It is choosing metrics that reflect real user value rather than convenient proxies.
The Proxy Problem
Most metrics are proxies for the outcome you actually care about. You want to increase user satisfaction, but you cannot measure satisfaction directly, so you measure session duration. You want to improve product quality, but you cannot measure quality directly, so you measure error rate.
Proxy metrics are useful but dangerous. They are useful because they are measurable. They are dangerous because they can diverge from the true outcome you care about.
Consider a team that optimizes for session duration. They add more content to each page, which increases time on site. But users are not more satisfied — they are just taking longer to find what they need. The proxy metric improved while the true outcome degraded.
Criteria for Good Metrics
A good experiment metric should satisfy these criteria:
Actionable: A change in the metric implies a specific action. If the metric improves, you ship. If it degrades, you iterate.
Sensitive: The metric can detect the effect size you care about within your experimental constraints. A metric that changes by 0.001% when you make a meaningful change is not sensitive enough.
Robust: The metric is not easily gamed. If the treatment can improve the metric without improving user experience, it is not robust.
Timely: The metric can be measured within your experiment duration. If you need six months to see a change, you cannot run a two-week experiment.
Interpretable: A change in the metric has a clear, unambiguous meaning. If stakeholders need a 30-minute meeting to interpret the result, the metric is too complex.
Metric Types and Their Tradeoffs
Behavioral metrics (clicks, views, purchases) are directly observable and easy to measure. They are sensitive to short-term changes. But they can be gamed — a misleading headline increases clicks without increasing value.
Outcome metrics (revenue, retention, lifetime value) reflect real business value. They are robust but slow. You may need weeks or months to detect a change.
Perceptual metrics (survey responses, NPS) capture user sentiment. They are leading indicators of behavior but noisy and subject to response bias.
The best experiments use a combination: a primary outcome metric, secondary behavioral metrics for context, and guardrail metrics for safety.
Building a Metric Tree
A metric tree decomposes a high-level goal into measurable components. For example:
Goal: Increase user engagement
├── Primary: Weekly active users
├── Secondary:
│ ├── Sessions per user per week
│ ├── Actions per session
│ └── Feature adoption rate
└── Guardrails:
├── Session duration (must not decrease)
├── Error rate (must not increase)
└── Support tickets (must not increase)
The metric tree ensures that your experiment metrics are connected to business goals. It also reveals tradeoffs — if you increase sessions per user but decrease session duration, is that good or bad?
Practical Metric Selection
When selecting metrics for an experiment:
- Start with the decision you need to make. What would make you ship or not ship?
- Identify the metric that best captures that decision. This is your primary metric.
- Identify metrics that could be harmed by the treatment. These are your guardrails.
- Identify metrics that would help you understand the result. These are your secondary metrics.
- Verify that your primary metric is sensitive enough to detect the effect size you care about. If not, you need a larger sample size or a more sensitive metric.
Metric Gaming and Goodhart's Law
Metric Gaming and Goodhart's Law
Goodhart's law states: "When a measure becomes a target, it ceases to be a good measure." In the context of A/B testing, this means that any metric you optimize for will eventually be gamed — either intentionally by the treatment or unintentionally by the system's response to the treatment.
How Metric Gaming Happens
Metric gaming occurs when a treatment improves a metric without improving the underlying user value the metric is supposed to represent. Common patterns:
Vanity metrics: The treatment increases a metric that looks good but does not correlate with business outcomes. A new pop-up increases email signups, but the signups are from users who never engage with the product.
Short-term optimization: The treatment improves a short-term metric while degrading long-term value. A aggressive discount increases purchases this week but trains users to wait for discounts.
Selection effects: The treatment changes the composition of users who trigger the metric. A new onboarding flow increases activation rate, but only because it filters out low-intent users before they reach the activation step.
Threshold effects: The treatment pushes users just past a metric threshold without meaningful improvement. A progress bar shows 99% completion, which increases completion rate, but users do not actually finish the task.
Detecting Metric Gaming
Metric gaming is difficult to detect because the metric genuinely improves. You need to look beyond the primary metric:
Check guardrail metrics. If the primary metric improves but guardrails degrade, the improvement may be an artifact.
Segment the result. If the improvement is concentrated in a segment that does not represent your target users, it may not be real.
Look at downstream metrics. If the primary metric improves but downstream metrics (retention, revenue) do not, the improvement may not be meaningful.
Run a holdout. Keep a small percentage of users on the control for an extended period. If the effect decays over time, it was a short-term artifact.
Defending Against Metric Gaming
The best defense against metric gaming is a well-designed metric hierarchy:
Use outcome metrics as primary metrics whenever possible. Revenue, retention, and lifetime value are harder to game than clicks and views.
Set guardrail metrics that capture the negative effects of gaming. If you optimize for clicks, guardrail with conversion rate. If you optimize for conversion, guardrail with refund rate.
Pre-register your metrics. If you commit to a primary metric before the experiment, you cannot switch to a different metric after seeing the result.
Use composite metrics that combine multiple signals. A single metric is easy to game; a weighted combination is harder.
Goodhart's Law in Practice
A classic example: a team optimizes for "number of support tickets resolved." Agents start closing tickets quickly without resolving the underlying issue. The metric improves, but customer satisfaction drops and tickets reopen at a higher rate.
The fix is not to abandon the metric but to pair it with a guardrail. Track both "tickets resolved" and "ticket reopen rate." If resolution rate improves but reopen rate also improves, the optimization is gaming the metric.
The Long-Term View
Metric gaming is not always malicious. Often, it is an emergent property of a system optimizing for a narrow objective. The treatment designer did not intend to game the metric — they just found a way to improve it that does not align with user value.
This is why experiment design requires thinking about the system, not just the metric. Ask: "If I optimize for this metric, what is the easiest way the system could improve it without improving user value?" Then design guardrails that detect that failure mode.
Building a Metric Selection Framework
Building a Metric Selection Framework
A metric selection framework is a structured process for choosing experiment metrics. It ensures consistency across experiments and prevents ad-hoc metric selection that leads to gaming and confusion.
Step 1: Define the Decision
Every experiment exists to inform a decision. Start by writing down the decision in one sentence:
- "Should we ship the new checkout flow?"
- "Should we change the pricing page layout?"
- "Should we launch the new recommendation algorithm?"
The decision determines the metrics. If the decision is about shipping a feature, your primary metric should measure the feature's impact on user behavior or business outcomes.
Step 2: Identify the User Value Proposition
What user problem does the treatment solve? How would you know if it solved it? The answer to these questions points to your primary metric.
If the treatment reduces friction in checkout, the user value is faster, easier checkout. The primary metric should measure whether users complete checkout more often (conversion rate) or more quickly (time to purchase).
Step 3: Map Metrics to the User Journey
Map the user journey and identify metrics at each stage:
Awareness → Consideration → Conversion → Retention → Advocacy
↓ ↓ ↓ ↓ ↓
Impressions Product views Purchase Return rate NPS
CTR Add to cart AOV Churn rate Referrals
Your primary metric should be at the stage where the treatment has its primary effect. If the treatment is a new product page, the primary metric is likely at the consideration stage (product views, add to cart).
Step 4: Identify Risks and Guardrails
For each metric, ask: "How could the treatment harm this metric?" The answers become your guardrail metrics.
| Treatment | Primary Metric | Potential Harm | Guardrail |
|---|---|---|---|
| New checkout flow | Conversion rate | Longer load time | Page load time |
| New pricing layout | Purchase rate | Lower AOV | Average order value |
| New onboarding | Activation rate | Lower retention | Day-7 retention |
| New search algorithm | CTR | Lower conversion | Conversion rate |
Step 5: Validate Sensitivity
Before launching, verify that your primary metric can detect the effect size you care about. Use historical data to estimate the metric's variance, then calculate the minimum detectable effect (MDE) for your planned sample size.
from scipy.stats import norm
import math
def minimum_detectable_effect(baseline_rate: float, sample_size_per_group: int,
alpha: float = 0.05, power: float = 0.80) -> float:
z_alpha = norm.ppf(1 - alpha / 2)
z_beta = norm.ppf(power)
p1 = baseline_rate
p2 = baseline_rate # under null
pooled_se = math.sqrt(2 * p1 * (1 - p1) / sample_size_per_group)
mde = (z_alpha + z_beta) * pooled_se
return mde
mde = minimum_detectable_effect(baseline_rate=0.10, sample_size_per_group=50000)
print(f"MDE: {mde:.4f} ({mde/0.10*100:.2f}% relative)")
If the MDE is larger than the effect you care about, you need a larger sample size or a more sensitive metric.
Step 6: Document and Socialize
Write the metric selection into your pre-registration document. Share it with stakeholders before the experiment launches. This creates accountability and prevents post-hoc metric changes.
A metric selection framework is not bureaucracy. It is a forcing function that makes you think clearly about what you are measuring and why. The time you spend selecting metrics before the experiment saves you from invalid results after it.
Practice Problems
You are running an experiment on a new email subject line. Classify each of the following metrics as primary, secondary, or guardrail: (a) open rate, (b) click-through rate, (c) unsubscribe rate, (d) conversion rate from email, (e) spam complaint rate.
Solution
(a) Open rate is the primary metric — the treatment (new subject line) is specifically designed to increase opens. (b) Click-through rate is a secondary metric — it provides context on whether the increased opens lead to engagement. (c) Unsubscribe rate is a guardrail — a subject line that increases opens but also increases unsubscribes is net negative. (d) Conversion rate is a secondary metric — it measures downstream impact but is not the direct target of a subject line change. (e) Spam complaint rate is a guardrail — it protects against the subject line being marked as spam, which harms deliverability. An experiment shows that a new recommendation algorithm increases click-through rate by 5% (p < 0.01). However, session duration decreased by 3% and conversion rate decreased by 2%. Is the CTR improvement real? What should you investigate?
Solution
The CTR improvement may be real but not valuable. The treatment likely increased clicks by making recommendations more clickbait-style — more attractive to click but less relevant once users land on the page. This is evidenced by the decrease in session duration (users leave faster after clicking) and decrease in conversion rate (clicks do not lead to purchases). You should investigate: (1) the quality of clicks — are users who click more or less likely to convert? (2) the content of recommendations — are they more sensational but less relevant? (3) segment analysis — is the CTR increase concentrated in a specific user segment? The ship/no-ship decision should weigh the CTR increase against the conversion decrease, not treat CTR in isolation. Design a metric hierarchy for an experiment testing a new onboarding flow designed to increase user activation. Include one primary metric, two secondary metrics, and two guardrail metrics. Justify each choice.
Solution
Primary metric: Activation rate (percentage of new users who complete the core action within 24 hours of signup). This directly measures the treatment's goal.
Secondary metrics: (1) Time to activate — measures whether the new flow reduces friction. If activation rate increases but time to activate does not decrease, the improvement may be due to selection effects rather than reduced friction. (2) Feature discovery rate — measures whether users find key features during onboarding. This helps understand the mechanism behind the activation change.
Guardrail metrics: (1) Day-7 retention — a new onboarding flow might increase short-term activation while harming long-term retention if it oversimplifies the product. (2) Support ticket volume — if the new flow confuses users, support tickets will increase even if activation improves.
Justification: The primary metric (activation rate) is the direct measure of the treatment's goal. Secondary metrics (time to activate, feature discovery) provide context on the mechanism. Guardrails (retention, support tickets) protect against the treatment improving activation at the cost of long-term user health. Quiz
1. What is the role of a guardrail metric in an A/B test?
2. A treatment increases click-through rate by 5% but decreases conversion rate by 2%. What does this suggest?
3. Why should you have exactly one primary metric per experiment?
Flashcards
Question
What is the difference between primary, secondary, and guardrail metrics?
Click to reveal answer
Answer
The primary metric is the single metric that determines the ship/no-ship decision. Secondary metrics provide context on why the primary metric changed. Guardrail metrics are safety checks that must not degrade beyond a threshold — if they breach, the treatment is not shipped regardless of the primary metric result.
Question
What is Goodhart's law and how does it apply to A/B testing?
Click to reveal answer
Answer
Goodhart's law states that when a measure becomes a target, it ceases to be a good measure. In A/B testing, this means any metric you optimize for will eventually be gamed — the treatment finds a way to improve the metric without improving the underlying user value. Defenses include using outcome metrics as primary metrics, setting guardrails, and pre-registering metric choices.
Question
What are the five criteria for a good experiment metric?
Click to reveal answer
Answer
A good experiment metric is: (1) actionable — a change implies a specific decision, (2) sensitive — can detect the effect size within experimental constraints, (3) robust — not easily gamed, (4) timely — measurable within the experiment duration, and (5) interpretable — a change has clear, unambiguous meaning.
Question
How do you detect metric gaming in an experiment result?
Click to reveal answer
Answer
Check guardrail metrics for degradation, segment the result to see if the improvement is concentrated in a non-representant segment, examine downstream metrics to see if the improvement propagates, and run a holdout to test whether the effect decays over time. If the primary metric improves but guardrails or downstream metrics degrade, the improvement is likely an artifact.
Revision Notes
Key Takeaways
- 1. Every experiment needs exactly one primary metric that drives the ship/no-ship decision
- 2. Guardrail metrics protect against treatments that improve one metric while harming user or business health
- 3. Goodhart's law means any metric you optimize for will eventually be gamed
- 4. Outcome metrics (revenue, retention) are harder to game than proxy metrics (clicks, views)
- 5. A metric tree connects experiment metrics to business goals and reveals tradeoffs
- 6. Pre-registering metrics prevents post-hoc metric switching
Interview Tips
- • Be ready to explain the difference between primary, secondary, and guardrail metrics with concrete examples
- • If asked about a metric that improved but business outcomes did not, discuss Goodhart's law and how to detect metric gaming
- • Explain how you would design a metric hierarchy for a specific product decision, showing you can connect metrics to user value
Cheat Sheet
Cheat Sheet: Metrics and Guardrails
Metric Hierarchy
- Primary: Single metric that drives ship/no-ship decision
- Secondary: Context metrics that explain why the primary changed
- Guardrail: Safety metrics that must not degrade
Goodhart's Law
- When a measure becomes a target, it ceases to be a good measure
- Defenses: outcome metrics, guardrails, pre-registration, composite metrics
Metric Selection Criteria
- Actionable — implies a specific decision
- Sensitive — detects effect size within constraints
- Robust — not easily gamed
- Timely — measurable within experiment duration
- Interpretable — clear, unambiguous meaning
Detecting Metric Gaming
- Check guardrails for degradation
- Segment the result
- Examine downstream metrics
- Run a holdout for long-term effects
Common Gaming Patterns
- Vanity metrics (signups without engagement)
- Short-term optimization (discounts that train wait behavior)
- Selection effects (filtering users before the metric)
- Threshold effects (pushing past a cutoff without real improvement)