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.
1Rule value: /products2Condition: Matches3
4Matches: https://example.com/products5 https://example.com/products/shoes6 https://example.com/products/shoes?color=red7Does not: https://example.com/cart8 https://example.com/shop/productsBest 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.
1Rule value: https://example.com/pricing2Condition: Matches3
4Matches: https://example.com/pricing5Does not: https://example.com/pricing/6 https://example.com/pricing?plan=pro7 https://www.example.com/pricingBest 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.
1Rule value: checkout2Condition: Matches3
4Matches: https://example.com/checkout5 https://example.com/checkout/payment6 https://example.com/express-checkout7 https://example.com/cart?step=checkout8Does not: https://example.com/products9 https://example.com/accountBest 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.
1Rule value: /\/product\/[0-9]+/2Condition: Matches3
4Matches: https://example.com/product/1235 https://example.com/product/99996Does not: https://example.com/product/shoes7 https://example.com/products1Rule value: /\/(checkout|cart)(\/|$)/2Condition: Matches3
4Matches: https://example.com/checkout5 https://example.com/checkout/payment6 https://example.com/cart7Does not: https://example.com/productsBest 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.
1Rule 1: Simple / /products → Matches2Rule 2: Simple / /collections → Matches3
4Result: The experiment runs on /products AND on /collections5 (any page matching either rule)/shop (Matches) but not on /shop/sale (Does Not Match).