Sub topic 12
Test One Variable and Read the Result
This chapter assumes you have read the earlier chapters on choosing one goal, defining its success metric, and writing one primary CTA. It also assumes you know open rate and click-through rate, and that your email tool can split a list into groups. The Python example is optional and needs only the standard library.
An A/B test compares two versions of an email to see which one moves your goal metric more. The test only teaches you something if the two versions differ in one thing and you judge them by the metric you chose before sending.
Why change only one variable
Suppose version B has a new subject line, a new button colour, and a shorter body. It wins. You cannot tell which change helped, whether one helped while another hurt, or whether the gain was luck. You have a winner but no lesson to reuse.
Changing one variable means the only systematic difference between the groups is the thing you changed. Any gap in results comes from that change or from random noise. The rest of this chapter is about telling those two apart.
Choose the variable and the metric together
Each variable affects a different step on the path to the goal. The metric you judge on has to sit at or near the end of that path.
| Variable | What it changes | Judge it on |
|---|---|---|
| Subject line | Whether people open | Goal metric, with open rate as a secondary read |
| Preheader | Whether people open | Goal metric, with open rate as a secondary read |
| CTA copy | Whether openers click | Goal actions per delivered email |
| Button design or placement | Whether openers see and press the CTA | Goal actions per delivered email |
| Order of content | Whether readers reach the CTA | Goal actions per delivered email |
In the running example, the goal is trial starts from email clicks. That makes the winning metric trial starts per delivered email, not opens and not raw clicks.
- A subject line can lift opens and still lower trial starts if it attracts the wrong readers.
- Open rate is also unreliable on its own. Some mail clients preload images, which records an open that no person made.
- Raw clicks can be inflated by security scanners that follow every link in a message. A conversion on your own site is harder to fake.
Use the denominator of delivered emails, not opens, so the subject line's effect on opens stays inside the result.
Write the hypothesis before you send
Write one sentence in this form: "Changing X to Y will raise metric M for audience A, because R." For example:
"Changing the button text from 'Get started' to 'Start your free trial' will raise trial starts per delivered email among free-plan subscribers, because the new text names the action and the outcome."
The "because" part matters. If the test loses, you know which belief to revise. Also write down these before you send:
- The metric and its denominator.
- The smallest improvement worth acting on, for example "at least 0.5 percentage points".
- The sample size per group.
- The date you will read the result.
Fixing these in advance stops you from picking whichever number looks best afterwards.
Set up the split
Follow these rules when you build the test.
- Split the audience at random into equal groups. Do not split by signup date, alphabet, or location, because those groups differ before the email arrives.
- Send both versions at the same time. A Tuesday-morning send against a Friday-evening send tests the day, not your change.
- Keep everything else identical: sender name, links, destination page, and campaign parameters apart from a variant label.
- Tag each variant's link so the conversion can be traced to the right group, for example
utm_content=cta_aandutm_content=cta_b.
Sample size matters more than most beginners expect. If a typical trial-start rate is 3%, each group needs thousands of recipients to detect a change of a few tenths of a point. Many email tools include a sample-size calculator. With a small list, test bigger changes, because they are easier to detect, or accept that the test can only rule out large effects.
Read the result
Raw rates can mislead. Say the control converts 120 of 4,000 delivered emails (3.0%) and the variant converts 156 of 4,000 (3.9%). The variant looks 30% better. But if you ran the same email twice to two random groups, the rates would still differ a little by chance. The question is whether this gap is bigger than chance would usually produce.
A two-proportion z-test answers that. It returns a p-value, which is the probability of seeing a gap this large if the two versions actually performed the same. A small p-value, conventionally below 0.05, means chance alone is an unlikely explanation. Most email tools report this for you. The code below shows what they compute, so you can check a result by hand.
from math import sqrt, erfc
def two_proportion_test(conv_a, n_a, conv_b, n_b):
"""Compare two conversion rates. Returns rates, difference, z and two-sided p."""
rate_a = conv_a / n_a
rate_b = conv_b / n_b
pooled = (conv_a + conv_b) / (n_a + n_b)
std_err = sqrt(pooled * (1 - pooled) * (1 / n_a + 1 / n_b))
z = (rate_b - rate_a) / std_err
p_value = erfc(abs(z) / sqrt(2)) # two-sided
return rate_a, rate_b, rate_b - rate_a, z, p_value
rate_a, rate_b, diff, z, p = two_proportion_test(120, 4000, 156, 4000)
print(f"Control: {rate_a:.2%} Variant: {rate_b:.2%}")
print(f"Difference: {diff * 100:.2f} percentage points")
print(f"z = {z:.2f}, p = {p:.3f}")This prints a difference of 0.90 percentage points, z of about 2.20, and p of about 0.027. Since 0.027 is below 0.05 and the gap exceeds the 0.5-point threshold set in advance, this is a clear win for the variant.
Read the number with these limits in mind:
- A p-value is not the probability that the variant is better. It only measures how surprising the gap would be if there were no real difference.
- Statistical significance is not the same as business value. A significant 0.05-point gain may not justify any extra work.
- The measured lift is an estimate. A true effect of +0.3 points and one of +1.5 points could both have produced this result, so do not promise the full 30% to anyone.
Edge cases and common failure modes
- A tie. If p is high and the gap is small, the test found no detectable effect. Keep the control, note that the variable did not matter at this sample size, and move on to a bigger change. A tie is a valid result.
- Several variants at once. Each extra variant is another chance for a lucky winner. Test two versions at a time unless your list is large enough to give each group a full sample.
- Opens up, goal metric flat. This usually means the subject line promised something the body did not deliver. Keep the control, and consider whether the subject and preheader still match the single goal.
- Winner is only one segment. If you slice the result into many segments after the fact, one will look better by chance. Treat segment patterns as ideas for a new test, not as findings.
- One-off effects. A novelty effect can inflate a new design for one send. A discount mentioned in one variant can also pull forward conversions that would have happened anyway. For important changes, repeat the test on a later send before making it permanent.
- Different goals per group. If the variant links to a different page or offer, you changed the CTA's destination, which is a second variable. Keep the destination and the goal identical.
- Late conversions. A trial may start days after the click. Choose a conversion window, such as seven days, in advance and apply it to both groups.
Record the decision
After each test, write down the hypothesis, the two versions, the sample sizes, the rates, the p-value, and what you will do next. Over a few months this log becomes a set of rules specific to your audience, such as "naming the outcome in the button text helps" or "emoji in the subject do not change trial starts." It also stops you from re-running tests you have already answered.
Exercise
A teammate wants to test a new subject line, a new button colour, and a shorter first paragraph in one B version, judged by open rate. Name two problems with this design and describe a better one for a trial-start goal.
Show answer
First, three variables changed at once, so a win cannot be attributed to any one of them. Second, open rate is the wrong metric: it only measures the subject line's effect, is distorted by image preloading, and does not show whether anyone started a trial. A better design changes one variable, for example only the subject line, splits the list at random, sends both versions at the same time, and compares trial starts per delivered email over a fixed window such as seven days, after setting the sample size and read date in advance.
Exercise
A test sends each version to 5,000 delivered recipients. Control gets 150 trial starts and the variant gets 165. Using the function above, would you expect this to be significant at p < 0.05? What should you do?
Show answer
Run twoproportiontest(150, 5000, 165, 5000). The rates are 3.0% and 3.3%, a difference of 0.3 points. The result is z of about 0.87 and p of about 0.38, which is not significant. The gap is well within what chance produces at this sample size. Keep the control, record the test as inconclusive, and either test a larger change or use a bigger sample rather than declaring the variant a winner.