Proxies and networking
How does geolocation targeting work with proxies?
You ask the provider for an exit in a place, usually by a parameter in the username or a dedicated port, and it routes you through an IP that geolocation databases assign to that place. Sites then show you their local content.
The answer
Sites decide where you are mainly from your IP address, using commercial geolocation databases that map address ranges to countries, regions and cities. A geo-targeted proxy picks an exit IP that those databases place where you asked. You typically request it through the proxy username (for example a country-de or city-lyon style suffix) or through a port reserved for a location; the exact syntax is provider-specific. This is geotargeting from the client side: you choose how the site sees you.
Why scrapers need it
- Local prices and stock. Retailers and travel sites show different prices, currencies and availability per country.
- Search results. Rankings differ by country and even by city, which matters for SERP monitoring.
- Ads and compliance checks. Verifying what a campaign or a cookie banner shows in a given market.
- Geo-restricted pages. Some content is only served to certain regions.
How precise it is
Country-level targeting is generally reliable, because address blocks are assigned through regional registries and providers have exits in most countries. City-level targeting depends on the databases, which disagree with each other more often, especially for mobile networks where addresses move between regions. Some providers also offer targeting by ASN, letting you choose a specific carrier or ISP. Always verify: request a geolocation lookup through the proxy and compare the answer with what you asked for.
Verifying an exit
import requests
exit_proxy = "http://USER-country-fr:PASS@gate.example.net:7000"
# any IP geolocation lookup that returns JSON works here
seen = requests.get("https://geo-lookup.example.com/json",
proxies={"http": exit_proxy, "https": exit_proxy},
timeout=20).json()
print(seen.get("ip"), seen.get("country"), seen.get("city"), seen.get("org"))
The username format in the example is invented for illustration; use your provider's syntax. Different lookup services can report different cities for the same IP, so treat city results as approximate.
Match the rest of the identity
The IP is not the only location signal. Sites also read the Accept-Language header, the browser's time zone, the locale used for number and date formats, and sometimes the HTML5 geolocation API if you grant it. A French IP with a US English browser on Pacific time is unusual and can raise risk scores. In browser automation, set locale and time zone to fit the exit. Playwright, for example, accepts locale and timezoneId when creating a context. Keep currency or region cookies consistent too, since some sites remember a previous country choice.
Geo and CAPTCHAs
Location affects challenge rates. Traffic from a country where a site has no customers can look suspicious, and some sites challenge foreign visitors more often. For IP-bound solving tasks, such as the Cloudflare Challenge task or the DataDome Slider task, send the same geo-targeted proxy with the task so the cookie belongs to the same country and address you browse from. For token widgets, a proxyless task is usually fine regardless of your exit country.
Sessions and geography
Keep one location per session. Changing the exit country mid-flow, for instance between a search and a product page, resembles a hijacked session and often triggers checks. If you need data from several countries, run a separate session per country, each with its own cookies and browser settings. Sticky sessions help keep the city stable for the life of a flow; see rotating or sticky.
Common mistakes
- Trusting the requested city without checking what the site actually detected.
- Forgetting a stored region cookie that overrides the IP location.
- Using a cached page from one country for another; key your cache by location.
- Collecting localized data without noting the exit country on each record, which makes the dataset impossible to interpret later.
For choosing between proxy types in a given market, see residential proxy and mobile proxy.
Common questions
How do I choose a proxy country?
Usually with a parameter in the proxy username or a location-specific port; the syntax differs between providers.
Is city targeting accurate?
Less than country targeting. Geolocation databases disagree on cities, especially for mobile networks.
Do I need to change my browser language too?
It helps. Matching Accept-Language, locale and time zone to the exit country keeps your identity consistent.
Does the CAPTCHA task need the same country?
For IP-bound answers such as Cloudflare challenge or DataDome cookies, send the same proxy so the location matches.
Why does the site show the wrong country?
A stored region cookie, a different geolocation database or a leaking DNS or WebRTC path can override the IP location.
Keep reading
- GeotargetingGeotargeting shows different prices, languages and results by location, so the proxy country you pick decides what data you collect.
- Residential proxyResidential proxies route traffic through home broadband connections, which earns better reputation at a higher, usually per gigabyte, price.
- Rotating or sticky proxies for form flows?Multi-step forms need sticky sessions so the IP stays put; rotation suits independent page fetches with no shared state.
- SERPSearch engine result pages, why rank trackers collect them and why they are among the most challenged pages on the web.