DEV Community

Cover image for Geo-Targeted Web Scraping with Proxies: Country & City-Level Guide

Geo-Targeted Web Scraping with Proxies: Country & City-Level Guide

Dev Stack Hub on November 20, 2026

Request the same product page from a US server and from a German residential IP, and you will often get two different pages. The price may be in eu...
Collapse
 
nyaomaru profile image
nyaomaru Necoz •

This is really interesting! 😸

Trying the same page from different countries and seeing how prices, stock, language, or even search results change sounds like a lot of fun. 😹

I also liked the point about keeping the whole browser context consistent with the target location, not just the IP. Locale, timezone, cookies, and the proxy all affecting the result makes a lot of sense. πŸ‘€

And this line was especially good πŸ‘‡

β€œThe most costly failure is a 200 response with the wrong content.”

That’s such an easy failure to miss if you only check the status code, so validating the actual geo-specific content is a really nice idea.

Also, tiny cat detective note: the β€œShould I go for sticky sessions or rotating IPs?” FAQ appears twice at the end. 😹🐈

Nice guide! πŸ‘

Collapse
 
devstackhub profile image
Dev Stack Hub Necoz • • Edited

Thanks so much, this made my day! 😸

You've got the main point: the IP is only one signal, and if the locale, timezone, cookies and Accept-Language disagree with it, the site can still serve the wrong version. πŸ‘€

And yes, a 200 with the wrong content is the sneaky one. A quick check for the currency symbol, the redirect path or a "Deliver to" label catches it for almost no cost. πŸ•΅οΈ

Great catch on the duplicate FAQ too, sharp cat detective eyes! 😹🐈 I'll tidy it up.

Thanks for reading and for the kind words! πŸ‘

Collapse
 
emilywoodsnyc profile image
Emily Woods •

The distinction between requested location and the page’s observed location is worth preserving in the output too. I’d keep both, plus currency and shipping region, rather than let a fallback look like a valid regional price. For caching those results, this cache review exercise offers a useful starting point: define the result’s identity before deciding which requests can share an entry.

Collapse
 
devstackhub profile image
Dev Stack Hub Necoz •

Thanks, this is a good point. A fallback that quietly passes as a regional price is one of the worst failures in geo scraping, because the data looks clean and nobody questions it.

This is the shape I'd use for each record:

  • requested_geo: the country, region or city we asked the proxy for
  • observed_geo: what the page actually showed (store locale, the location picker text, the redirect target)
  • currency and shipping_region: pulled from the page itself, not inferred from the proxy
  • geo_match: exact, fallback or mismatch, so downstream consumers can filter instead of guessing

Fallback rows still get stored, but they're flagged. Dropping them hides how often a site ignores the location. Keeping them unflagged poisons the price comparisons.

I agree on the cache identity point too. The key can't be just URL plus country. It needs the requested geo, the proxy session or exit type, locale and currency, and the device or user agent class, because any of those can change what the page returns. Two requests share an entry only if every field that can change the result matches. And a fallback result shouldn't be cached under the requested location's key at all, otherwise one bad fetch turns into a wrong price served for hours.

I'll look at the cache review exercise. Thanks for sharing it.

Collapse
 
emilywoodsnyc profile image
Emily Woods •

That record shape makes the distinction much easier to use downstream. I’d also keep the observation timestamp and extraction version, so a later page-layout change doesn’t get mistaken for a real regional price change. Thanks for spelling out the fallback handling.

Thread Thread
 
devstackhub profile image
Dev Stack Hub Necoz • • Edited

Good catch, that's a failure mode I'd missed. If the extraction logic changes, a price shift in the data can look like a real regional change when it's really a parser change. Two additions would cover it:

  • observed_at: a UTC timestamp for when the page was fetched, not when the row was written.
  • extractor_version: a version string or git hash for the parsing logic, bumped whenever selectors or normalization rules change.

With both fields, a sudden price move can be checked against the version history before anyone treats it as real. When a version changes, I'd also re-run a small sample of URLs through the old and new extractors side by side, so you can tell a parser difference from a market difference.

If you keep raw HTML or JSON snapshots, you can also re-extract old pages with the new version instead of guessing. Thanks for the thoughtful follow-up. πŸ™Œ

Thread Thread
 
emilywoodsnyc profile image
Emily Woods •

Running both extractors against the same saved page is the comparison I would keep. Fetching the live page twice introduces another variable, because the price may genuinely change between runs. The raw snapshot identity alongside the extractor version makes the replay much easier to interpret.

