One rule for every country: GeoBeacon's Detected country

The first time a merchant opens the GeoBeacon rules page with twelve markets configured in Shopify, the instinct is to write twelve rules. Germany to the Germany market, France to the France market, and so on down the list. It works, and it is more typing than the job needs. The target selector on every rule has a first option called Detected country (recommended), and it exists so that one rule can do what those twelve would do, and keep doing it when you add a thirteenth market next year.

This post is about that option: what it switches, how it decides when not to act, how it reads in the popup, and the two situations where a specific country rule is still the better tool.

What a rule target actually is

A GeoBeacon rule has two halves. The left half is a list of visitor countries, typed as codes such as DE, FR, or the EU shorthand, or a single asterisk meaning everyone. The right half is the target: where a matched visitor is offered to go. The target type is either A market on this store (switch country / currency) or Another website or store (URL). This post is about the first kind.

A market target does not send the visitor to a different site. It switches the storefront's country context, the same thing a shopper does by hand in your theme's country selector, so prices, currency, shipping and payment options come from the matching Shopify Market. The Markets documentation describes what changes when the context switches. The question a market target has to answer is simply: which country?

The three groups in the Country context selector

Open any rule with a market target and the Country context dropdown shows three groups. At the top, on its own, is Detected country (recommended). Below it, Countries in your markets lists the countries your active markets currently offer. Below that, All countries lists everything else, which is useful only when you are setting up a market you have not yet published.

Picking a named country makes a fixed rule: every visitor matched by the left half is switched to that one country. Picking Detected country makes a relative rule: each visitor is switched to the country GeoBeacon detected for them. The help text under the field puts it in one line: Detected country keeps each shopper on their own country's pricing.

How a Detected country rule decides

When a page loads, GeoBeacon learns the visitor's country from Shopify's own detection, walks the rule list from the top, and stops at the first enabled rule whose country list contains that country. If that rule's target is Detected country, the decision continues in a specific order.

  1. Resolve the country. The placeholder becomes the detected code. A visitor from Austria resolves to AT.
  2. Check the market offers it. GeoBeacon holds the list of countries your active markets include. If AT is not in it, the decision is country-not-offered: no popup, no redirect, and a line in the decision log saying why. A fixed country rule never hits this case, because you chose the country from the list; a Detected country rule hits it for every visitor from outside your markets, which is exactly the behaviour you want from a catch-all.
  3. Resolve the language. If the rule's optional language field is set, that language is used. If it is empty and language suggestions are on, the visitor's browser language is used when the target market publishes it; otherwise the market's default language stands.
  4. Compare with where they already are. If the storefront is already in that country and language, the decision is already-there and nothing happens. This is the rule that stops a Detected country catch-all from nagging your domestic shoppers: a German visitor already browsing in the German context matches the rule and is then left alone.
  5. Act according to the mode. In popup mode the visitor is asked; in redirect mode the context is switched straight away. Remembered choices, excluded paths and bot detection have all been checked before this point, exactly as for any other rule.

The upshot is that a single rule, country list set to the asterisk and target set to Detected country, behaves as: for anyone whose country has a market and who is not already in it, offer that market. Add a market in Shopify and the rule covers it on the next page load. Remove one and visitors from that country quietly fall into country-not-offered. There is nothing to edit in GeoBeacon either time.

What the popup says

A fixed rule often has a label such as "our German store" typed into Store name shown in the popup (optional), and the popup text uses it through the {target} placeholder. A Detected country rule cannot know the label in advance, so when the field is empty GeoBeacon substitutes the display name of the detected country in the visitor's own language. The default accept button, Go to the {target} store, renders as Go to the Austria store for one visitor and Go to the Canada store for the next, from the same rule. The {country} placeholder in the title works the same way. If you do type a label on a Detected country rule, it is used for everyone the rule matches, so keep it generic: "your local store" reads well; "our Berlin shop" does not when the visitor is in Toronto.

When a per-country rule is still the right tool

  • A country that should go somewhere else. If Swiss visitors should land on your separate .ch website rather than a market on this store, that is a URL target and needs its own rule. Place it above the catch-all; the first match wins, and Switzerland will never reach the Detected country rule.
  • A region served by a neighbour's market. If you ship to Liechtenstein from your Switzerland market but have no Liechtenstein market, a Detected country rule will see LI, find no market, and do nothing. A fixed rule, LI to the CH country context, does what you mean. The post on visitors from countries you do not ship to covers the other side of that decision, when doing nothing is the goal.
  • A forced language. If every visitor from Belgium should get French regardless of browser language, a BE rule with the language field set to fr beats the catch-all's detected language behaviour. The EU shorthand post explains how rule order interacts with grouped country lists.

In every one of those cases the pattern is the same: specific rules at the top, the Detected country catch-all at the bottom. The rules page shows the order, and you can drag or renumber to fix it.

Checking it without a VPN

Append ?geobeacon=AT to any storefront URL and GeoBeacon treats you as a visitor from Austria for that page load. With the browser console open, the decision log shows which rule matched, what the target resolved to, and whether the result was a popup, a redirect, already-there or country-not-offered. Try one country you have a market for, one you do not, and your own, and you will have exercised all three branches of the rule in under a minute. The decision log post lists every reason you can see there.

Twelve rules that each name a country are not wrong. They are twelve places to forget an edit the day your markets change. One rule that says "their own country, if we have it" is what GeoBeacon recommends because it is the rule that stays correct on its own.

Frequently asked questions

If I use one Detected country rule, what happens to visitors from a country my markets do not cover?

Nothing visible. GeoBeacon checks the detected country against the countries your markets actually offer, and when there is no match it records a country-not-offered decision and leaves the visitor on the page as it loaded. No popup appears and no redirect happens, so you never send someone to a market that does not exist.

Can I combine a Detected country catch-all with specific rules for a few countries?

Yes, and that is the usual setup for stores with a separate website for one region. Rules are read from the top, the first rule whose country list matches wins, and a rule with the asterisk country list matches everyone who was not matched above it. Put the specific rules first and the Detected country rule last.

Does the Detected country target change the language as well as the country?

Only if you let it. The rule has an optional language field for an ISO code such as de or fr. Leave it empty and GeoBeacon uses the visitor's detected language when the target market offers it; set it and every visitor matched by the rule is switched to that language.

What does the popup say when the target is Detected country?

The same text as any other rule, with the {country} placeholder replaced by the visitor's country and {target} replaced by the rule's label if you typed one, or by the display name of the detected country if you did not. A single rule therefore produces a correctly named popup for every country without you writing one per market.