Targeting
Target experiments by URL pattern, UTM parameters, query strings, and new vs returning visitor status. All conditions are evaluated client-side before variant assignment.
Targeting
Every experiment has targeting rules that decide which visitors are eligible. Only visitors who pass all rules are assigned a variant. Everyone else sees the original page, unmodified.
Targeting is configured in the dashboard when you create or edit an experiment. All rules are evaluated client-side by the experiment runtime before any variant is applied.
URL Patterns
URL patterns control which pages the experiment runs on. Visitors on matching pages are eligible; visitors on other pages are not.
Patterns match against the URL path (slug). Use * to match within a single segment and ** to match across segments.
| Pattern | Matches | Does Not Match |
|---|---|---|
/pricing | /pricing | /pricing/enterprise |
/pricing/* | /pricing/monthly, /pricing/annual | /pricing/a/b |
/blog/** | /blog/post, /blog/2024/recap | /docs/blog |
If no URL pattern is set, the experiment will not run on any page.
Query Parameters
Narrow an experiment to visitors whose URL contains specific query string values. This is useful for targeting paid traffic by UTM parameter, affiliate codes, or any key-value pair in the URL.
Each condition specifies a key, an operator, and (for most operators) a value. All conditions use AND logic — every condition must match for the visitor to be eligible.
| Operator | Meaning | Example |
|---|---|---|
equals | Key exists and value matches (case-insensitive) | utm_source equals meta |
contains | Key exists and value includes the substring | utm_campaign contains spring |
exists | Key is present, regardless of value | gclid exists |
not_equals | Key is missing, or value does not match | utm_source not_equals internal |
not_exists | Key is not present in the URL | debug not_exists |
Matching is case-insensitive for all value comparisons.
Example
To target visitors arriving from a Meta ad campaign:
utm_sourceequalsmetautm_mediumequalscpc
A visitor landing on ?utm_source=meta&utm_medium=cpc enters the experiment. A visitor with only ?utm_source=meta does not (both conditions must match).
Visitor Status
Target experiments based on whether the visitor has been to your site before.
| Option | Who It Targets |
|---|---|
| All visitors | Everyone (default) |
| First-time visitors only | Visitors who have never loaded a page with the experiment snippet on this domain |
| Returning visitors only | Visitors who have loaded at least one previous page with the snippet |
Visitor status is determined by a first-party cookie (_vid) set by the experiment runtime. A visitor without this cookie is considered first-time. Once the cookie is set on the first pageview, all subsequent pageviews are considered returning.
If a visitor clears their cookies, they will be treated as first-time again.
Traffic Allocation
Traffic allocation controls what percentage of eligible visitors enter the experiment. Visitors who are eligible (they pass all targeting rules) but fall outside the allocation percentage see the original page and are not tracked as experiment participants.
Set this to 100 to include all eligible visitors. Lower it if you want to limit exposure while you validate results.
How Rules Combine
All targeting rules are evaluated in order. A visitor must pass every rule to be eligible:
- URL pattern — is the visitor on a matching page?
- Query parameters — does the URL contain the required key-value pairs?
- Visitor status — is the visitor new or returning, as required?
- Traffic allocation — is the visitor within the allocation percentage?
If any rule rejects the visitor, the experiment is skipped entirely for that pageview.
Next Steps
- Content Tests: Modify elements on the same page
- Redirect Tests: Send visitors to a different URL
- JavaScript SDK: Access assignments from your own code
How is this guide?