Sub topic 15
Keeping an Experiment Log and Building a Testing Program
This chapter covers how to turn single A/B tests into a program that builds knowledge over time. It assumes you can already write a hypothesis, choose a primary metric, size a test, and run a two-proportion z-test, as covered in earlier chapters. It also assumes you can read short Python snippets.
Why a single test is not enough
A test result is only useful if someone can find it and trust it later. Without a record, teams repeat tests they have already run. They also cite "we learned that emojis work" without knowing which list, which season, or how large the effect was. Winners get rolled out, then nobody remembers whether the lift was 0.1 points or 1 point.
An experiment log fixes this. It is a structured record with one entry per test, written partly before the send and partly after. A testing program is the process around that log: where ideas come from, how they are ranked, and how results change what you do next.
What each log entry records
Split each entry into a plan section and a result section. Write the plan section before launch and never edit it afterward. This is the main defense against changing the story once you see the data.
| Field | Written | Purpose |
|---|---|---|
| Experiment ID and dates | Before | Unique name, such as `subject-test-2026-11` |
| Hypothesis | Before | One sentence naming the change and the expected effect |
| Variable changed | Before | The single thing that differs between variants |
| Primary metric | Before | Usually click rate, as open rate misleads |
| Baseline rate and minimum detectable effect | Before | Inputs to the sample-size calculation |
| Sample size per variant and stopping rule | Before | Prevents peeking and early stopping |
| Audience and segment | Before | Which list, and any exclusions |
| Counts, lift, z, p-value | After | The raw numbers and test output |
| Decision | After | Ship A, ship B, or no difference |
| Notes and caveats | After | Holidays, deliverability problems, anything odd |
| Tags | After | Make the entry searchable later |
Store raw counts (sends and clicks per variant), not only percentages. Counts let anyone rerun the test or combine results later. A percentage alone hides the sample size.
A log you can write and query
A spreadsheet works for a small team. If you want the log under version control or readable by scripts, use JSON Lines: one JSON object per line, appended to a file. The next snippet defines an entry, appends it, and searches by tag.
import json
from dataclasses import dataclass, asdict, field
from typing import Optional
LOG_PATH = "experiments.jsonl"
@dataclass
class Experiment:
experiment_id: str
hypothesis: str
variable: str
primary_metric: str
baseline_rate: float
min_detectable_effect: float
sample_per_variant: int
stopping_rule: str
audience: str
tags: list = field(default_factory=list)
# Filled in after the test ends
sent_a: Optional[int] = None
success_a: Optional[int] = None
sent_b: Optional[int] = None
success_b: Optional[int] = None
p_value: Optional[float] = None
decision: Optional[str] = None
notes: str = ""
def append_entry(entry, path=LOG_PATH):
with open(path, "a", encoding="utf-8") as f:
f.write(json.dumps(asdict(entry)) + "\n")
def load_entries(path=LOG_PATH):
try:
with open(path, encoding="utf-8") as f:
return [json.loads(line) for line in f if line.strip()]
except FileNotFoundError:
return []
def find_by_tag(tag, path=LOG_PATH):
return [e for e in load_entries(path) if tag in e["tags"]]
plan = Experiment(
experiment_id="subject-test-2026-11",
hypothesis="A subject line naming the discount will raise click rate "
"from 2.0% to 2.5% versus a generic line.",
variable="subject line wording",
primary_metric="click rate (unique clicks / delivered)",
baseline_rate=0.02,
min_detectable_effect=0.005,
sample_per_variant=13792,
stopping_rule="Analyze once, after 48 hours and the full sample is delivered.",
audience="Active subscribers, last 90 days",
tags=["subject-line", "discount", "promo"],
)
append_entry(plan)
print(len(find_by_tag("discount")), "past test(s) tagged discount")The plan is saved before the send. After the test, you rewrite the same line, or append a second record with the same ID that holds the results. Appending a new record keeps the original plan intact for audit. Either way, the plan fields must not change.
Pre-registration in practice
Writing the plan first is called pre-registration. It matters because of a specific failure: after seeing results, people are tempted to switch the primary metric to whichever one moved. If click rate was flat but open rate rose, "the real goal was opens" is a convenient story. With a pre-registered plan, the metric on record decides.
Pre-registration also forces you to compute sample size before sending. If the required sample is larger than your list, you find that out on day one instead of after an inconclusive send.
Record the losses and the ties
Most tests will not produce a winner. With a well-powered test, a "no significant difference" result is information: the change does not move the metric by more than your minimum detectable effect. Log it with the same care as a win.
Teams that log only wins build a skewed picture. Real effects from subject lines are often small, and a log of only successes overstates what works. A log with all outcomes shows the true hit rate, which is useful for planning. If one in five tests wins, you know to budget five tests per improvement.
Record failed tests too: a send that went out with a broken link in one variant, or a test stopped because of a deliverability incident. Mark the decision as "invalid" and explain why. This stops someone from later reading it as evidence.
Reusing what you learned
A log earns its value when you consult it before designing a new test. Three habits help.
- Search before proposing. Tag by variable (
subject-line,send-time), by technique (question,personalization,emoji), and by audience. Check for earlier results before you write a hypothesis. - Treat each result as local. A finding is true for that list, that season, and that offer. A tie on one list does not prove a technique never works. A win on one list does not guarantee a win on another.
- Retest surprising wins. A significant result at the 5% level will be a false positive about one time in twenty when no real effect exists. If a result is unexpectedly large or will change a standing policy, rerun it on a fresh sample before adopting it as a rule.
Be careful about averaging effects across log entries. If you want to combine results, pool the raw counts only when the tests share the same variable, metric, and audience type. Otherwise, treat the log as a source of hypotheses, not as a dataset.
Building the testing program
A program has a repeatable cycle. The diagram shows one loop from idea to log.
The backlog
Keep a list of test ideas with a source for each: a past result, a customer complaint, a competitor email, an open question from the log. Ideas without a stated hypothesis stay in the backlog until they have one.
Prioritization
You cannot test everything, because each test uses audience. Every recipient in a test group sees a version that might be worse, and a small list supports few tests per month. Rank ideas on three questions:
- How big could the effect be, and how much is a lift worth in revenue or clicks?
- How confident are you in the idea, based on the log?
- How much effort does it take, and can the list supply the sample size?
A simple 1-to-5 score on each, multiplied or summed, is enough. The goal is a consistent order, not precision.
Cadence and capacity
Estimate how many tests you can run. If each test needs about 14,000 recipients per variant, a list of 100,000 sending weekly can support only a few tests per send before audiences overlap. Decide whether tests share a send (running two experiments on the same email, one for subject and one for send time, is a design problem, since effects can interact) or run in separate sends. Running one variable per send is the simplest rule, and the log makes it easy to check.
Also guard against recipient fatigue. If the same people are always in test groups, a version that underperforms hits the same subscribers repeatedly. Rotate which segments carry tests where you can.
Review
Hold a short monthly review. Look at tests run, tests that reached their sample, win rate, and average effect size of shipped winners. Compare shipped lifts with what the following campaigns actually delivered. If shipped winners consistently fail to show their lift in later sends, your tests may be underpowered, peeked at, or run with too many variants.
Common errors
- Editing the plan after seeing data. Change a plan field and the log can no longer separate prediction from hindsight. Add notes instead.
- Logging only percentages. Without counts, nobody can recompute or pool the result.
- Vague hypotheses. "See which subject line works better" does not name a variable, direction, or metric. The entry will not help a later test.
- No decision recorded. A result with no stated action leaves the next person guessing whether the winner was rolled out.
- Untagged entries. A log nobody can search is not reused. Agree on a small tag vocabulary and stick to it.
- Treating a log as proof. Past wins are evidence for new hypotheses, not guarantees.
Exercise
Your team has run 12 subject-line tests this year. Three reached p < 0.05 and were rolled out. The log records only percentages (for example, "B won, +0.4 points") and the decision. A colleague proposes a new test on the same technique, but you need to judge whether it is worth running. Name three things missing from the log that you would need, and explain how each changes your decision.
Show answer
You need raw counts per variant (sends and clicks), so you can see sample sizes and compute how precise each result was; a +0.4 point lift from 2,000 recipients is much weaker evidence than the same lift from 20,000. You need the pre-registered hypothesis and primary metric, so you can tell whether each win was predicted or found afterward, which affects how much to trust it. You need the audience and date for each test, so you can judge whether results from other lists or seasons apply to the new test. The 9 non-winning tests also need full records. Without them you cannot estimate the true hit rate (3 of 12 here), and the wins may overstate what the technique does. A reasonable next step is to retest the largest win on a fresh sample before building on it.