---
title: "How A/B split testing a link works, and why a returning visitor sees the same page"
description: "An A/B test sends each visitor to one of two versions at random and compares what each group does. How a link splits traffic with a redirect, how a cookie ID and a hash keep a returning visitor on the same version, weights, sample ratio mismatch, and what a split cannot measure. Sourced to Kohavi et al., Microsoft Research and Google, with our own simulation."
canonical: "https://linkbreakers.com/help/article/how-ab-testing-a-link-works"
last-updated: 2026-11-30
---

# How A/B split testing a link works, and why a returning visitor sees the same page

> An A/B test sends each visitor to one of two versions at random and compares what each group does. How a link splits traffic with a redirect, how a cookie ID and a hash keep a returning visitor on the same version, weights, sample ratio mismatch, and what a split cannot measure. Sourced to Kohavi et al., Microsoft Research and Google, with our own simulation.

![A Traffic split on a Linkbreakers workflow canvas, in dark mode: a scan of the "Dinner flyer" QR code goes into a Traffic split step that sends 50% of visitors to "Menu" and 50% to "Book a table", and each variant leads to a redirect, one to the restaurant's menu page and one to its table booking page.](/screenshots/how-ab-testing-a-link-works-traffic-split-canvas.png)

## Short answer

An **A/B test** shows two versions of something, A and B, to two groups of people picked at random, at the same time, and compares what each group does. Each version is called a **variant**. Because chance alone decides who sees which, the variant is the only thing that differs between the two groups on average, so a difference in what they do can be put down to the variant.

On a link, the split happens on the server. A short link, or the QR code that holds it, points to a server, not to a page. At each click or scan, the server picks a variant and answers with a **redirect**, a short answer that tells the browser which address to open instead. Google describes the same setup for websites: you "redirect some of them to each of the variation URLs and then compare users' behavior".

The hard part is the visitor who comes back. If the server draws again on every visit, someone who opens a 50/50 link twice sees both versions one time in two, and three times in four after three visits (our simulation, below). The usual fix: on the first visit the browser gets an **ID** in a **cookie**, and the server passes that ID and the test's own ID through a **hash**, a calculation that turns any text into a number that looks random but is always the same for the same text. The number picks a **bucket**, for example from 0 to 99, and each variant owns a run of buckets sized by its percentage. The same ID always lands in the same bucket, so the visitor keeps the same version, and the server never has to remember who got what.

Two limits come with it. The cookie belongs to a browser on a device, not to a person: a new phone, a private window or an app's own browser arrives as a new visitor. And the split only decides where people arrive. What they do next, such as booking or buying, is measured where it happens, for example with a different tag on each version's address.

## What is A/B testing?

An A/B test, also called a **split test**, compares two versions of one thing by showing each to a different group of people over the same period. Version A is usually what you have now; version B is the change you want to try. Research calls them the Control and the Treatment. In the survey of web experiments by Kohavi, Longbotham, Sommerfield and Henne: "live users are randomly assigned to one of two variants: (i) the Control, which is commonly the "existing" version, and (ii) the Treatment, which is usually a new version being evaluated." A test can have more than two variants and still be called an A/B test.

### Why the groups are picked at random

**Randomization** means letting chance, not a person or a rule, decide who goes in which group. People who arrive on a Monday, from a poster near the station, or on an old phone can behave differently from the rest. If anything like that decided who saw which version, you could not separate the effect of the version from the effect of the people. With random groups, every kind of visitor ends up on both sides in about the same proportions. Then, in the survey's words, "the only thing consistently different between the two variants is the change between the Control and Treatment", which is what lets a test speak about cause and effect.

Running A one week and B the next is not the same test: anything else that changed that week, a holiday or the weather, gets mixed into the result. Both versions run side by side.

### The three rules for assigning people

The same survey sets out what any method of assigning visitors must do to give statistically correct results. Three properties are required:

1. "End users must be equally likely to see each variant of an experiment", on an even split. "There should be no bias toward any particular variant."
2. "Repeat assignments of a single end user must be consistent; the end user should be assigned to the same variant on each successive visit to the site."
3. "When multiple experiments are run, there must be no correlation between experiments."

The second rule is the subject of most of this page: a returning visitor keeps their variant.

## Why split traffic on a link

A test needs a point where each visitor can be sent one way or the other. A link is such a point. A short link, or a **dynamic QR code**, holds an address on a server rather than the page itself. When someone clicks or scans, their browser asks that server, and the server answers with a redirect: a status code and a `Location` header holding the address to open next. The browser follows it on its own; the visitor just sees a page load. [How a link redirect works](/help/article/301-vs-302-redirects-how-link-redirects-work) covers status codes in detail.

So the server can answer each visit with a different address: the menu for some visitors, the booking page for others. The link itself never changes, so a QR code already printed on flyers can start a test, and end it, with no reprint.

Google's guide to A/B testing describes this setup for websites: "You can run tests by creating multiple versions of a page, each with its own URL. When users try to access the original URL, you redirect some of them to each of the variation URLs and then compare users' behavior to see which page is most effective."

### Use a temporary redirect

The same guide is specific about the kind of redirect: "If you're running a test that redirects users from the original URL to a variation URL, use a 302 (temporary) redirect, not a 301 (permanent) redirect." A temporary redirect tells search engines to keep the original address in their index rather than replace it with the test page, Google explains. The guide names the 302; Google's page on redirects lists **303 See Other** with 302 and 307 among the temporary redirects. Linkbreakers answers every scan and click with a 303, so a test on a Linkbreakers link uses a temporary redirect in Google's terms.

Google's guide is written for websites in its search results. It also asks testers to run "the experiment only as long as necessary", and to show Googlebot the same pages as people.

## Weights: how much traffic each version gets

The **weight** of a variant is its share of the traffic, written as a percentage, and the weights add up to 100. A 50/50 split sends half the visitors to each version. A 90/10 split sends one visitor in ten to the new version, for example to try a change on few people first.

One way to apply weights is to number 100 buckets, 0 to 99, and give each variant a run of buckets in order:

| Split | Variant A owns | Variant B owns |
|---|---|---|
| 50/50 | buckets 0 to 49 | buckets 50 to 99 |
| 90/10 | buckets 0 to 89 | buckets 90 to 99 |
| 80/20 | buckets 0 to 79 | buckets 80 to 99 |

Each visitor gets a bucket, and the bucket decides the variant. How the visitor gets their bucket is where the methods differ.

## Three ways to assign a visitor, and what happens when they come back

### 1. A fresh draw on every visit

The server draws a random number on each visit and sends the visitor wherever it falls. Nothing is remembered. Over many visits, each version gets its share, so the first rule holds. The second does not: a person who comes back is drawn again, and can get the other version.

How often? We ran it: a fresh 50/50 draw on each visit, for 100,000 simulated people at each number of visits. Someone who opened the link twice saw both versions 50.0% of the time; three times, 74.9%; five times, 93.6%. The arithmetic, one minus the chance of getting the same version every time, gives 50%, 75% and 93.8%. Whatever such a person does next, you cannot say which version caused it, and they are counted on both sides.

**Returning visitors who saw both versions of a 50/50 test**

- **50.0%** after 2 visits, with a fresh draw each visit
- **0%** with sticky assignment

| Times the same person opened the link | Fresh 50/50 draw on every visit | Sticky hash (same ID, same bucket) |
|---|---|---|
| 2 visits | 50 % | 0 % |
| 3 visits | 74.9 % | 0 % |
| 5 visits | 93.6 % | 0 % |

Linkbreakers simulation, 30 November 2026: 100,000 simulated people for each number of visits, a fresh 50/50 draw on each visit (arithmetic: 50%, 75% and 93.8%). With the sticky hash, the same device ID gives the same bucket on every visit, so the share is 0% by construction.

### 2. Draw once, and remember the result

The survey's first method for keeping visitors on their variant is "pseudorandom with caching": draw a random number on the first visit, then store the result. "The caching can be accomplished either on the server side (by storing the assignments for all users in some form of database), or on the client side (by storing a user's assignment in a cookie)."

