URL targeting patterns explained

Run an experiment on one product, a whole section, or every checkout page. Match URLs with exact, contains, starts_with, regex, or query-param rules.

URL targeting decides which pages an experiment runs on. Get this right and your A/B test only affects the visitors you care about. Get it wrong and you'll either run on the whole site (noisy) or on nothing (silent failure).

The five rule types

Exact

Matches one specific URL. Use for testing a single page. Example: https://store.example.com/products/featured matches only that URL.

Contains

Matches any URL with a substring. Use for testing a section across many pages. Example: /category/ matches every category page. Be careful — /product would also match /product-care-guide.

Starts with

Matches URLs from a prefix forward. Cleaner than contains for sections. Example: /checkout/ matches /checkout/cart, /checkout/shipping, /checkout/complete.

Regex

Full regex matching for complex cases. Example: ^/products/[^/]+$ matches every individual product page but not collection or sub-pages. Power users only — a typo here breaks the experiment silently.

Query param

Matches based on URL parameters. Useful for affiliate links, A/B-able landing pages, or campaign tracking. Example: param name ref, value email matches ?ref=email.

Multiple rules

You can stack rules. The experiment runs on any URL that matches any rule (OR logic). Use this for "run on the homepage and on every product page" — add two rules.

Common patterns

  • Whole site: starts_with = /. Runs everywhere. Use sparingly — broad experiments dilute signal.
  • Just the homepage: exact = your full homepage URL.
  • All product pages: starts_with = /products/ on Shopify, /p/ on Salla.
  • Mobile checkout only: combine URL targeting with device targeting.

How to test your rule

Before launching, hit Preview from the experiment editor. The preview opens your site with the variant applied. Browse around — every page that matches your rule should show the variant. Pages that don't match should look untouched.

Common mistakes

  • Trailing slash mismatches. /checkout/checkout/ for exact rules. Use starts_with instead.
  • Protocol mismatches. http:// vs https://. Use contains with just the path to avoid this.
  • Query parameters changing the URL. Use starts_with on the path, then add a query-param rule if needed.

Was this article helpful?

URL targeting patterns explained · Netaj help · Netaj