/Docs

Targeting & Audiences

Before an experiment can run for a visitor, it must pass through a three-stage filter: URL targeting rules, audience conditions, and traffic allocation. Each stage is a gate — a visitor must pass all three to be assigned a variation.

The filter chain

Think of it as a funnel. Every visitor who loads a page on your site enters the funnel. At each stage, some visitors are excluded. Only visitors who make it through all three stages get assigned to a variation and have the experiment applied to them.

Stage 1 — URL targeting rules

The first check is: is this visitor on the right page?

Each experiment has one or more URL targeting rules. The snippet checks the current page URL against all of the rules. If any one rule matches, the visitor passes this stage (rules use OR logic — matching any rule is sufficient).

There are four URL match types:

  • Simple match — the URL path starts with the value you entered. For example, a simple match on /blog matches /blog, /blog/my-post, and /blog/category/tech.
  • Exact match — the URL path must exactly equal the value. A match on /pricing only matches /pricing, not /pricing/enterprise.
  • Substring match — the URL path must contain the value anywhere. A match on checkout matches /checkout, /checkout/confirm, and /store/checkout/complete.
  • Regex match — the URL path must match a regular expression. For example, ^/product/[0-9]+$ matches any URL like /product/123 but not /products.

Each rule also has a condition: Matches (the URL must match) or Does Not Match(the URL must not match). Use “Does Not Match” to exclude specific pages from an experiment that otherwise runs broadly.

Info
URL targeting checks the path portion of the URL only (everything after the domain), not the query string or fragment. For example, for the URL https://acmecorp.com/pricing?plan=pro#compare, the path is /pricing.

Stage 2 — Audience conditions

The second check is: is this visitor the right kind of visitor?

Audiences let you target experiments to specific segments of your visitors. Examples: only mobile visitors, only visitors from the US, only logged-in users, only visitors who arrived from a Google Ads campaign.

An experiment can have zero or more audiences configured. The logic is:

  • If no audiences are configured (the picker shows the Everyone tag), all visitors pass this stage.
  • If one or more audiences are configured, the visitor must match at least one audience to pass (audiences use OR logic across audiences).
  • Within a single audience, all conditions must be true (conditions within an audience use AND logic).

For example: if an experiment has audiences “Mobile visitors” and “US visitors”, any visitor who is either on mobile OR in the US will pass this stage. A visitor would only be excluded if they are neither on mobile nor in the US.

Stage 3 — Traffic allocation

The third check is: is this visitor in the experiment at all?

Experiments have a traffic allocation percentage — the portion of eligible visitors who actually participate in the experiment. By default this is 100%, meaning all eligible visitors are included. You can lower it (for example, to 20%) to run the experiment on a smaller slice of your traffic.

The allocation is deterministic: it is based on a hash of the visitor's unique ID and the experiment ID. This means the same visitor always gets the same result — they are either always in or always out of a given experiment. There is no randomness per visit.

Variation assignment

Once a visitor has passed all three stages, they are assigned to a variation. This assignment is also deterministic — based on a hash of the visitor's ID and the experiment ID. The variation weights (traffic splits) you set in the experiment builder determine the probability of each outcome, but once a visitor is assigned, they stay assigned permanently (until you change the experiment or clear their cookie).

Tip
Because all allocation is deterministic, you can safely stop and restart an experiment without worrying about visitors switching variations. The same visitor will always land in the same bucket.