It meets the second rule, at a cost the authors spell out. The database grows with every user and every test. With many servers, "The server making the random assignment must communicate its state to all the other servers". And raising a variant's share later without reshuffling people "is difficult to implement using this method, and so many systems ignore the requirement altogether."

### 3. Hash and partition

The second method removes the storage: "This method eliminates the need for caching by replacing the random number generator with a hash function." It works in three moves.

1. **Each visitor gets an ID**, "maintained either through a database or a cookie". A **cookie** is a small piece of text a server asks the browser to keep and send back. The cookie standard, RFC 6265, describes the round trip: "the origin server includes a Set-Cookie header in an HTTP response. In subsequent requests, the user agent returns a Cookie request header to the origin server." The user agent is the browser. On the second visit, the browser brings the ID back by itself.
2. **Each test gets an ID** as well.
3. **A hash function is applied to the two IDs together.** A **hash function** turns any text into a number of fixed size. Unlike a random draw, it gives the same number every time for the same text, while different texts give numbers that look random. The survey: "a (good) hash function produces randomly distributed numbers as a function of a specific input." The number is cut down to a range, for example by keeping the remainder after dividing by 100, which gives a bucket from 0 to 99. "The range is then partitioned, with each variant represented by a partition": the runs of buckets from the weights above.

