Routing rules: worked examples

Six real rule sets, scan by scan: app downloads, a multilingual menu, a city refinement with a country safety net, opening hours, a rule-order mistake and a first-100 prize.

Each example below is a rule set you could build today, followed by the scans it gets and where each one lands. Every outcome on this page is checked by an automated test against the same routing engine that answers real scans, so if the product ever changed, this page would fail to publish rather than mislead you. The complete guide explains the ideas; this page shows them working.

Rules are listed top to bottom — the order they are checked in. "Fallback" is the code's own destination, where a scan goes when no rule matches.

App downloads by phone

A code on packaging that should open the right app store.

  1. Operating system is one of iOS → the App Store listing
  2. Operating system is one of Android → the Play Store listing
  3. Fallback → the product's website
  • An iPhone scan goes to the App Store.
  • An Android scan goes to the Play Store.
  • Anything else — a computer, or a phone whose system can't be read — goes to the website.

If you want the app to open when it's already installed, use a Deep link action instead of a plain destination on those rules.

A menu in the visitor's language

A restaurant with French and German menus, and English for everyone else.

  1. Browser language is one of de → the German menu
  2. Browser language is one of fr → the French menu
  3. Fallback → the English menu
  • A browser that sends fr-CH, fr;q=0.9, de;q=0.7 — French first, German too — gets the French menu, even though the German rule is above it. Each scan is decided as one language, the visitor's highest-ranked language any rule mentions, before the rules are checked.
  • A browser that sends de-AT, en;q=0.8 gets the German menu: de covers Austrian German.
  • A Japanese visitor whose browser sends ja, en;q=0.9 matches neither rule and gets the English menu from the fallback.

Where "the German menu" and "the French menu" actually live

A hosted page belongs to exactly one code, so a language rule doesn't switch the content inside one page — it sends the scan to a different code's address entirely. "The German menu" is its own Menu code, with its own published page. To set this up:

  1. Create the code you'll print, plus one Menu code per extra language — German and French here — and publish each code's page.
  2. Open the German code and copy its address from View public page. Do the same for the French code.
  3. On the printed code's Rules tab, add the two language rules above, each pointing at the matching code's address. Routing rules need Pro or above.
  4. Run Test a scan for a German browser and a French one before you publish, and check each one lands on the page you expect — see testing a scan with the simulator.
  5. Publish the printed code and print only that one. The German and French codes are never printed or handed to a guest.

Don't archive or delete the German or French code afterwards while the printed code's rule still points at it. The rule keeps sending matching scans there — it has no way to know the destination changed — but that address now answers with a neutral "this page is gone" notice instead of the menu. Update or remove the language rule first if you retire a language.

Try this one yourself:

A menu in the scanner's language

A table code that opens the menu in French, German, Spanish or English, matching the browser's highest-ranked language among the four. A scan counts as one language: the browser's highest-ranked one that a rule serves — which is why English has a rule of its own here, not just the fallback.

Rules are checked from the top. The first enabled rule that matches the scan decides where it goes, and a scan no rule matches goes to the fallback. Pick a scan or set your own, and the rule that decides it is highlighted.

  • Switzerland (CH)

Leave empty to simulate a scan whose country is unknown (a VPN, or an address that can’t be placed).

The region the scan comes from, in the country above — the code a real scan reports alongside its name. Best-effort for real scans. Leave blank to simulate as unknown.

In order of preference, the way a browser sends them — or paste a real Accept-Language header. Leave blank to simulate as unknown.

The instant of the simulated scan.

Used by rules set to "scanner's local time". Leave it blank for a scan from a location we can't place: like a real one, it's read in UTC.

More scan details — in-app browser, OS version, city, location, scan number, returning visitor, referrer

Browsers differ in what they report — see what a real scan from this one tells the edge below.

The version the device really runs. Leave blank for a current one — every phone reports some version.

A real scan reports the continent along with the country, so it's taken from the country unless you pick one.

As a scan reports it — usually the English name (Munich, not München); case and accents don’t matter. Leave blank for unknown.

For distance rules. A real scan is placed near its city's centre, and only roughly. Leave blank to simulate as unknown.

For distance rules. A real scan is placed near its city's centre, and only roughly. Leave blank to simulate as unknown.

