Dynamic pricing detection is a controlled experiment that measures whether a site shows different prices for the same product under different conditions. The condition is one of four variables: time, location, device or session. Each measurement changes only one of them and holds the rest fixed. The trap is noise: stock, promotions and exchange rates also move the price and can look like personalized pricing. This post covers the experiment setup, parallel requests, the number of rounds, separating noise and the results table.
The four variables
A price difference only carries information when it can be tied to a single cause. Sites can change a price by time, by the visitor's location, by device or by session history. We explained the concept and its types in What Is Dynamic Pricing?. The goal here is to work out which of these variables moves the price.
| Variable | What changes | What stays fixed |
|---|---|---|
| Time | Hour and day of the measurement | Location, device, clean session |
| Location | Country or city of the exit IP | Hour, device, IP type, language header |
| Device | Desktop or mobile User-Agent | Hour, location, session |
| Session | Cookies, login, visit history | Hour, location, device |
Time is measured differently from the others. Location, device and session are compared across arms at the same moment. Time is measured by repeating the same arm at different hours: at the same times every day, for at least a week. That is the only way a weekday versus weekend difference shows up.
The one-variable rule
A controlled experiment has two arms: control and variant. The control is the default condition, and the variant is identical except for one difference. If two variables change at once, you cannot attribute the resulting gap to either of them.
The most common mistake happens in location tests. The control arm goes out through the office connection, the location arm through a proxy. Now not only the country has changed, the IP type has too. A site can treat a home connection and a data center IP differently. Route the control arm through the same type of proxy and change only the country.
For the location arm, use a Residential Proxy that exits in the target country. Keep the language header the same in both arms. If Accept-Language changes, the site switches the language version. Then you cannot tell whether the gap comes from the language or the location. We covered the reasons behind cross-country differences in Geo-Pricing Explained.
The measured product must stay fixed too. Measure the same URL, the same size and color option, and the same seller. On a marketplace, one product page carries several sellers. When the featured seller changes, the price changes with it.
Clean session
A clean session is a client with no cookies, no login and no visit history. Every measurement starts with an empty cookie jar. That way a cookie picked up in one round does not affect the price in the next.
Cookies live in the client, not in the proxy. In Python, a requests.Session carries a cookie jar and is closed when the measurement ends. We showed how the jar is set up in Cookies With a Proxy.
When you test the session variable, both arms must be under your control. The control arm is a clean session. The variant arm is a session logged in with your own test account, or one that has opened the product a few times beforehand. Do not use someone else's account.
In a multi-page measurement, the IP must also stay fixed throughout the flow. If the product page, cart and checkout summary do not come from the same address, the site may reset the session. The price is then recalculated. Use a Sticky Proxy for these measurements and pick a duration between 1 and 60 minutes to match the length of the flow.
Parallel requests
The arms must run at the same time. A few minutes between two sequential requests is enough for a promotion to start or stock to change. The gap then comes from the clock, not the variant.
The Python script below opens three arms at once in every round. The two control arms are identical, and the third arm sends a mobile User-Agent. It reads the price from the page's schema.org Offer data: price, priceCurrency and availability.
import csv, json, re, time
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime, timezone
import requests
URL = "https://shop.example/product/12345"
PROXY = "http://user:pass@pr.proxynet.io:8000"
PROXIES = {"http": PROXY, "https": PROXY}
DESKTOP = ("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) "
"Gecko/20100101 Firefox/133.0")
MOBILE = "Mozilla/5.0 (Android 14; Mobile; rv:133.0) Gecko/133.0 Firefox/133.0"
# The two control arms are identical: the gap between them is the noise floor
ARMS = {
"control-a": {"User-Agent": DESKTOP},
"control-b": {"User-Agent": DESKTOP},
"mobile": {"User-Agent": MOBILE},
}
ROUNDS, INTERVAL_S = 10, 900 # 10 rounds, 15 minutes apart
JSONLD = re.compile(
r'<script[^>]*application/ld\+json[^>]*>(.*?)</script>', re.S)
def offer(html):
"""Price, currency and availability from the page's schema.org Offer."""
for block in JSONLD.findall(html):
try:
data = json.loads(block)
except json.JSONDecodeError:
continue
if isinstance(data, dict) and "offers" in data:
o = data["offers"]
o = o[0] if isinstance(o, list) else o
return o.get("price"), o.get("priceCurrency"), o.get("availability")
return None, None, None
def measure(rnd, arm, headers):
with requests.Session() as s: # empty cookie jar for every measurement
r = s.get(URL, headers=headers, proxies=PROXIES, timeout=30)
price, currency, stock = offer(r.text)
ts = datetime.now(timezone.utc).isoformat(timespec="seconds")
return [rnd, ts, arm, r.status_code, r.url, price, currency, stock]
with open("measurements.csv", "w", newline="", encoding="utf-8") as f:
writer = csv.writer(f)
writer.writerow(["round", "time", "arm", "status", "final_url",
"price", "currency", "stock"])
for rnd in range(1, ROUNDS + 1):
with ThreadPoolExecutor(max_workers=len(ARMS)) as pool:
jobs = [pool.submit(measure, rnd, a, h) for a, h in ARMS.items()]
for job in jobs:
writer.writerow(job.result())
f.flush()
if rnd < ROUNDS:
time.sleep(INTERVAL_S)Three details make the script work. Each measurement opens its own Session object, so no cookie carries over to another arm or round. The proxy is passed to every request with proxies=, because the HTTP_PROXY environment variable can override the session.proxies setting. The final URL is recorded too. A site may redirect you to another country version.
If the page has no JSON-LD, you read the price from the HTML with a selector. Check once by hand that the selector finds the same element in both arms. The mobile version uses a different template, and the price may sit in a different element.
Rounds and the control gap
One round is not enough for a verdict. Sites also run random A/B tests, and a single difference can appear by chance. Repeat the round a fixed number of times decided in advance, for example 10 rounds 15 minutes apart. Do not change the number once the measurement has started.
Two identical control arms, an A/A comparison, show the noise floor. If control-a and control-b see different prices, the site is showing different prices to visitors under the same condition. In that case a variant gap proves nothing on its own.
Write the decision rule before measuring as well. Here is an example rule: if the control arms are equal in every round and the variant differs in the same direction in every round, the difference is consistent. A difference that appears in only some rounds counts as noise.
In a location test, use a new IP in every round. The history of a single IP can produce the gap too. A difference that repeats across different IPs belongs to the location.
Separating noise
Noise is anything that moves the price independently of the variable you are testing. Add fields to each measurement row that separate it out.
| Noise source | Symptom | How to separate it |
|---|---|---|
| Stock | availability changes, the cheap option sells out | Record the stock field, set aside rounds where stock changed |
| Promotion | A drop in every arm at the same time | If the arms change together, do not attribute it to the variant |
| Cart discount | Product page is the same, cart total differs | Keep cart measurements separate |
| Exchange rate | Arms see different currencies | Record priceCurrency, compare in a single currency |
| Seller | The featured seller changes on a marketplace | Record the seller name too |
| Cache | High Age header, stale price | Record the Age and Cache-Control headers |
Exchange rates need extra care. If the site converts the price into the local currency, the gap may come from the rate. Compare both arms in the same currency and note the date of the rate you used. The displayed currency and the payment currency can also differ.
The cache can mislead too. A CDN keeps separate copies based on the request fields listed in the response's Vary header. If Vary does not include User-Agent, the mobile arm may receive the desktop copy. Seeing no difference in such a measurement does not prove that there is none.
Results table
The results table turns raw measurements into a verdict. Write one row per variable. The row states how many rounds were measured, in how many rounds the control arms were equal, and the direction of the difference.
| Column | What goes in it |
|---|---|
| Variable | Time, location, device or session |
| Rounds | Planned and completed rounds |
| A/A equality | Rounds in which the control arms saw the same price |
| Variant gap | Rounds with a difference, its direction and range |
| Verdict | No difference, noise or consistent difference |
Even a consistent difference does not mean personalized pricing on its own. If the mobile arm is cheaper, it may simply be a mobile promotion. Limit the verdict to the condition you measured: "This product showed a different price with a mobile User-Agent on these dates."
Keep the raw CSV file. When the verdict is questioned, you should be able to go back round by round.
Debugging
If the measurement gives inconsistent results, check the experiment setup first. Next to each symptom we list the likely cause and what to do.
- The control arms keep differing. Look for a cookie leak first: every measurement should open a new
Session. If there is no leak, the site is running an A/B test. - The price field is empty. The page has no JSON-LD, or the mobile template is different. Save the raw HTML and fix the selector against it.
- The location arm shows another currency. Check the
final_urlcolumn. The site may have redirected you to a country version. That is a finding, not noise. ProxyError, or requests leave from your own IP. The environment variable has overriddensession.proxies. Pass the proxy to the request withproxies=.- 403 or 429. The site is rate limiting. Lengthen the round interval, read the robots.txt file and do not push the limit.
How we tested
We ran the script on 3 December 2026 with Python 3.13.17 and Requests 2.34.2. The target was a local test page that changes the price by User-Agent. Requests went through a local test proxy that required Basic authentication and logged every request with a timestamp. We cut the round interval to 1 second and ran 3 rounds.
All three arms opened within the same second in every round. The test page set a cookie in every response, but no request came back with a cookie. With HTTP_PROXY set, the session.proxies setting was overridden and the request failed with ProxyError. When the proxy was passed to the request with proxies=, the request went through the test proxy. We did not measure a real site.
The bottom line
Set up the measurement like a controlled experiment: one variable, the same second, a clean session, and a round count and decision rule written in advance. Above all, add two identical control arms. A gap read without knowing the noise floor may just be a promotion or a stock change. If you want to turn the measurement into ongoing tracking, see our price monitoring page.
Sources
- Offer type: price, priceCurrency, availability: schema.org
- RFC 9110 HTTP Semantics, §12.5.5 Vary: rfc-editor.org
- Accept-Language header: developer.mozilla.org
- Requests Advanced Usage, Session Objects and Proxies: requests.readthedocs.io
- concurrent.futures, ThreadPoolExecutor: docs.python.org
Frequently asked questions
Can dynamic pricing be detected with a single measurement?
No. A single measurement cannot tell a chance difference apart from an A/B test or the start of a promotion. Repeat the round a number of times you set in advance, for example 10 rounds 15 minutes apart. A verdict needs two conditions: the two identical control arms see the same price in every round, and the variant gap points the same way in every round.
Is an incognito window enough for a clean session?
Partly. A private window starts without cookies, but in Chrome and Firefox all open private windows share the same session. Your IP address and device details do not change either. For manual checks, close every private window before each measurement. For repeated measurements, a script that opens a new session for every request gives more consistent results.
Why should the control arm use a proxy in a location test?
Otherwise two variables change at once: the country and the IP type. The difference between an office connection and a residential IP can also affect the price. Route the control arm through the same type of proxy from your own country, and the variant arm from the target country. Then only the location changes between the arms, and the gap can be tied to it.
Is changing the User-Agent enough to see mobile prices?
Not always. Some sites pick the mobile version on the server from the User-Agent, others in the browser from the screen width. In the second case the script receives the desktop page. Prices in a mobile app are a separate channel and do not show up in a web measurement. Compare the result once with the page opened on a real phone.
How do you separate a currency difference from a price difference?
By recording the priceCurrency field in every row. If the two arms see different currencies, convert to a single currency first and note the date of the rate you used. If the site shows its own rate, note that as well. Any gap left after conversion is worth examining. Flag small differences caused by rounding separately.
Does this measurement put load on the site?
Not if the setup is right. The example script sends only three requests every 15 minutes. Follow the site's robots.txt file and terms of use. When you get a 429 or 403, lengthen the round interval. If you plan to measure many products, first check whether the site offers an official API or data program.




