/Docs

URL Targeting

URL targeting rules determine which pages your experiment is active on. A visitor must be on a page that matches at least one of your URL rules for the experiment to run. If no URL rules match the current page, the snippet skips the experiment entirely — the visitor sees the default experience and is not enrolled.

Where to configure URL rules

URL rules are configured in Step 1: Targeting of the experiment builder. When you create a new experiment, the first thing you will be asked to do is define where the experiment runs. You can add one or more URL rules, each with its own match type and value.

Match types

Each URL rule uses one of four match types. The match type determines how the rule value is compared to the current page URL.

Simple (pathname prefix)

Simple matching checks whether the current URL's pathname starts with the value you enter. It is forgiving and flexible — ideal for targeting an entire section of your site.

text
1Rule value: /products
2Condition: Matches
3
4Matches: https://example.com/products
5 https://example.com/products/shoes
6 https://example.com/products/shoes?color=red
7Does not: https://example.com/cart
8 https://example.com/shop/products

Best for: Targeting an entire category of pages, like all product pages, all blog posts, or all pages under /checkout.

Exact

Exact matching requires the full URL — including protocol, domain, path, and query string — to match precisely. The visitor must be on that exact URL, with no variation.

text
1Rule value: https://example.com/pricing
2Condition: Matches
3
4Matches: https://example.com/pricing
5Does not: https://example.com/pricing/
6 https://example.com/pricing?plan=pro
7 https://www.example.com/pricing

Best for: Targeting a single, stable page with a known, unchanging URL.

Substring

Substring matching checks whether the value you enter appears anywhere in the full URL string — including the domain, path, and query string.

text
1Rule value: checkout
2Condition: Matches
3
4Matches: https://example.com/checkout
5 https://example.com/checkout/payment
6 https://example.com/express-checkout
7 https://example.com/cart?step=checkout
8Does not: https://example.com/products
9 https://example.com/account

Best for: Targeting pages where a keyword appears in the URL but the full path varies or is unpredictable.

Regex

Regex matching tests the full URL against a JavaScript regular expression you provide. This is the most powerful option and lets you express complex patterns with a single rule.

text
1Rule value: /\/product\/[0-9]+/
2Condition: Matches
3
4Matches: https://example.com/product/123
5 https://example.com/product/9999
6Does not: https://example.com/product/shoes
7 https://example.com/products
text
1Rule value: /\/(checkout|cart)(\/|$)/
2Condition: Matches
3
4Matches: https://example.com/checkout
5 https://example.com/checkout/payment
6 https://example.com/cart
7Does not: https://example.com/products

Best for: Dynamic URL patterns, numeric IDs in paths, or targeting multiple specific paths with one rule.

Conditions: Matches and Does Not Match

Each URL rule has a condition that is either Matches or Does Not Match.

Matches — the experiment runs when the URL satisfies the match type pattern. This is what you will use most of the time.

Does Not Match — the experiment runs when the URL does NOT satisfy the pattern. Use this to exclude specific pages from a broader rule. For example, you might run an experiment on all pages under /blog except /blog/archive.

Multiple rules use OR logic

When you add more than one URL rule to an experiment, the rules are combined with OR logic. The experiment runs if ANY of the rules match the current page — the visitor does not need to satisfy all rules at once.

text
1Rule 1: Simple / /products → Matches
2Rule 2: Simple / /collections → Matches
3
4Result: The experiment runs on /products AND on /collections
5 (any page matching either rule)
Combining matches and exclusions
You can mix Matches and Does Not Match rules. The experiment evaluates each rule and runs only if the visitor satisfies at least one Matches rule and no Does Not Match rules trigger. For example: run on /shop (Matches) but not on /shop/sale (Does Not Match).
Info
URL targeting is evaluated before any audience conditions. If the current page does not match any URL rule, the snippet skips audience evaluation entirely and does not enroll the visitor.