Geotargeting for Marketing Campaigns
Two Different Things Called 'Geotargeting'
Geotargeting happens at two distinct layers that marketers often conflate. Platform-level geotargeting is configured inside ad platforms (Google Ads, Meta Ads Manager) and controls which geographies your ads are even eligible to serve into — it's a reach/eligibility lever, resolved by the platform using its own location signals (device GPS, account location, search query intent) before the click ever happens. Page-level geotargeting is what your own site does once a visitor lands — adjusting currency, language, local proof points, or compliance copy based on inferred location. This lesson focuses mainly on the second, which is the part marketing engineers actually build.
IP Geolocation: Good Enough for Country, Unreliable for City
Page-level geotargeting almost always relies on IP-to-location lookup (via a database like MaxMind GeoIP2, or a platform's built-in geo header such as Vercel's or Cloudflare's request.geo/CF-IPCountry). Accuracy degrades sharply as you go granular: country-level accuracy is typically 95%+, region/state accuracy drops to the 80-90% range, and city-level accuracy can be unreliable, especially for mobile carrier IPs, corporate VPNs, and satellite/CGNAT connections that route traffic through a completely different region than the visitor's physical location. Design your personalization logic around what the accuracy actually supports — country-level currency switching is safe; city-level 'store near you' claims need a confirmation step, not blind trust in the IP lookup.
interface GeoContent {
currency: string;
locale: string;
complianceNotice?: string;
}
const REGION_CONFIG: Record<string, GeoContent> = {
US: { currency: "USD", locale: "en-US" },
GB: { currency: "GBP", locale: "en-GB" },
DE: { currency: "EUR", locale: "de-DE", complianceNotice: "gdpr" },
CA: { currency: "CAD", locale: "en-CA" },
};
const EU_COUNTRIES = new Set(["DE", "FR", "IT", "ES", "NL", "PL", "BE", "AT"]);
export function resolveGeoContent(countryCode: string): GeoContent {
if (REGION_CONFIG[countryCode]) return REGION_CONFIG[countryCode];
if (EU_COUNTRIES.has(countryCode)) {
return { currency: "EUR", locale: "en-GB", complianceNotice: "gdpr" };
}
return { currency: "USD", locale: "en-US" }; // safe default, never leave this unset
}Always Let Visitors Override the Inferred Location
SEO Implications: hreflang and Duplicate Content
If geotargeting produces genuinely different URLs per region (common for localized pricing or legal pages), implement hreflang tags correctly so search engines serve the right regional URL to the right searcher, rather than treating your regional variants as duplicate content competing against each other. If instead you're dynamically serving different content at the *same* URL based on IP (the edge rewrite pattern from the previous lesson), be aware that Googlebot crawls primarily from US IP ranges — your 'default' crawled version should be the one you want indexed, since most geo variants outside that default will rarely get their own distinct crawl and index treatment.
Legal and Compliance Geotargeting
Beyond conversion optimization, geotargeting has a compliance dimension: GDPR consent banners for EU visitors, CCPA opt-out mechanisms for California visitors, and region-specific legal disclaimers (financial services, pharma) that must appear based on jurisdiction. These aren't optional personalization niceties — get the country detection wrong here and you have a genuine legal exposure, not just a suboptimal conversion rate. Treat compliance-driven geotargeting with a different reliability bar (err toward showing the stricter disclosure when location is ambiguous) than conversion-driven geotargeting (where a wrong guess just means a slightly off currency display).
Cache Variance by Region, or You'll Leak Content Across Regions
Vary header or cache-key configuration explicitly includes the geo dimension you're personalizing on.What's Next?
IP-based personalization carries real accuracy and privacy tradeoffs worth examining on their own — the next lesson looks specifically at where that technique breaks down and what risks it introduces.
I build these systems professionally.
Whether it's a RAG pipeline, analytics migration, or AI workflow — let's talk.