Same visitor and same test means the same text, so the same number, the same bucket and the same version, on every visit and on every server, with no assignment stored anywhere. This is **sticky assignment**: a returning visitor sticks to the version they got first. Optimizely's documentation describes the same method for its testing software: "The SDK uses the MurmurHash function to hash the user ID and experiment ID into an integer. That integer maps to one of 10,000 buckets, and each bucket corresponds to a variation."

### A worked example

Here is the calculation Linkbreakers makes, with short made-up IDs so each fits on one line (real IDs are long random strings). The hash is **SHA-256**, a widely used cryptographic hash. The bucket is its first 8 bytes read as one whole number, modulo 100. On a 50/50, buckets 0 to 49 go to A and 50 to 99 to B.

| Visit | Text that is hashed | Bucket | Version |
|---|---|---|---|
| Device 7f3a, first visit | `test-flyer:device-7f3a` | 98 | B |
| Device 7f3a, back a week later | `test-flyer:device-7f3a` | 98 | B |
| Device 2c91 | `test-flyer:device-2c91` | 1 | A |
| Device 7f3a, in another test | `test-poster:device-7f3a` | 45 | A |

Anyone can check a row, for example in Python:

```python
import hashlib
int.from_bytes(hashlib.sha256(b"test-flyer:device-7f3a").digest()[:8], "big") % 100  # 98
```

The last row shows why the test's ID goes into the hash. Hash the device ID alone, and device 7f3a would sit in bucket 98 of every test at once: the same people would always land at the same end of every split, against the third rule. With the test's ID mixed in, each test splits people on its own.

### Does a hash split fairly?

The first rule asks that each variant be equally likely, so the hash's numbers must spread evenly. We ran Linkbreakers' calculation on 1,000,000 random device IDs: each of the 100 buckets received between 9,749 and 10,233 of them (a chi-square of 100.2 on 99 degrees of freedom, about what a fair split gives), and a 50/50 sent 49.92% to the first variant. For the third rule, we ran 200,000 devices through two splits on one link: a device landed in the same variant of both 49.94% of the time, against 50% if the two are independent.

The choice of hash matters. Kohavi and his co-authors tested hash functions on one million sequential user IDs: "only the cryptographic hash function MD5 generated no correlations between experiments. SHA256 (another cryptographic hash) came close, requiring a five-way interaction to produce a correlation. Other hash functions (including the string hashing algorithm built into .net) failed to pass even a two-way interaction test."

### The three methods side by side

| | Fresh draw on every visit | Draw once and store it | Hash and partition |
|---|---|---|---|
| What is kept | Nothing | The assignment, in a database or a cookie | An ID in a cookie; the assignment is recomputed |
| A visitor who comes back | Drawn again: 50.0% saw both versions after 2 visits, 93.6% after 5 | Same version | Same version: 0% saw both |
| Several servers | Nothing to share | Must share every stored assignment | Same inputs, same answer on any server |
| Raising a variant's share | Applies from the next visit | Hard without reshuffling people, per the survey | Only the buckets that change owner move |
| Fits | Sharing traffic, not measuring | A test, at a storage cost | A test |