Thread Thread
 
devstackhub profile image
Dev Stack Hub Necoz •

Exactly, replaying both extractors on the same saved snapshot removes the live-page variable. Geo-targeted pages make it worse, since price and currency can shift by country or city between fetches. I now store the raw HTML with a snapshot ID, the proxy location, a timestamp and the extractor version, so any difference in output can be traced to the extractor and not the fetch. Thanks for pointing that out, it's a useful addition to the workflow.

Collapse
 
arpitaraval profile image
Arpita Raval •

This one's going straight into my scraping bookmarks πŸ”–πŸ

A few things that stood out to me:

⚑ The httpx note about proxy= replacing the old proxies= argument. That one has bitten me before, and the error message isn't exactly helpful. 😀

🎲 The point about A/B price testing is underrated. I once spent a whole afternoon blaming my German proxy for "wrong" prices, and it turned out the site was just randomizing them. Now I run each geo 5-10 times and compare the distribution before drawing conclusions. πŸ“Š

πŸͺœ The city β†’ region β†’ country fallback is a great pattern. I'd even log which level each request actually got, so you can see later how much of your "Berlin" data was really "somewhere in Germany." πŸ˜„

One trick I'd add: If you're using Playwright just for prices, block images, fonts and media with page.route(). Residential bandwidth is billed per GB, so this can cut costs a lot. πŸ’Έ

Curious what everyone else does when a site serves a country-selector interstitial instead of content. Do you click through it automatically, or set the cookie directly? πŸͺπŸ€”

Collapse
 
devstackhub profile image
Dev Stack Hub Necoz •

Haha, the proxy= vs proxies= thing got me too. 😀 Old tutorials are everywhere!

Your A/B pricing story is painfully relatable. πŸ˜‚ Running each geo several times and comparing distributions is exactly right. It saves you from "fixing" a proxy problem that doesn't exist. πŸ“Š

I also love your idea of logging which fallback level each request got. πŸͺœ It gives you an honest picture of how much of your "Berlin" data was really "somewhere in Germany." I might add that to the post. πŸ˜„

On country-selector interstitials πŸ‘‡ I usually set the cookie directly instead of clicking through. It's faster, cheaper on bandwidth, and more stable, since a button's selector can change any day. I only fall back to clicking through in Playwright when the cookie value is set by JavaScript and I can't reproduce it. πŸͺ

And the page.route() tip for blocking images and fonts is a great addition. Residential bandwidth adds up fast! πŸ’Έ

Collapse
 
harperelise profile image
Harper Elise Callahan •

The "silent geo failure" section is the part most scraping tutorials skip: a 200 response with the wrong currency or catalog is far worse than a hard error, because it quietly pollutes your data. Checking for a €, MwSt, or a redirect to /de/ is a cheap sanity check that I'm going to add to my own pipeline.

I also liked pulling the timezone from the ipinfo lookup and feeding it into the Playwright context, so the browser agrees with the proxy. Mismatched locale and timezone is something I've seen trigger bot detection even with a good residential IP.

One question: for ZIP-dependent content like grocery delivery or local inventory, do you set the ZIP through the site's own UI flow, or do you inject the cookie directly? I've found the cookie approach is faster but breaks when the site changes its cookie format.

Collapse
 
devstackhub profile image
Dev Stack Hub Necoz •

Thanks, this is exactly why I gave silent failures their own section. A hard error at least tells you something broke. A clean 200 with euro prices on a US run just ends up in your dataset. Cheap checks are the best defense: currency symbols, tax wording like MwSt, and the final URL after redirects (a surprise /de/ is a dead giveaway). I'd also compare a few fields against a known-good baseline run now and then, because some sites geo-serve a different catalog without any visible marker.

On the timezone point, you're right that a mismatched locale, timezone, and IP is a classic tell. Detection systems often score the whole fingerprint rather than the IP alone, so a great residential IP can still get flagged if the browser says it's in New York while the IP says Frankfurt.

For ZIP-dependent content, I default to the site's own UI flow in Playwright: open the location picker, enter the ZIP, wait for the confirmation or the refreshed page, then scrape. It's slower, but it survives cookie format changes, and it sets whatever the site actually needs (cookie, localStorage, server-side session) without me reverse-engineering it. I only use direct cookie injection when it's a stable, simple value and volume justifies the speed.

