Split Test Pro
Beginner 6 min read

URL Targeting

Match the right pages with Split Test Pro's URL targeting — the four URL parts you can target, the operators available, and worked examples for single pages, page patterns, and exclusions.

URL targeting is how you tell Split Test Pro which pages an experiment runs on. Every experiment has at least one targeting rule; you can stack rules to match broader patterns or carve out exceptions.

The URL Parts

For each rule, you pick which part of the URL to match against:

URL partWhat it matchesExample
Full URLThe complete URL, including protocol, domain, path, and query string.https://shop.example.com/products/widget?utm=email
Domain onlyJust the hostname.shop.example.com
Path onlyThe path after the domain, leading slash included./products/widget
Hash / fragmentThe #… portion of the URL, leading # included. Empty string when the URL has no hash.#reviews

For most experiments you want Path only — it’s the part of the URL that identifies the page within your site, independent of domain or query parameters.

The Operators

Each rule has an operator that determines how the matching works. Every operator has a positive and negative form:

OperatorWhat it doesNegative form
EqualsExact match.Does not equal
ContainsThe URL part contains the value as a substring.Does not contain
Starts withThe URL part begins with the value.Does not start with
Ends withThe URL part ends with the value.Does not end with
RegexThe URL part matches the regular expression.Does not match regex

The negatives are useful for exclusions — “run on every product page except /products/sold-out” is two rules: one positive (Path starts with /products/) and one negative (Path does not equal /products/sold-out).

Worked Examples

A single product page

URL part:  Path
Operator:  Equals
Value:     /products/your-product

This matches only that exact path. /products/your-product?ref=email matches (because the query string isn’t part of Path); /products/your-product/ with a trailing slash does not (literal equality).

All product pages

URL part:  Path
Operator:  Starts with
Value:     /products/

The trailing slash in the value is intentional — it prevents accidentally matching /products (the index page) or /products-old.

Every page in a section

URL part:  Path
Operator:  Contains
Value:     /collections/winter

Matches /collections/winter, /collections/winter-jackets, /de/collections/winter, anything containing that substring.

URL part:  Hash / fragment
Operator:  Equals
Value:     #reviews

Use this when the same page renders different content depending on the anchor — a product page that scrolls to #reviews, a docs page with a sidebar that highlights #installation, a landing page where #pricing reveals a panel. Include the leading # in the value; the matcher compares against window.location.hash exactly as the browser sees it.

Note: targeting is evaluated on page load, not on hash changes. If a visitor lands on /page and then clicks an in-page link to #reviews, the experiment won’t activate until the next full navigation.

Just the home page

URL part:  Path
Operator:  Equals
Value:     /

The path of the home page is /. Equals / matches only the home page; Starts with / matches every page on your site.

Everywhere except checkout

Use two rules — one positive, one negative:

Rule 1:  Path  Starts with  /
Rule 2:  Path  Does not contain  /checkout

Match a specific UTM source

URL part:  Full URL
Operator:  Contains
Value:     utm_source=email

Restricts the experiment to email traffic. Combine with a path rule to scope further: “Path starts with /products/ AND Full URL contains utm_source=email.”

Power users: regex

URL part:  Path
Operator:  Regex
Value:     ^/products/(widget|gizmo)$

Regex is the escape hatch when none of the other operators express what you need. Use sparingly — regex bugs are hard to debug, and a wrong character can silently exclude all your traffic.

Combining Multiple Rules

When you add more than one rule to an experiment, rules combine with OR — the experiment activates if any rule matches the visitor’s URL. This is useful for targeting several distinct patterns:

Rule 1:  Path  Starts with  /products/widget
Rule 2:  Path  Starts with  /products/gizmo

The experiment runs on either widget or gizmo product pages.

Exclusion Patterns

Negative operators (Does not equal, Does not contain, etc.) are how you carve exceptions. Because rules combine with OR, the cleanest pattern for “match X but not Y” is a single regex rule with a negative lookahead:

URL part:  Path
Operator:  Regex
Value:     ^/products/(?!sold-out$).*

This matches /products/anything but not /products/sold-out.

If regex feels heavy, an alternative is to set the experiment to broad targeting and let the Targeting tab show you a conflict warning for any pages that overlap with another running test — but that’s an after-the-fact catch, not a clean exclusion.

Querying With the Preview URL

Once your rules are set, paste a real URL from your site into the Preview URL field. The match banner tells you immediately whether the rules would activate on that page. See Screenshots and Preview.

The pattern that works:

  1. Define your rules.
  2. Paste an example URL where the experiment should run → confirm “Match.”
  3. Paste an example URL where the experiment should not run → confirm “No match.”
  4. If both behave correctly, your targeting is solid.

What URL Targeting Doesn’t Do

  • It doesn’t check device type — that’s device targeting, a separate setting.
  • It doesn’t check referrer — for traffic-source segmentation, embed a UTM parameter and target on Full URL.
  • It doesn’t check logged-in status, cart contents, or geo — these require a JS variant that runs the check and conditionally fires a custom event.
  • It doesn’t run before page load for SPA route changes — see Single-Page Apps.

Common Mistakes

  • Forgetting the leading slash. Path Equals products/widget will never match (paths always start with /). Should be /products/widget.
  • Using a domain in the Path. Path is just the path — Path Equals https://example.com/widget will never match. Use Full URL if you want to match the whole thing.
  • Trailing slash mismatches. Some platforms add a trailing slash, some don’t. Use Starts with instead of Equals to be tolerant.
  • Targeting / with Starts with. This matches every page on your site, since every path starts with /. Use Equals for the home page only.

Next Steps

Ready to start testing?

Install Split Test Pro and run your first experiment today.

Install on Shopify