## What the ID cannot do

The ID lives in a cookie, and a cookie belongs to one browser on one device. Sticky assignment keeps a **device** on the same version, not a person.

- **Another device.** The same person on a phone and a laptop has two IDs, and can get two versions.
- **Private browsing.** The cookie does not outlive the private window, so each private session arrives as a new visitor.
- **Cleared cookies.** The ID is gone, and the next visit gets a new ID and a new bucket.
- **In-app browsers.** An app that opens links in its own browser, as Instagram or TikTok can, keeps its own cookies apart from Safari's or Chrome's. Someone who scanned with the camera and later taps the same link inside an app arrives with no ID. [How in-app browsers work](/help/article/how-in-app-browsers-work) explains why.
- **Crawlers.** Google notes that "Googlebot generally doesn't support cookies", so a crawler arrives new every time.

Each of these visitors is put in a bucket by the same weights as everyone else, so both versions get their share of them. The cost is noise: one person can be counted as two visitors, and can see both versions. We know of no reliable figure for how often this happens, so this page gives none.

## Changing the weights during a test

You may want to start a new version on 10% of visitors and raise it once it holds up. The survey names the property that makes this safe, as optional but desirable: "monotonic ramp-up, meaning that the percentage of users who see a Treatment can be slowly increased without changing the assignments of users who were previously assigned to that Treatment."

Hash and partition gets it for free, as long as the variants keep their order. Going from 90/10 to 80/20 moves the boundary from bucket 90 to bucket 80: buckets 80 to 89 change from A to B, and nothing else moves. In our simulation on 1,000,000 devices, that change moved 10.01% of them, all from A to B and none the other way. Everyone already on B stayed on B.

Two cautions. Reordering or removing a variant shifts every run of buckets after it, so many people move at once. And the visitors counted before the change were split by the old weights, so the totals stop matching the new ones, which the check below can flag.

## Checking the split: sample ratio mismatch

Before comparing what the groups did, check that they are the size you asked for. A **sample ratio mismatch** (SRM) is, in the definition of Fabijan and his co-authors, published by Microsoft Research, "the situation when the observed sample ratio in the experiment is different from the expected." If one side of a 50/50 gets clearly more visitors than chance allows, something in the assignment or the counting is off, and the comparison may not be fair. It is not rare: "At Microsoft, a recent analysis showed that about 6% of A/B tests have an SRM."

Microsoft Research lists causes at every stage of a test, among them "incorrect bucketing of users, faulty User IDs", "redirecting users in one variant", and testers "ramping up the experiment variants unevenly".

### Why a glance at the percentages is not enough

A split never lands exactly on its weights, and how far it drifts depends on how many visitors there are. On a 50/50, this is how close the first version's share lands, from the exact binomial calculation:

| Visitors | The first version's share lands within | In this share of tests |
|---|---|---|
| 100 | 10 points of 50% (40% to 60%) | 96.5% |
| 1,000 | 3.1 points | 95.4% |
| 10,000 | 1.0 point | 95.1% |

So 45% against 55% is ordinary at 100 visitors and a warning sign at 10,000. Microsoft Research: "it is not sufficient to glance only at the ratio of users in A vs. B. The ratio lacks information about the sample size. We need to use a statistical test such as a chi-square statistic". A **chi-square test** compares the counts you got with the counts the weights predict, and gives a **p-value**: how likely a gap at least this big would be by chance alone. The same 52% against 48% gives a p-value of about 0.57 at 200 visitors, 0.21 at 1,000 and 0.00006 at 10,000. Microsoft's own threshold is "p-value < 0.0005".

## What an A/B test on a link cannot tell you by itself

The split decides where each visitor arrives. It does not see what they do there: whether they read the menu, booked a table or bought something. That happens on the destination page, or later, and has to be measured there, per group.

