Skip to main content

Samarth Analytics

Sample Ratio Mismatch: The A/B Test Check to Run Before Reading Any Result

By Samarth Analytics · Published · CRO Audits · 8 min read

Summary: Sample ratio mismatch means an A/B test did not split its users in the ratio it was designed to, and when it happens the result cannot be trusted, however significant it looks. It is the first check we run on any test. This guide covers why a small imbalance invalidates a result, how to run the chi-square check, where to count users, the redirect, speed and tracking causes we find in audits, and a step-by-step diagnosis.

Sample Ratio Mismatch: The A/B Test Check to Run Before Reading Any Result

What is sample ratio mismatch?

Sample ratio mismatch means an A/B test did not split its users in the ratio it was designed to. A 50/50 test that ends with noticeably more users in one arm than chance allows has a broken assignment or measurement somewhere. Until the cause is found, the test result cannot be trusted, however significant it looks.

It is the first check we run when we review a test, before conversion rates, uplift or confidence intervals. It needs only two counts and catches problems that no later analysis can repair.

Why a small imbalance invalidates the result

A mismatch matters because it tells you the two groups are no longer comparable. Random assignment spreads every kind of user evenly across both arms, so the only systematic difference is the change being tested. When the counts drift from the planned ratio, some users have been added to or removed from one arm for a reason other than chance.

Those users are rarely a random slice. If a variant loads slowly and early leavers never get counted, the remaining arm holds more patient, often more motivated visitors, and the test reports a win the change did not produce. Because the bias comes from who was counted, no later statistical method can remove it.

How do you check for sample ratio mismatch?

Compare the observed user counts in each arm with the counts the planned ratio predicts, using a chi-square goodness-of-fit test. Most practitioners use a strict threshold such as a p-value below 0.001, because the check runs on every test and a looser one raises too many false alarms.

The arithmetic shows why eyeballing the split does not work. In an illustrative test with 20,000 users split 10,100 and 9,900, the p-value is about 0.16, which is ordinary noise. In a test with 100,000 users split 50,600 and 49,400, a near-identical share, the p-value is about 0.00015, which is a clear mismatch. The larger the test, the smaller the imbalance it takes to signal a real problem. This is the same relationship between sample size and certainty we describe in A/B testing sample size.

Where to count users, and where not to

Count users at the point where they were assigned to a variant, and count them the same way in both arms. The wrong counts can hide a mismatch or invent one.

The testing tool's own assignment log is usually the best source, because it records who was bucketed before anything else could go wrong. An exposure event in analytics, sent when the variant renders, is the second source, and comparing the two often reveals the cause. We avoid counting sessions or pageviews, which repeat for returning users and can differ between arms for legitimate reasons. We also avoid counting only users who reached a later step, since the test may genuinely change how many get there.

What causes sample ratio mismatch?

Most mismatches come from users being lost or added unevenly after assignment, not from the randomisation itself. In our experience the problems sit between bucketing a user and recording them.

Redirect tests are the classic case: users in the variant arm make an extra page load, and some leave before the analytics tag fires on the new page. Performance differences do the same thing more quietly: a heavier variant renders later, and visitors who bounce in that gap are counted in control but not in the variant. Bot filtering can be uneven when one variant changes page structure in a way that alters how automated traffic behaves, a pattern covered in bot traffic in GA4. Changing the allocation part way through a test also breaks the ratio.

Tracking causes we find in audits

When we audit a mismatched test, the cause is often in the tracking rather than the experience: the variant works for users, but its measurement does not.

The exposure event may be attached to a page element that exists in only one variant, or to a trigger that fires later in the variant because its layout changed. A tag may be blocked or delayed differently depending on consent choices if the variant moves the consent banner or changes when it appears, which is why we cross-check against the consent coverage audit. A site release during the test can break the variant's tracking but not the variant. None of these show in the headline results.

Diagnosing the cause, step by step

When the check fails, we stop reading the result and look for where the users went. We work through the same sequence on every test:

  1. Confirm the planned ratio, including any change to the allocation during the test, and rerun the check on the period with a single fixed ratio.
  2. Compare assignment counts from the testing tool with exposure counts in analytics for each arm, to see whether users were lost before or after the variant rendered.
  3. Split the user counts by day and look for the date the imbalance began, then match it against releases, allocation changes and campaign launches.
  4. Split by browser, device and operating system, since a variant that fails in one browser shows as a mismatch concentrated in that segment.
  5. Split by traffic source and new versus returning users, which reveals redirect losses, bot traffic and caching issues.
  6. Load the variant yourself on the slowest devices and browsers in the data and confirm the exposure event fires before the page is usable.

The segment where the gap concentrates usually points straight at the cause. A gap on one browser suggests a rendering problem; a gap only in paid traffic often involves redirects.

Should you ever ship a test that failed the check?

As a rule, no. A test that fails the sample ratio check has no trustworthy result, so the decision it seems to support is not supported at all. The right action is to find the cause, fix it, and run the test again.

There is one narrow exception. If the cause is a known period of broken tracking that hit both arms, and the check passes once that period is excluded, the remaining data can be read with care. We record that exclusion with the result, so anyone revisiting the test later, as we recommend in A/B test analytics beyond winner and loser, knows what was removed and why.

Building the check into every test

The check works best when it runs automatically, so nobody has to remember it. A test result should not be shown at all until the sample ratio check has passed.

We put it first in the test readout, run it daily while the test is live, and log the outcome with the test record. Teams that score and rank their experiments, as in using analytics to prioritise experiments, benefit most, because a test lost to a mismatch is a slot in the roadmap that has to be spent again.

Frequently asked questions

Does sample ratio mismatch apply to tests that are not split 50/50?

Yes. The check compares observed counts against whatever ratio the test was designed with, whether that is 50/50, 90/10 or three arms at equal shares. The chi-square test handles any planned ratio and any number of arms. Uneven designs deserve extra care, because a small arm can lose a meaningful share of its users before anyone notices.

Can the testing tool's own report be trusted to flag a mismatch?

Some testing tools flag a mismatch automatically, and it is worth turning that on where it exists. We still run the check ourselves on the counts the analysis actually uses, because the tool only sees its own assignment data. A mismatch introduced in the analytics tracking, after assignment, will not appear in the tool's report at all.

How early in a test is the check meaningful?

It is meaningful from the first day with a reasonable number of users, because it does not depend on the conversion rate or the effect size. Early checks are valuable precisely because a broken test can be stopped and fixed before it consumes weeks of traffic. Daily checks are fine as long as the strict threshold is kept, which keeps false alarms rare.

Does a passing check prove the test is valid?

No. A passing check rules out one serious class of problem, but a test can still be flawed through a novelty effect, an unrepresentative period, a broken conversion event or interference from another test running at the same time. We treat sample ratio as a gate the test must pass before its result is read, not as proof that the result is right.

Final thoughts

Sample ratio mismatch is the cheapest check in experimentation. Count users at assignment, compare them with the planned ratio using a strict threshold, and refuse to read any result that fails. When it does fail, the cause is usually in redirects, page speed or tracking, and the segments where the gap concentrates will point to it.

Our CRO audits include a review of how tests are assigned, tracked and read, starting with this check. If your test results have been surprising lately, a free audit is a good place to start.

Topics: statistical significance, experimentation, ab testing, post-test analysis, sample ratio mismatch

More articles on the Samarth Analytics blog · Markdown version of this article