Shoppers moving between your own stores: the referrer rule

A store with more than one storefront has a specific irritation that single-store merchants never meet. The shopper on your Canadian site clicks the link to your US site, arrives, and is immediately asked whether they would like to shop the Canadian site. They were just there. They left on purpose. The popup that was helpful on first arrival is, in this one moment, insulting, and in redirect mode it is worse than insulting: it sends them straight back to where they came from, and the link between your stores appears not to work.

GeoBeacon handles this with a small rule that looks at where the page view came from. This post explains what the rule checks, how the list it checks against is filled in, why it sometimes does not fire, and how to test it, because testing it badly is the most common way merchants conclude the app is broken.

What the rule checks

Every page view carries a referrer: the address of the page whose link the shopper followed, which the browser sends along and exposes to scripts on the new page. The GeoBeacon script reads it, takes just the host part, lowercases it, and compares it with two things. If the referrer host is the same as the host of the page itself, the shopper came from another page on this store, and the rule does nothing; that case is covered by the remembered choice instead. If the referrer host is different and appears on your list of known hosts, the script stops for this page view, logging the reason came-from-own-store when console logging is on. No detection request, no popup, no redirect.

The comparison is exact. shop.example.de and example.de are two hosts, and www.example.de is a third. If your other store answers on both the bare domain and www, list both. There are no wildcards, which is deliberate: a pattern like *.example.com would also match a Shopify preview domain or a staging store, and the rule is meant to describe the handful of places your shoppers legitimately move between.

Where it sits in the decision

The script runs a short series of checks in a fixed order before it ever asks Shopify for the shopper's country, and the referrer rule is near the end. It comes after the enabled check, the theme editor check, the bot check, the ?geobeacon=off parameter, the remembered choice and the excluded paths. It comes before the check that at least one rule is enabled. The order matters in two ways.

  • A remembered choice wins first. If this shopper already picked a country on this store in the past, that memory is why the popup stays quiet, and the referrer is never consulted. The log shows the remembered reason, not the referrer one.
  • Nothing is written. Unlike a remembered choice, the referrer rule leaves no cookie or storage entry behind. It applies to the one page view that arrived from your other store; the shopper's next click, now with your own store as referrer, is treated as a normal visit. If they then wander for a while, they will see the popup on their second page unless something else stops it.

That second point is a trade. Writing a memory on arrival would keep the shopper quiet for the whole visit, but it would also mean a shopper who clicked a link by mistake and immediately wants to go back would have to find the country switcher. Showing the popup on the second page costs one dismissal; redirecting a shopper who chose to be here costs the sale. The rule errs toward the first. If you want a longer silence, the shopper's own answer to the popup provides it, for as long as you configured in how long to remember a shopper's choice.

How the list gets filled

You rarely type it. When you generate rules from Shopify Markets, GeoBeacon reads the domains Shopify reports for each market and adds every host it finds to the known hosts list at the same time as it writes the rules. A store whose markets sit on separate domains, example.ca and example.com, ends up with both listed. A store that uses subfolders under one domain gets that one domain, which is harmless since it matches the page host and the rule stands aside. Shopify's own guide to domains and languages for markets describes which domains a market can have.

The manual list lives under Behaviour, in the field labelled Your other store domains, one host per line. It is for the storefronts Markets does not know about: a separate Shopify store on its own plan, a wholesale site, a brand site on another platform that links to the shop, the old domain that still redirects to the new one. Up to 50 hosts fit. Each line is cleaned before saving: surrounding spaces are trimmed, capitals are lowered, a full URL is cut down to its host, and anything after a slash is dropped. A port survives if you include one, which is only useful for local testing. Anything that is not a plausible hostname is discarded rather than saved broken.

Related but different: distributors and marketplaces

The list is for stores you want shoppers to move between freely. It is not the right place for a distributor's website or a marketplace listing that links to you. A shopper arriving from a distributor in Australia may well be in Australia and may well be better served by the popup; that case has its own article, geolocation popups and distributor websites. Adding distributors to the known hosts would switch the popup off for exactly the visitors it is for.

When the referrer is missing

The rule can only act on a referrer the browser sends, and browsers do not always send one. The common cases:

  • The link carries rel="noreferrer". Some themes and link builders add it to every external link by default. The referrer arrives empty.
  • The other site sets a Referrer-Policy of no-referrer. The browser's default policy, documented on MDN, trims the referrer to its origin on cross-site navigations, which still carries the host and is enough for the rule. A stricter policy removes it entirely.
  • The shopper typed the address, used a bookmark, or came from an app. Links opened from WhatsApp, Instagram and most email clients arrive with no referrer or with the app's own domain as referrer.
  • A redirect sits between the stores. If example.ca sends shoppers through a tracking redirect on a third domain, the referrer the browser reports is whatever that hop decides, and it is often nothing.

In all of these the referrer rule stands aside and the normal behaviour applies, which means a shopper who crossed from your other store may see the popup once. For a store-switcher link you control, the fix is on the sending side: do not add noreferrer to links between your own stores, and link directly rather than through a redirect. For the cases you do not control, the dismissal is remembered and that is the end of it.

Testing it without fooling yourself

Here is the mistake. You install GeoBeacon on your US store, open your Canadian store in the same browser, click through to the US store to see the popup, and nothing appears. The rule is working: you arrived from a known host. The second mistake is to then test by reloading, which also shows nothing, because a reload keeps the original referrer.

  1. Open a private window. Type the US store's address directly, with ?geobeacon=CA appended to force a Canadian detection for this page view. The popup should appear.
  2. In another private window, open the Canadian store and click its link to the US store. Nothing should appear. With "Log decisions to the browser console" on in the app embed, the console reports came-from-own-store.
  3. From that page, click any product. The popup should now appear if your rule would normally fire, because the referrer is now your own store. This confirms the rule applied to one page view only.
  4. If step two showed the popup, check the console reason. If it is not the referrer reason, open the browser's network panel, select the document request and read the Referer header. An empty one points at the sending side; a host that differs from your list points at the spelling.

The rule is one line of logic and one list, and most stores never think about it because Markets fills the list for them. It earns its place the first time you add a second storefront, and the first time a shopper clicks between them and simply arrives, without being asked where they would rather be.

Frequently asked questions

Why does GeoBeacon not show the popup when I click from my other store?

Because the page you arrived from is on your list of known hosts. GeoBeacon reads the referrer of the page view, and if its host is one of your other store domains the script stops with the reason came-from-own-store. A shopper who just chose a store should not be asked again on arrival. Open the store directly in a private window to see the popup.

Which domains are in the known hosts list?

Every domain and subfolder root Shopify reports for your markets is added when you generate rules from Markets, and you can add up to 50 more under Your other store domains in Behaviour. Entries are hosts only: a pasted URL is reduced to its host, letters are lowercased, and a port is kept if you include one.

Does the referrer rule need cookies or storage?

No. It works from the referrer the browser sends with the page view and writes nothing. It applies to that one page view only; the next page the shopper opens on the same store has your store as its referrer and the rule no longer applies, so the normal remembered-choice logic takes over.

Why did the popup appear anyway after a link from my other store?

Most often the browser did not send a referrer: the link had rel=noreferrer, the other site sets a no-referrer policy, or the shopper came through an app that strips referrers. Less often the host is spelled differently in the list, for example www.example.de listed while the link points at example.de. Hosts must match exactly.