The best compromise is a hybrid. Do the UI flow once per session or ZIP, save the resulting storage state, and reuse it across many requests. Then add a validation check, like confirming the displayed ZIP or store name on the page. If that check fails, fall back to the UI flow and rebuild the state. You get most of the cookie approach's speed, and a format change gets caught instead of silently breaking your data.

Curious what you've been scraping where ZIP matters. Grocery, or local inventory?

Collapse
 
michaeljohnsondz profile image
Michael Johnson •

The "silent geo failure" point in Step 6 is the one that bites most people. A 200 response with the wrong content is worse than a clean error. πŸ˜…

I also liked the tip about matching Accept-Language, locale and timezone to the exit IP. A German IP with a Los Angeles timezone is exactly the kind of mismatch that gets scrapers flagged. πŸ•΅οΈβ€β™‚οΈ

The city β†’ region β†’ country fallback is a smart habit too. I've seen geo-IP databases disagree on the city more often than I'd like. πŸ“

Quick question: do you run the Step 1 exit check on every new session, or cache it per proxy? ⚑ And have you seen A/B price testing cause false "geo differences" in practice? πŸ’Έ

Bookmarked for my next scraping project! πŸ”–πŸ”₯

Collapse
 
devstackhub profile image
Dev Stack Hub Necoz •

Thanks for the detailed read! πŸ™Œ

Silent geo failure (Step 6): Agreed, a clean error at least tells you something broke. A 200 with the wrong content slips into your dataset unnoticed. That's why I like checking for evidence of the right location (currency symbol, the final redirect URL like /de/, a "Deliver to" label) before trusting the page. πŸ˜…

Locale and timezone matching: Exactly. A German IP with an en-US locale and an LA timezone is the kind of inconsistency that makes anti-bot systems suspicious, and some sites also serve the wrong version. In Playwright I read the timezone from the exit-IP lookup, so the browser context always agrees with the proxy. πŸ•΅οΈβ€β™‚οΈ

City β†’ region β†’ country fallback: Geo-IP vendors disagree far more at city level than at country level. The provider may say Chicago while the target's database says somewhere else in the state. So I treat a city target as "probably this city", check what the page actually shows, and log which level I ended up getting. πŸ“

Step 1 exit check, every session or cached? Once per session, not per request. I cache the result against the sticky session ID, because free geo-IP tiers are rate-limited and re-checking every request wastes calls. With rotating IPs the exit changes, so a cached result only holds for the IP it was checked on. In that case I check when a new IP or session starts, and sample-check rather than checking every fetch. For city-critical work I also query a second geo-IP service and compare. ⚑

A/B price testing vs. false geo differences? Yes, it's a real trap. If prices flip between requests from the same location, the site may be A/B testing prices regardless of where you are. Before blaming geography, I repeat each geo several times and compare the distributions. If the DE price varies within the same range as the US price on repeat requests, it's testing noise, not a geo difference. A fresh cookie jar per location also helps, since stale cookies can cause the same confusion. πŸ’Έ

Thanks for bookmarking it, and good luck with your next scraping project! πŸ”–πŸ”₯

Collapse
 
rafidbottler profile image
Rafid Bottler •

The point about caching the exit check against the sticky session ID is a good one. One thing I'd add: run the check through the exact same client and proxy config as the real requests. If the IP-lookup call goes out differently (different library, no proxy on a fallback path), it can report a clean exit while the actual fetches leak your real location. πŸ•΅οΈ

For browser-based scraping, WebRTC and DNS leaks can also contradict the proxy's location even when the timezone and locale match, which is another quiet way to get a "wrong region" page. πŸ“

Logging which level you got (city, region or country) is a habit I'm going to steal. It makes it much easier to explain odd rows in a dataset later. πŸ”–

Curious about one thing: when two geo-IP services disagree on the city, do you drop the result or just flag it? πŸ’¬

Thread Thread
 
devstackhub profile image
Dev Stack Hub Necoz •

You're right about the exit check. A lookup that takes a different path from the real requests can report a clean exit while the actual fetches leak. I run it through the same client, headers and proxy config as the fetches, with no silent direct fallback. If the proxy fails, the request should fail loudly instead of quietly going out on your real IP.

On the WebRTC and DNS leaks, agreed. In Playwright I disable or restrict WebRTC and check what the browser actually exposes, because a matching timezone and locale mean little if the network layer says otherwise.

