Definition
Sticky assignment means that a visitor placed in a test variant keeps that variant on every later visit, and ideally on every device. In a price test it guarantees that someone who saw $39 on Monday still sees $39 on Friday, which protects both the customer's trust and the accuracy of the results.
- Store each assignment once it is made, because recomputing it from changing traffic weights moves visitors between prices.
- Signed-in users should keep their price across devices through their user ID.
Sticky assignment is a promise to the visitor: the price you saw is the price you'll keep seeing. Say a visitor lands on your pricing page and the test shows her $39. If she comes back three days later in the same browser, or signs in from her laptop, she should see $39 again, never $29 one day and $39 the next.
How to calculate it
The usual method hashes a stable visitor ID into a bucket and maps buckets to variants:
bucket = hash(experiment ID + visitor ID) mod 10,000
variant = the price whose cumulative weight range contains the bucketExample: with a 50/50 split, buckets 0 to 4,999 get $29 and buckets 5,000 to 9,999 get $39. A visitor whose ID hashes to bucket 4,000 gets $29 on every visit, with no database lookup.
That only works while the weights stay fixed. If a bandit moves the split to 30/70, $29 now covers buckets 0 to 2,999, and the same visitor in bucket 4,000 flips to $39. So any test whose weights change has to store each visitor's assignment the first time it is made, in a signed cookie or a database row, and reuse it from then on.
Why it matters for pricing
Visitors compare notes. In September 2000, Amazon shoppers found that deleting their cookies changed the discounts they were offered on popular DVDs, by as much as $15; Amazon said the prices came from a random test, and forum users called it "sneaky" and "unethical" (BBC News). A price that changes between visits looks like manipulation even when the assignment is random.
It also protects the data. A visitor who sees two prices belongs to neither group, and if they buy, the purchase gets credited to whichever price they saw last.
Leverprice keeps visitors on their price with an HMAC-signed first-party cookie. With a user ID, hashed on your server before it is used, a signed-in person gets the same bucket on every device: under a fixed split that means the same price everywhere, while under automatic optimization a new device can land on a different price once traffic has shifted.
Common mistakes
- Randomizing on every page view instead of once per visitor.
- Recomputing assignments from the current weights in a test whose split changes over time.
- Relying on a cookie alone for signed-in users, who then see a different price on their phone.
- Letting the browser decide which price to charge. Check the assigned price on your server at checkout, as in server-side price testing, or a visitor can edit the page and pay the cheapest one.
Related terms
Assignment happens before exposure, the moment the visitor actually sees the price, and it decides who sits in the control group. Unlike personalized pricing, which sets prices from data about the person, a test assignment is random and only remembered. Price discrimination is the broader term for charging different customers different prices.
Frequently asked questions
What happens when a visitor clears their cookies?
They look like a new visitor and may be assigned a different price, unless they sign in and the test recognizes them by user ID. That's one reason to keep every tested price within a range you'd be comfortable explaining to any customer.
Should a returning visitor keep the price they first saw months ago?
For as long as the test runs, yes. Once you pick a winner, new visitors see the winning price, and existing subscribers keep what they bought unless you decide to change it.