A/B tests
Updated 2026-11-06
Set up a test
- Create a goal. The goal is what the test is judged on.
- Create a test in the dashboard, the API or the MCP server. Use the Plan a test box first to see how long it will take at your traffic.
- Add the code it returns, ship it, and start the test.
const variant = window.headstream?.variant("pricing-headline", ["control", "treatment"]) ?? "control";
The first variant is the original. An uneven split adds weights, such as [90, 10].
Settings
| Setting | Default | What it does |
|---|---|---|
| Judge on | Conversion | The goal's conversion rate, or revenue per visitor |
| Secondary goals | None | Reported, never used to decide |
| Guardrails | None | Goals or revenue that must not get worse. Mark ones where lower is better, such as refunds |
| Confidence | 95% | How sure a result must be before it counts |
| Smallest lift worth finding | 20% | Sets the plan and how the test weighs evidence |
| Minimum visitors per variant | 100 | No decision before this many measured visitors |
| Minimum days | 7 | No decision before this, so weekday and weekend traffic both count |
| Conversion window | 7 days | How long after first seeing a variant a conversion or payment counts |
| Stop with no winner after | 60 days | The test ends without a winner at this point |
Settings that change the statistics lock when a test starts. Alerts, digests, recipients, automatic decisions and the time limit can change at any time.
Reading results
Each test shows one of these:
| Status | Means |
|---|---|
| Collecting data | A minimum isn't met yet. Keep waiting |
| Not enough traffic | At this traffic, the planned lift can't be found before the time limit |
| Inconclusive | Minimums met, no difference found yet, or two variants tie |
| Winner found | One variant beats the original, no guardrail got worse, and every check passed |
| Harmful | A variant is worse than the original, or a guardrail got worse |
| Tracking problem | The split doesn't match the plan, exposures stopped, or the code sends unknown variant names. Fix this before reading anything else |
For each variant you see the lift, a likely range, the chance it beats the original, and a p-value with the threshold it needs.
Lift over time charts each variant's cumulative lift by the day visitors first saw it, with the same likely range. Use it to see whether a result is settling or still swinging. The range is valid on every day, so a day where it clears zero means the same as the table. Points start once the first visitors' conversion window closes.
How results are calculated
- Visitors count from the first time they see a variant. Bots are left out.
- Measured visitors are those whose conversion window has closed. Only they count toward a decision, so slow outcomes like a payment a week later count the same in every variant.
- Revenue per visitor is payments from identified customers inside the window, divided by every measured visitor. Visitors who never identify count as zero in every variant alike. Payments in your main currency count; others are left out. Each customer's revenue is capped at the top 1% of customers in the test, once there are 20 paying customers, so one unusually large deal can't decide it.
- The test is a mixture sequential probability ratio test. Its p-values and ranges stay valid however often anyone looks, so you can check every hour. A plain significance test checked 20 times finds a fake winner about 24% of the time; this one did so 1.25% of the time in 2,000 simulated tests with no real difference.
- Several variants or metrics share one error budget. With three variants, each comparison needs p below 0.025 at 95% confidence.
- The split is checked with a chi-square test. A mismatch below p = 0.001 marks the test as a tracking problem.
- Thin data is never called. No result counts with fewer than 30 measured visitors per variant, whatever the settings.
Alerts and progress emails
Turn on alerts to get an email when a test reaches its minimums, finds a winner, turns harmful, can't finish at this traffic, hits its time limit, has a tracking problem, or stops. Each alert is sent once per run, even when results move back and forth. Progress emails go daily or weekly. Both go to the addresses you list, or to the organization's owners and admins.
Automatic winners
Off unless you turn it on for a test. When on, Headstream checks hourly and acts only when every check passes:
- A winner with no guardrail harm: stops the test and rolls out the winner.
- The original beats every variant, or a guardrail got worse: stops and keeps the original.
- The time limit with no winner: stops and keeps the original.
It never acts on a tie, an inconclusive result, thin data, or a tracking problem. Every decision is emailed with its evidence and kept in the test's history.
Rollouts
A rollout serves one variant to every visitor through the script, without a code change. Visitors switch within about half an hour. Roll out any variant of a stopped test, or undo a rollout, from the dashboard, the API or the MCP server. Then ship the winner in your code and remove the test.
If you send events through your own proxy, forward /rollouts as well as /collect.
Related
- Goals define what a test is judged on.
- The API and MCP server can create, read and stop tests.