To answer your question, I flag disagreements and don't drop them. City-level geo-IP data differs a lot between databases, so a mismatch on the city is common and usually harmless. My rule:

  • Country mismatch: treat as a failed exit, rotate the session and retry.
  • Region mismatch: flag it and keep the row, but mark it lower confidence.
  • City mismatch only: keep it and store both answers.

I log each service's result next to the level I was targeting. If I'm using three services, I go with the majority and treat the provider's claimed location as one more vote. That way, when a row looks odd later, I can tell whether it was a real geo difference or just database noise.

Glad the "log the level you got" habit is useful. It has saved me a lot of debugging time. πŸ”–

Collapse
 
devers profile image
Devers •

This one's a keeper! πŸ™Œ I like that it explains why the same page looks different from Berlin and from a US server, instead of just dumping proxy code. πŸ‡©πŸ‡ͺπŸ‡ΊπŸ‡Έ

Three things stood out for me:

  • 🧩 Keeping the provider syntax in one function. Switching providers later becomes a one-line change.
  • πŸͺ The cookie warning. A saved ship-to country or ZIP can override the IP completely, and it's an easy thing to forget while debugging.
  • πŸ” Sticky sessions for stateful flows and rotation for independent fetches. It's a simple rule that saves a lot of headaches.

The legal and ethical section was a nice touch too. A proxy changes where you appear to be, not what you're allowed to do. βš–οΈ

Curious for ZIP-level content like grocery delivery, do you set the ZIP through the site's own flow, or inject the cookie directly? πŸ›’

Thanks for sharing! πŸš€

Collapse
 
devstackhub profile image
Dev Stack Hub Necoz •

πŸ™Œ Really glad the "why" came through, since the Berlin vs. US difference is what makes the proxy setup actually make sense. πŸ‡©πŸ‡ͺπŸ‡ΊπŸ‡Έ

And you picked the right three takeaways. The cookie one bites almost everyone at least once. I've lost plenty of debugging time to a saved ship-to country overriding a perfectly good IP. πŸͺ

On your grocery question: I'd lean toward the site's own flow first. Driving the real "set my ZIP" step (via a browser or by replaying the exact request it makes) is more resilient, because the site sets whatever cookies, tokens, and session state it expects. Injecting the cookie directly is faster and cheaper at scale, but it can break quietly when the site changes its cookie format or adds validation tied to the session or IP. πŸ›’

My usual pattern: run the real flow once per session, capture the resulting cookies, then reuse them with a sticky session for the rest of that run. And I always spot-check a known product's price or availability to confirm the ZIP actually stuck. βœ…

Thanks for reading and for the thoughtful comment! πŸš€

Collapse
 
alinashah profile image
Alina Shah •

The IP is only one geo signal. Locale, timezone and saved cookies can override it, and a German IP with an en-US locale and an LA timezone often gets served the wrong version without any error.

The silent-failure check in Step 6 matters most, because a 200 with the wrong currency ends up in your dataset unnoticed. Adding the final redirect URL (/de/, .co.uk) to that check is a faster signal than parsing the HTML.

For ZIP-level content like grocery or local inventory, is it more reliable to inject the ZIP cookie or to drive the site’s own location picker in Playwright? Cookie injection tends to break whenever the site changes its cookie format.

Collapse
 
devstackhub profile image
Dev Stack Hub Necoz •

Thanks, agreed on all three points. Locale, timezone and saved cookies can easily override the IP, and the silent failure case is the one that does the most damage, because a 200 with the wrong currency just flows into the dataset. Checking the final redirect URL is a good addition. It’s cheaper than parsing HTML and more stable, since a /de/ path or .co.uk domain rarely changes in a redesign. I’d run it first and keep the currency check as a second layer, because some sites keep the same URL and swap content server-side, so the redirect can look right while the page is still wrong.

On ZIP-level content, I’d drive the site’s own location picker and treat cookie injection as an optimization on top of that. Injection is fast, but you’re depending on an undocumented format. It’s often more than one cookie too, since many sites pair the ZIP with a store ID or a signed value, and injecting only part of that fails silently, which is exactly the failure we’re trying to avoid. The picker is slower, but it runs the real flow, so you get what a user at that ZIP would actually see, and when the UI changes you usually get a loud failure like a selector timeout instead of quietly wrong data.