Which of the code's counted scans this is — 1 is its first. Only scans that reach a destination count: not bots, and not scans that stop at a password or age prompt or a warning page. A scan limit of 100 serves scans 1 to 100. Real scans are counted approximately: when many people scan at the same moment some can get the same number, so a busy code may serve some past a limit or an "at most" rule. Leave it blank to simulate a scan made while the counter couldn't be read, which no scan-number rule matches.

No enabled rule here reads this, so this choice changes nothing — and a real scan of a code with these rules sets no returning-visitor cookie. Add a returning-visitor rule and scans are remembered from the moment it is published.

Leave blank to simulate this as unknown.

No version entered, so this tests a current iOS 26 — enter one to test another.

What a real scan from this device tells the edge: iOS 26.

The User-Agent this device's browser sends, which the edge reads: Mozilla/5.0 (iPhone; CPU iPhone OS 18_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1

Resolves to https://example.com/menu/fr, via "French".

Language rules see this visitor as fr-ch — the first language in their list that one of your rules names, or their first language if no rule names any of them.

  1. FrenchMatched

    language is fr — simulated value: fr-ch

    → https://example.com/menu/fr

  2. GermanNot reached

    → https://example.com/menu/de

  3. SpanishNot reached

    → https://example.com/menu/es

  4. EnglishNot reached

    → https://example.com/menu/en

Your changes stay in this tab and are gone when you leave. On your own codes, routing rules come with Pro and above, and A/B splits and rotations with Business and above.

The multilingual menu in the public routing simulator — pick a scan to see where it lands.

A city refinement with a country safety net

A campaign with a Paris-only offer, a French page and an international page.

  1. City is one of Paris → the Paris offer
  2. Country is one of France → the French page
  3. Fallback → the international page
  • A scan placed in Paris gets the Paris offer.
  • A Parisian using iCloud Private Relay whose connection appears to come from Lyon still gets the French page — rule 2 is the safety net that catches them.
  • Without rule 2, that same Parisian would get the international page, in the wrong language, with no sign anything had gone wrong.

City, region and distance are best-effort for exactly this reason, and the dashboard warns you when a rule that reads them has no country-level rule beneath it. Keep the country rule below the city rule: in the other order, the country rule would catch every French scan first and the Paris rule would never be reached.

Opening hours

A booking page during opening hours, and the opening times otherwise.

  1. Day of week is Monday to Friday and time of day is 9:00 to 17:00, in the fixed time zone Europe/London → the booking page
  2. Fallback → the opening-times page
  • A scan on a Tuesday at 10:00 London time gets the booking page.
  • A scan on a Tuesday at 17:00 gets the opening-times page: a time window runs up to, but not including, its end.
  • A scan on a Saturday at 10:00 gets the opening-times page.

A fixed zone is right here because the office's hours are the office's, wherever the scanner is. For a lunch menu that follows each scanner's own day, choose Scanner's local time instead.

Rule order: the most common mistake

A code meant to send iPhones to an iPhone page and every other phone to a mobile page:

  1. Device type is one of mobile → the mobile page
  2. Operating system is one of iOS → the iPhone page
  3. Fallback → the desktop page
  • An iPhone scan gets the mobile page. It matches rule 1 first, and the first match wins — rule 2 is never looked at.

The dashboard's overlap warnings compare only two single-condition rules of the same kind, so they can't catch this pair — a device type and an operating system. The scan simulator shows it at once: simulate an iPhone and it reports rule 1 as matched and rule 2 as not reached. The fix is to swap them: with the iOS rule first, an iPhone gets the iPhone page and an Android phone still gets the mobile page.

The first hundred scans win a prize

  1. Scan count is at most 100 → the prize page
  2. Fallback → the thank-you page
  • Scans 1 to 100 get the prize page; scan 101 gets the thank-you page.

The count is kept where scans are answered, and when many people scan at the same moment some are given the same number — so a busy code hands out more than 100 prizes. How many more depends on how fast it is scanned: in our tests a code scanned 50 times a second let about twice as many through as the rule's number, and at 200 a second nearly four times. Use this for "roughly the first hundred", and don't promise an exact number of winners with it.

Routing rules: worked examples · QRtoMany