← All guides

Auto-detecting visitor location: when to redirect vs when to ask

Geolocation and SEO: avoiding Google penalties from redirects

How to respect Googlebot's language headers, avoid redirect loops, and keep regional stores crawlable.

A Shopify store owner implements geolocation redirects for their international customers. Conversion goes up for the first two weeks. Then organic traffic starts dropping. By month three, they have lost 23% of their search visibility and cannot figure out why. The redirects that were supposed to help international visitors have been silently blocking Google from crawling half their site.

This is not a rare edge case. It is one of the most common SEO mistakes in international ecommerce, and it happens because geolocation and search engine crawling operate on fundamentally different assumptions. Your visitors are humans with locations. Googlebot is a crawler with no location—and if you treat it like a visitor, you break your own rankings.

Quick read
  • Google explicitly warns against auto-redirecting based on perceived user location---it prevents crawlers from indexing all versions of your site
  • Googlebot crawls primarily from US IP addresses and does not follow geo-redirects the way a human visitor would
  • Hreflang tags tell Google about your regional pages without relying on redirects---they are essential for any multi-region store
  • Redirect loops between regional versions are the fastest way to get pages dropped from Google's index
  • Shopify Markets handles hreflang automatically, but custom JavaScript redirects can override and break this

Why Google penalizes geo-redirects

Google’s international targeting documentation is unusually direct on this topic: “Avoid automatic redirection based on the user’s perceived language. These redirections could prevent users (and search engines) from viewing all the versions of your site.”

The reason is mechanical. Googlebot primarily crawls from data centers in the United States. When your geolocation system detects a US IP address and redirects to the /us/ version of your store, Googlebot only ever sees the US version. Your /uk/, /de/, /fr/, and /au/ versions never get crawled from that entry point. If those pages are only reachable through geo-redirects and not through internal links or sitemaps, Google may never discover them at all.

The result is that your US pages accumulate all the ranking signals—backlinks, engagement data, crawl history—while your regional pages sit in a crawl vacuum. When someone in Germany searches for a product you sell, Google may show them the US page (if it ranks) or nothing (if the regional page was supposed to rank but was never indexed).

This is not technically a “penalty” in the sense of a manual action from Google’s spam team. It is worse: it is an indexing failure that produces the same symptoms—lost traffic, missing pages, ranking drops—but without any notification in Search Console. You do not get a warning. Your pages simply do not appear.

How Googlebot handles language and location

Understanding what Googlebot actually does when it encounters your store clarifies why certain implementations fail.

Googlebot does not have a geographic location. It crawls from US-based IP addresses and does not simulate being in different countries. When it requests a page, it sends standard HTTP headers, including an Accept-Language header that is typically set to en-US or en.

Googlebot does not execute all JavaScript. While Google’s rendering engine can execute JavaScript, it does so on a delayed schedule and may not trigger client-side redirect logic the same way a browser does. A JavaScript-based geolocation redirect might fire for human visitors but not for Googlebot, creating a split where humans see one version and Google indexes another.

Googlebot follows redirects, but not infinitely. If your geolocation logic creates a redirect chain (homepage redirects to /us/, /us/ redirects back to homepage because the crawler’s Accept-Language says English), Google may give up and drop the page from its index entirely. Redirect loops are one of the most common technical SEO issues flagged in Google Search Console for international sites.

Googlebot uses hreflang tags to discover regional versions. This is the intended mechanism for telling Google about your regional pages. Instead of redirecting the crawler to the right version, you tell Google that alternate versions exist and let it crawl each one independently.

Hreflang: the right way to handle regional pages

Hreflang tags are HTML annotations that tell search engines “this page has alternate versions in other languages or for other regions.” They go in the <head> of each page or in the XML sitemap.

A product page on your US store would include:

<link rel="alternate" hreflang="en-us" href="https://store.com/products/widget" />
<link rel="alternate" hreflang="en-gb" href="https://store.com/uk/products/widget" />
<link rel="alternate" hreflang="de" href="https://store.com/de/products/widget" />
<link rel="alternate" hreflang="x-default" href="https://store.com/products/widget" />

The x-default tag tells Google which version to show when no specific regional match exists. This is typically your main/default store.

What hreflang achieves that redirects cannot:

  • Google crawls and indexes every regional version independently
  • Each version accumulates its own ranking signals
  • Google serves the appropriate regional version in search results based on the searcher’s location and language settings
  • No crawler is blocked from accessing any version