What works well in practice is a hybrid. Set the ZIP once per location through the picker inside a sticky session, then save the resulting storage state with context.storage_state() and reuse it on later runs so you only pay the UI cost once. After each run, verify the location on the page itself (a β€œDelivering to 10001” label or the store name) rather than just checking that a cookie exists, and if that check fails, discard the saved state and redo the picker flow. That way you get the speed of cookies, but the browser produced the cookie, so you never rely on assuming its format, and a site changing it just triggers a fresh capture.

Collapse
 
mayur-upadhyay profile image
Mayur Upadhyay •

The part about silent geo failures (a 200 with the wrong content) is the one that hurts most in production. πŸ˜… I like the idea of validating the response itself (currency symbol, redirect path, "Deliver to" label) instead of trusting the proxy parameters.

The note on city-level targeting also matches my experience 🎯. Providers and target sites often use different geo-IP vendors, so "Chicago" on the proxy side can be a different city on the target's side. A city β†’ region β†’ country fallback with logging of which level you actually got is a solid pattern. πŸ‘Œ

Two things I'd add:

  • 🌐 WebRTC and DNS leaks in browser mode. Even with matching locale and timezone in Playwright, a leaked real IP or a DNS resolver in the wrong country can undo the setup.
  • πŸͺ Stale cookies and consent state. A fresh context per location fixes most of the "why am I still seeing the US version?" cases.

Quick question: for stateful flows like ZIP selection, have you seen better results from sticky sessions with a fixed TTL, or from setting the ZIP cookie directly and rotating IPs? πŸ€”

Thanks for sharing, bookmarked! πŸš€

Collapse
 
devstackhub profile image
Dev Stack Hub Necoz •

Thanks for the thoughtful comment! πŸ™Œ Glad the silent-failure section resonated. A 200 with the wrong content is the worst kind of bug because nothing alerts you until someone notices the data looks off. Checking the response itself is the only reliable signal I've found.

You're right about the geo-IP vendor mismatch too. A proxy's "Chicago" and a target site's "Chicago" often don't agree, so logging which fallback level you actually landed on has saved me a lot of debugging.

Both additions are good ones. WebRTC and DNS leaks are easy to miss in browser mode, since the locale and timezone can look perfect while the real IP or resolver gives you away. And a fresh context per location is such a cheap fix for the "why am I still seeing the US version?" problem that it should be the default.

On your question: I've had better results with setting the ZIP cookie (or the equivalent localStorage/API call) directly and treating the IP as a secondary signal. Sticky sessions can work, but they're fragile. If the TTL expires mid-flow or the exit node gets flagged, the ZIP state goes with it. With the cookie set explicitly, you can rotate IPs freely and just re-verify the result, for example by checking the "Deliver to" label. The exception is sites that tie the ZIP to the session server-side, where a short sticky session plus the real selection flow is the safer choice. What are you seeing on your side?

Thanks for bookmarking! πŸš€

Collapse
 
andersonkevin profile image
Kevin Anderson •

One thing I kept running into while testing this: the silent failures hurt more than the blocks. A proxy that returns a clean 200 with the wrong currency or a default-country page is easy to miss, and it quietly poisons the dataset. That's why I added the content check in Step 6 rather than trusting the status code.

City-level targeting was the other surprise. Provider says Chicago, the target's geo-IP vendor says somewhere else in Illinois, and you only find out by checking what the page actually shows.

Curious how others handle this: do you validate the geo on every response, or just sample and alert? And has anyone found a reliable way to handle ZIP-gated sites (grocery, local inventory) where the IP alone isn't enough?

Collapse
 
devstackhub profile image
Dev Stack Hub Necoz •

Thanks for the thoughtful comment, and you're right that silent failures are worse than blocks. A clean 200 with the wrong content is the hardest thing to catch.

Validate or sample? I do both. A cheap check on every response (currency symbol, country/locale marker, a known geo-specific element) costs almost nothing. Deeper checks, like comparing against a geo-echo endpoint or a screenshot, run on a sample, with an alert if the mismatch rate crosses a threshold.

ZIP-gated sites: IP alone usually isn't enough, so I set the location the way a real user would. That means submitting the ZIP through the site's own store-selector flow (or its endpoint), keeping the cookies and a sticky session, and then verifying the page shows the right store or ZIP before scraping anything else.

Curious what's worked for you on the grocery and local-inventory side.

Collapse
 
rafidbottler profile image
Rafid Bottler •

One thing I'd add from experience: the silent failures in Step 6 are the ones that hurt most. A 200 response with the wrong content looks like success in your logs, so a scraper can quietly collect the wrong dataset for days.