A simple way to keep the two groups apart in your website's analytics is to send each version to an address with its own tag, for example `utm_content=menu` on one and `utm_content=book_a_table` on the other. [How UTM parameters work](/help/article/how-utm-parameters-work) explains what those tags do, and what they cannot. Compare the outcome per tag, once each group has enough visitors for the difference to stand out from chance.

## A/B testing a link in Linkbreakers

In Linkbreakers, every QR code and short link runs a workflow on each scan or click, and the **Traffic split** step is its A/B test. It sends each visitor to one of 2 to 20 variants, by whole percentages that add up to exactly 100, with the hash and partition method:

- **The bucket** is the first 8 bytes of SHA-256 of the step's ID and the device ID, modulo 100. Variants own their buckets in the order they are listed. Nothing is stored, so every server gives the same answer on every visit, and two splits on the same link each assign on their own.
- **The device ID** comes from a first-party cookie, `linkbreakers.browser`, on the short link's domain. It lasts a year and is renewed on every scan. Each workspace sees its own device ID, derived from that cookie.
- **Keep returning visitors on the same variant** starts checked on every new split. The editor says: "A returning visitor keeps the same variant. It follows the device: a new device, private browsing or some in-app browsers count as a new visitor." Unchecked: "Every visit is assigned afresh, so one person can see several variants. This suits sharing traffic more than measuring a test." One visit still stays on one variant, including when it continues after a form.
- **Results**, in the step's editor, list each variant's **Set** percentage, its **Actual** share of visitors, its **Visitors** and its **Visits**. Until each variant has 100 visitors, they read "Not enough data yet. Each variant needs 100 visitors before these numbers mean much." Bots and link previews are left out.
- **The sample ratio check** runs a chi-square test against your percentages at p = 0.001, once every variant was due at least 100 visitors. When the split fails it, the warning reads: "The real split is far from the percentages you set, more than chance explains. If you changed them during the test this is expected. If not, check that each variant's path works before comparing them."
- **No winner is named.** The step counts who was sent where. It measures no outcome and runs no significance test on one: you read the numbers and decide.
- **To end a test**, set one variant to 100 and the others to 0, keeping the order. A variant at 0 is never picked, so every visitor, returning ones included, goes to the one at 100.

Each variant then leads to its own next step, usually a redirect, answered with a 303. [How to A/B test a QR code or link with a traffic split](/help/article/how-to-ab-test-a-qr-code-or-link-with-a-traffic-split) walks through the setup and the results screen.

### What that gives you

A restaurant hands out flyers with a QR code, and the owner does not know what people want once they scan: the menu, or a quick way to book. The owner puts a Traffic split behind the code. Half the scans go to the menu, half straight to booking a table, and each address carries its own `utm_content` tag. A diner who scans again a week later with the same phone gets the same page, so they count on one side only. Linkbreakers shows how many visitors each side received, and the restaurant's website analytics or booking tool can show how many bookings came with each tag. Once the answer is clear, the owner sets the winning side to 100: every flyer already handed out opens that page from the next scan, with no reprint.

## Limits and caveats

- **Our numbers come from a simulation, not from visitors.** Random IDs run through Linkbreakers' calculation, and exact binomial arithmetic, on 30 November 2026.
- **Device, not person.** A cookie cannot recognise a person across devices, private windows or cleared cookies, and we have no figure for how often that happens.
- **Google speaks for Google Search.** Its testing guide is about websites in its results; it says nothing about QR codes.
- **Vendors are quoted as sources.** Optimizely's and Microsoft's documents are quoted for how they describe their own methods and data, not as recommendations.
- **Analysing outcomes is a separate question.** Deciding whether a difference in bookings or sales is real needs its own statistical test; this page covers how traffic is split, not how to analyse what follows.

## Frequently asked questions

### What is A/B testing, in simple words?

Showing two versions of something to two groups picked at random, over the same period, and comparing what each group does. Because chance decides the groups, the version is the only systematic difference between them, so a difference in what they do can be put down to the version.

### Is split testing the same as A/B testing?