Shopify Markets generates hreflang tags automatically when you configure markets with subdirectories or subdomains. This is one of the strongest reasons to use Shopify’s native internationalization rather than building custom redirect logic. The hreflang implementation is correct out of the box and updates automatically as you add products or markets.

The critical warning: if you layer custom JavaScript redirects on top of Shopify Markets, the redirects can fire before Google reads the hreflang tags. The crawler gets redirected away from the page before it parses the <head>, so the hreflang annotations are never processed. This is the single most common way stores accidentally break an otherwise correct hreflang setup.

Common mistakes and how to fix them

Redirecting crawlers along with visitors

The mistake: Your geolocation logic does not distinguish between human visitors and search engine crawlers. Every request from a US IP goes to /us/, including Googlebot.

The fix: Check the user agent string before applying geo-redirects. Googlebot identifies itself in the User-Agent header. If the request comes from a known crawler, serve the page without redirecting. This is not cloaking—Google explicitly recommends it in their international targeting guidelines.

In practice, maintain a list of known crawler user agents (Googlebot, Bingbot, etc.) and bypass geolocation logic for those requests. On Shopify, this is easiest to implement at the CDN/edge layer (Cloudflare Workers) rather than in Liquid or JavaScript.

Using 302 redirects instead of 301

The mistake: Your geo-redirects use 302 (temporary) status codes, which tell Google “this redirect is temporary, keep indexing the original URL.” Google may index both versions, splitting ranking signals between them.

The fix: If the redirect is permanent (a visitor from Germany should always see the /de/ version), use a 301 redirect. If the redirect is conditional and may change (the visitor might switch regions), use a 302 but combine it with proper hreflang tags so Google does not rely on the redirect for discovery.

In most cases, geo-redirects should be 302 because they are conditional on the visitor’s location, not permanent. But this means you absolutely need hreflang tags to handle the indexing side. Relying on 302 redirects for Google to discover your regional pages will not work.

Missing hreflang on regional pages

The mistake: You implement hreflang on your main store but forget to add reciprocal hreflang tags on the regional versions. Hreflang must be bidirectional—if page A says “my German version is page B,” page B must also say “my English version is page A.”

The fix: Audit every regional version of every page to confirm bidirectional hreflang. In Shopify Markets this is automatic, but if you use custom themes or headless setups, missing reciprocal tags are common. Google Search Console’s International Targeting report flags hreflang errors—check it monthly.

JavaScript redirects that fire before server-side hreflang

The mistake: Your theme or a third-party app includes a JavaScript snippet that detects location and redirects the visitor before the page fully renders. Googlebot may or may not execute this JavaScript, creating inconsistency between what Google indexes and what visitors see.

The fix: Remove client-side geo-redirect JavaScript entirely. Handle geolocation at the server or edge level (Cloudflare Workers, Shopify Markets, or your hosting provider’s edge functions). Server-side detection happens before the HTML is sent, so hreflang tags and page content remain consistent regardless of whether the request comes from a crawler or a visitor.

SEO health checkOpen Google Search Console, navigate to the International Targeting report, and check for hreflang errors. Then search Google for "site:yourstore.com" and compare the indexed pages against your expected regional structure. If regional pages are missing from the index, your geolocation setup is likely interfering with crawling.

Keeping regional stores crawlable

Beyond hreflang and redirect handling, a few structural practices ensure Google can discover and index all your regional content.

Internal linking across regions. Your main navigation, footer, or sitemap page should link to all regional versions of your store. These links give Googlebot direct paths to regional content without relying on geo-detection.

XML sitemaps per region. Submit separate sitemaps for each regional store in Google Search Console. Each sitemap should list all pages for that region and include hreflang annotations. Shopify generates sitemaps automatically, but verify that all markets are represented.

Canonical tags. Each regional page should have a self-referencing canonical tag pointing to itself, not to the “main” version. A common mistake is setting the canonical of every regional page to the US version, which tells Google to ignore the regional pages entirely.

The interplay between geolocation and SEO comes down to a simple principle: help Google discover your regional pages through metadata and links, not through redirects. Redirects are for humans. Metadata is for crawlers. When you use Navi+ or similar tools to build navigation that includes regional switching, the internal links those menus generate also serve as crawl paths—one more reason the navigation layer matters for international SEO beyond just the visitor experience.

This article is part of the larger guide on Auto-detecting visitor location: when to redirect vs when to ask.

Share Facebook X

Get started with Navi+ AI Menu Builder

Pick your platform — free to install, live in minutes.