The fix that worked best for me was logging the exit IP, the final URL after redirects, and a visible location marker (currency symbol or a "Deliver to" label) with every sample. When prices or results looked off, I could tell right away whether the proxy, the target's geo-IP database, or my headers caused it.

Curious how others handle city-level targeting. Do you fall back to region or country when the geo-IP vendors disagree, or do you retry with a fresh IP from the same city until the page confirms it?

Collapse
 
devstackhub profile image
Dev Stack Hub Necoz •

Thanks for sharing this, great addition. Silent failures are exactly why I put Step 6 in the guide: a 200 with the wrong content is the hardest bug to catch.

Logging the exit IP, final URL, and a visible location marker with every sample is a smart habit. It makes debugging the proxy vs. geo-IP database vs. headers question much faster.

On city-level targeting, I'd retry with a fresh IP from the same city a few times, and only fall back to region or country if the page still doesn't confirm the location. I'd also flag those fallback results in the dataset so they don't get mixed in with true city-level data.

How do you handle it when vendors disagree consistently on a city?

Collapse
 
levinemundro profile image
Levine Mundro •

The point about geo-IP vendors disagreeing at city level is something a lot of scraping guides skip, and checking what the page itself shows (currency, "Deliver to" label, redirect path) instead of trusting ipinfo alone is the right habit.

Step 6 is the one I'd highlight for anyone starting out. A 200 response with the wrong regional content is the failure that quietly ruins a dataset. I'd also add price A/B testing to the watch list, since repeating each geo a few times before blaming location saves a lot of debugging.

Curious how you handle ZIP-dependent sites like grocery delivery. Do you set the ZIP cookie directly, or drive the site's location picker in Playwright?

Collapse
 
devstackhub profile image
Dev Stack Hub Necoz •

Thanks, glad Step 6 stood out. That failure is the dangerous one because nothing errors. The job finishes, the row count looks right, and the data is simply from the wrong market. You're right about A/B testing too. Repeating each geo a few times and checking whether the variation is consistent per location or random per request is a cheap way to rule it out before you blame the proxy.

On ZIP-dependent sites, I try the cookie first when the site stores the location in a plain cookie or localStorage value. It's faster, cheaper, and easier to reproduce. I do one manual run first to see exactly what the site writes when you pick a ZIP, because some sites store more than the ZIP, like a store ID, a delivery slot, or a signed token.

I switch to driving the location picker in Playwright when the ZIP is validated server-side, tied to a session or store ID, or the cookie is signed or short-lived. Injecting a ZIP the backend never registered often gets you the default location with a normal 200, which is the same silent failure again.

Either way, I verify on the page after setting the location. I check the "Deliver to" label, the store name, or the availability and shipping fields, and I save the requested ZIP next to what the page actually showed. If they don't match, the row gets flagged instead of kept.

Do you scrape grocery sites mostly through the picker, or have you found any that accept a clean cookie injection?

Collapse
 
sidra-jefferi profile image
Sidra Jefferi •

The "silent geo failures" section is the part most scraping guides skip. A 200 response with the wrong content is far more expensive than a hard error, because bad data gets into the pipeline without anyone noticing. Checking the currency symbol and the final redirect path is a cheap habit worth adopting.

I also liked the point about treating city targeting as "probably this city" and checking what the page itself shows, since different geo-IP vendors often disagree at the city level. Matching the Playwright timezone to the exit IP lookup is a neat trick too, because that mismatch is easy to overlook.

One thing I'd add: for ZIP-dependent content like local inventory or delivery slots, setting the ZIP cookie explicitly has saved me more headaches than switching proxy pools. Have you seen cases where a site ignores both the IP and the cookie and falls back to account-level location?

Collapse
 
devstackhub profile image
Dev Stack Hub Necoz •

Glad the silent geo failures section was useful. That's exactly why I wrote it: a hard error at least tells you something broke, while a clean 200 with the wrong currency or a redirected locale path quietly poisons everything downstream. Checking the symbol and final redirect path takes a few lines of code and catches a surprising amount.

You're right about city-level targeting, too. Vendors disagree often enough that I stopped trusting the proxy's label and started trusting what the page renders. And yes, the timezone mismatch between the browser context and the exit IP is one of those things that looks fine until a site's fingerprinting logic notices it.