Yes. The survey by Kohavi and his co-authors lists "randomized experiments, A/B tests (and their generalizations), split tests, Control/Treatment tests" among the names of the same controlled experiment. "Split" describes what happens to the traffic.

### Will a returning visitor see a different version of my link?

Not with sticky assignment, as long as they come back on the same browser with the same cookie. With a fresh draw on every visit, someone who opens a 50/50 link twice sees both versions half the time.

### Should an A/B test use a 302 redirect?

Google asks for a temporary redirect, not a permanent 301, when a test redirects users from the original address to variation URLs. It names 302, and its redirects page lists 303 and 307 as temporary too. A 301 says the move is permanent, which a test is not.

### How many visitors does an A/B test on a link need?

Enough for chance to stop deciding the result. On a 50/50, the split alone drifts by up to about 10 points at 100 visitors, 3 at 1,000 and 1 at 10,000, in 95 tests out of 100 or more. Linkbreakers shows "Not enough data yet" until each variant has 100 visitors. How many you need to tell two outcomes apart depends on how far apart they are, and is a separate calculation.

### Is the hash random?

No, and that is the point. A hash gives the same number for the same input every time, so the assignment can be recomputed instead of stored. Over many different IDs its numbers spread evenly, like a random draw: in our run, 1,000,000 IDs filled 100 buckets with between 9,749 and 10,233 each.

## Sources

1. Ron Kohavi, Roger Longbotham, Dan Sommerfield and Randal M. Henne, [Controlled experiments on the web: survey and practical guide](https://ai.stanford.edu/~ronnyk/2009controlledExperimentsOnTheWebSurvey.pdf), Data Mining and Knowledge Discovery 18 (2009), pages 140 to 181, doi 10.1007/s10618-008-0114-1: the abstract, section 1 and section 5.1, "Randomization algorithm"
2. Aleksander Fabijan, Jayant Gupchup, Somit Gupta, Jeff Omhover, Wen Qin, Lukas Vermeer and Pavel Dmitriev, [Diagnosing Sample Ratio Mismatch in Online Controlled Experiments: A Taxonomy and Rules of Thumb for Practitioners](https://www.microsoft.com/en-us/research/publication/diagnosing-sample-ratio-mismatch-in-online-controlled-experiments-a-taxonomy-and-rules-of-thumb-for-practitioners/), KDD 2019
3. Microsoft Research, [Diagnosing Sample Ratio Mismatch in A/B Testing](https://www.microsoft.com/en-us/research/articles/diagnosing-sample-ratio-mismatch-in-a-b-testing/) (14 September 2020, read 30 November 2026)
4. Google Search Central, [A/B Testing Best Practices for Search](https://developers.google.com/search/docs/crawling-indexing/website-testing) (last updated 10 December 2025, read 30 November 2026)
5. Google Search Central, [Redirects and Google Search](https://developers.google.com/search/docs/crawling-indexing/301-redirects) (last updated 16 November 2026, read 30 November 2026)
6. IETF, [RFC 6265, HTTP State Management Mechanism](https://www.rfc-editor.org/rfc/rfc6265) (April 2011), section 3
7. Optimizely, [How bucketing works, Feature Experimentation](https://docs.optimizely.com/feature-experimentation/docs/how-bucketing-works) (read 30 November 2026)
8. Linkbreakers simulation, 30 November 2026: Linkbreakers' assignment (the first 8 bytes of SHA-256 of the step ID, a colon and the unit, modulo 100, variants walked in order) reimplemented in Python with a fixed seed, run on 1,000,000 random device IDs; 100,000 simulated people for each number of visits with a fresh draw; and the exact binomial for 100, 1,000 and 10,000 visitors
9. Linkbreakers api and app code, read 30 November 2026: the Traffic split step, its bucket calculation, the `linkbreakers.browser` cookie, the editor's labels and the Results screen with its sample ratio check

## Last reviewed

30 November 2026, by Laurent Schaffner: the survey by Kohavi et al., Microsoft Research's article and paper, Google's two guides, RFC 6265 and Optimizely's documentation read at the source; the assignment, the drift and the returning-visitor numbers measured with our own simulation of Linkbreakers' code; the Traffic split step checked in the app and the api.
