Audience targeting

Last updated: May 15, 2026

By default, a test runs against every visitor on every page that contains its markup. Audience rules let you narrow that.

A visitor only enters a test if they pass all of its audience rules. Visitors who fail any rule see the unchanged page (data-split-variant elements stay in place, classes and styles are not applied) and are not counted in the test’s results.


Supported rules

RuleTypeValues
URL includeList of stringsEach is a case-insensitive substring of pathname + search
URL excludeList of stringsSame matching, but any match rejects the visitor
CountryList of ISO-2 codesCountry is determined server-side from the visitor’s IP — not from the browser, so it can’t be spoofed by client code
Devicedesktop / mobile / tabletClassified server-side from the User-Agent
Visitor typenew / returning / logged_inNew = no prior _shopify_y or splt_usr_id cookie. Returning = either cookie present. Logged in = Shopify customer session active

All rules combine with AND. Each list within a rule (URL includes, URL excludes, countries) combines with OR.


URL matching is substring, not glob

This is the part that most often surprises people: the matcher is a plain case-insensitive substring check, not a wildcard or regex match.

You want to matchUse
Every product page/products/
Every collection page/collections/
One specific collection/collections/winter-sale
Visitors arriving from a UTM sourceutm_source=newsletter
Just the cart page/cart (also matches /cart/anything — accept that, or use exclude rules to narrow)

Do not use *. A pattern like /products/* will only match a URL that literally contains the string /products/*, which essentially never happens. Drop the asterisk.

If you need anchored or exact matching, the easiest way is to write the URL with its trailing context (? or end-of-path) — but remember the haystack is pathname + search, lowercased. There is no way to anchor to start-of-path; if /cart matches both /cart and /cart-recovery, exclude the unwanted one with an URL exclude rule.


Country targeting

Country is determined server-side from the visitor’s IP. It works without an IP geolocation library on your side and cannot be spoofed by client code.

Country codes are ISO 3166-1 alpha-2 (DE, US, SE, GB). Case is normalised before comparison.

If the country cannot be resolved (rare — mainly bots and some VPNs), the visitor is rejected whenever country targeting is set.


Audience rules run on every request

A returning visitor is re-evaluated against the audience rules on every page view, not just on first entry. If they hit a page that doesn’t match the URL rules, they get no variant assignment for that page view — even if they previously received one on a different page.

This means:

  • If your test’s markup appears on multiple URL patterns but only one is in the include list, the variant only applies on the included URL.
  • A visitor who entered the test in country US and then routes through a VPN to DE will be rejected if the test is country-locked to US.

If you only want the variant to render on the included URLs, only put the test’s markup on those pages. The sticky-assignment cookie speeds up subsequent page loads, but the audience rules are still checked on every request.


What “rejected by audience” means for results

A visitor who fails any rule is not logged as a participant for that test. They are not in any variant’s denominator, they do not affect conversion rates, and they do not contribute to sample size calculations.


Common patterns

Run a test only on the homepage. URL include: leave empty if / is the only path; otherwise add / (which matches everything). URL exclude: /products/, /collections/, /pages/, /cart, /account, /blogs/.

Test only US visitors on product pages. URL include: /products/ Countries: US

Test only new mobile visitors on a campaign landing page. URL include: /pages/spring-sale Device: mobile Visitor type: new

Avoid testing during checkout flow pages. URL exclude: /cart, /checkout


Preview bypasses audience rules

Audience rules are bypassed for preview links so you can verify a variant from any URL, country, device, or visitor type.