Your ZIP cookie point is a good addition. For local inventory and delivery slots, setting it explicitly is often more reliable than any proxy change, since many retailers key that content off the stored ZIP rather than the IP.

To your question: yes, I've run into it. Logged-in sessions are the usual culprit. Once an account has a saved address or store preference, some sites prioritize that over both IP and cookies, so the proxy location becomes almost irrelevant. A few other cases that behave similarly are sites that persist the last selected store in local storage or server-side session state, and apps that sync location from a profile after login. The fix is usually to scrape logged out, use a fresh session per location, or update the account's saved location through the site's own flow before collecting data.

Have you seen this mostly on retail sites, or in other verticals too? Always curious which ones behave worst.

Collapse
 
elsie-rainee profile image
Elsie Rainee •

The point about silent geo failures (a 200 response with the wrong content) is the one that bites most in practice. Scrapers keep running and the bad data only shows up weeks later in a report. Checking for currency symbols or a "Deliver to" label right after the fetch is a cheap guard that most guides skip.

The advice to match locale and timezone to the exit IP in Playwright is also useful, and so is reading the timezone from the ipinfo lookup instead of hardcoding it. I've seen sites quietly serve the wrong version just because the timezone said Los Angeles while the IP said Berlin.

One thing I'd like to hear more about is the city-to-region-to-country fallback. How do you decide when a city result is "good enough"? Do you compare what the page shows against the geo-IP result, or just trust the second geo-IP service when the two disagree?

Collapse
 
devstackhub profile image
Dev Stack Hub Necoz •

Thanks, that Los Angeles timezone against a Berlin IP case is exactly the kind of mismatch that's hard to debug, because the site never errors. It just serves a different version. Reading the timezone from the lookup instead of hardcoding it removes that whole class of problem, and it's worth logging the values you set so you can compare them later.

On when a city result is good enough, I don't treat the geo-IP result as the judge. Vendors disagree at city level often enough that picking a winner between them isn't reliable. I treat what the page shows as the ground truth: the currency, the "Deliver to" label, the store or region name, the shipping options. If the page matches the requested city, the result is good enough, even if one geo-IP service disagrees.

When the two geo-IP services disagree, I use that as a signal to check the page more closely, not as a vote. If the page confirms the city, I keep the row. If the page only confirms the region or country, I keep the row but label it with that level instead of the city. If the page contradicts the requested location, I drop the row and retry on a new exit.

The fallback itself is simple: try the city, accept the region if the city can't be confirmed, accept the country if the region can't. What matters is storing the level you actually got next to the level you asked for. That way a country-level result never gets mixed into a city-level analysis without anyone noticing.

Are you running city-level checks yourself, or mostly working at the country level?

Collapse
 
debugtodeploy profile image
Vinay Shah •

The "200 OK but wrong content" problem in Step 6 is the sneakiest scraping bug, because everything looks fine until you notice you've been collecting US prices for a German shopper πŸ˜…

Treating city targeting as "probably this city" and having a city β†’ region β†’ country fallback is a really practical tip 🎯 And matching the locale and timezone to the exit IP is the kind of detail most tutorials skip, but it's what separates a scraper that works from one that gets flagged πŸ•΅οΈβ€β™‚οΈ

The sticky vs. rotating session breakdown makes the whole thing easy to reason about πŸ”„ Bookmarking this one! πŸ”–

Quick question for everyone: what's the weirdest geo-based difference you've found while scraping? Different prices, hidden stock, a surprise redirect? πŸ‘€πŸ’¬

Collapse
 
devstackhub profile image
Dev Stack Hub Necoz •

Glad the Step 6 section landed. That "200 OK but wrong content" bug has burned me more than once, and it's the worst kind because your monitoring stays green while the data quietly goes bad πŸ˜…

The city β†’ region β†’ country fallback came from a lot of trial and error. Once I stopped treating city targeting as a guarantee and started validating what the site actually returned, things got a lot more stable 🎯 And yes, the locale and timezone matching is so often overlooked, but anti-bot systems notice that mismatch quickly πŸ•΅οΈβ€β™‚οΈ

To answer your question: the weirdest one I've seen is a site that showed a "limited stock" badge and a higher price to visitors from certain regions, while the same product page looked fully available and cheaper from another country πŸ‘€ A close second was a redirect that sent requests to a local-language site where the product catalog was just different, not merely translated.

Would love to hear yours too! What's the strangest geo-based difference you've run into? πŸ’¬