Set Up Audiences for Web Experimentation
Why audience targeting matters
Section titled “Why audience targeting matters”Running an experiment on all visitors dilutes results when only a segment is relevant. A mobile redesign test should only include mobile users. A pricing test for enterprise buyers should exclude free-tier visitors. Audience targeting ensures you measure impact on the people who matter, reducing noise and accelerating time to significance.
How audiences work
Section titled “How audiences work”An audience is a set of conditions that a visitor must satisfy to enter the experiment. Conditions evaluate at the moment the Optimizely snippet executes on the page. Visitors who do not match are excluded entirely — they see the default page experience and are not counted in results.
Conditions combine with AND/OR logic:
- AND — The visitor must satisfy all conditions in the group
- OR — The visitor must satisfy at least one condition in the group
Create an audience
Section titled “Create an audience”- Open your experiment and navigate to the Audiences tab
- Click Create New Audience (or select a saved audience to reuse)
- Name the audience descriptively (e.g., “US mobile returning visitors”)
- Add conditions using the builder (see condition types below)
- Click Save Audience
Condition types
Section titled “Condition types”Location
Section titled “Location”Target visitors by geographic location detected from their IP address.
| Condition | Example |
|---|---|
| Country | United States |
| Region / State | California |
| City | San Francisco |
| DMA (Designated Market Area) | San Francisco-Oakland-San Jose |
Tip: Location targeting is approximate. Use country-level for reliable segmentation. City-level accuracy varies.
Device and browser
Section titled “Device and browser”| Condition | Options |
|---|---|
| Device type | Desktop, Tablet, Mobile |
| Browser | Chrome, Firefox, Safari, Edge |
| Operating system | Windows, macOS, iOS, Android |
| Screen resolution | Exact or range-based matching |
Visitor behavior
Section titled “Visitor behavior”| Condition | What it captures |
|---|---|
| New vs. returning | Whether the visitor has been seen before (cookie-based) |
| Number of sessions | Total visit count |
| Time since first visit | Days since first tracked visit |
| Referral URL | The page or domain that sent the visitor |
Query parameters
Section titled “Query parameters”Target visitors based on URL parameters. Useful for campaign-specific experiments.
- Select Query Parameter as the condition type
- Enter the parameter name (e.g.,
utm_campaign) - Choose a match type — Equals, Contains, or Matches regex
- Enter the value (e.g.,
spring_sale)
Custom attributes (via API)
Section titled “Custom attributes (via API)”For conditions that Optimizely cannot detect automatically, pass custom attributes using the JavaScript API before the snippet evaluates.
window.optimizely = window.optimizely || [];window.optimizely.push({ type: 'user', attributes: { plan_tier: 'enterprise', lifetime_value: 4500, signup_date: '2024-06-15', },});Then create a condition in the audience builder using the attribute name (e.g., plan_tier equals enterprise).
Third-party integrations
Section titled “Third-party integrations”Optimizely integrates with data platforms to enable richer targeting:
- Optimizely Data Platform (ODP) — Target by behavioral segments and real-time customer profiles
- Cookie values — Read first-party cookies to segment visitors
- JavaScript variables — Evaluate any variable on the
windowobject at page load
Combine conditions with logic
Section titled “Combine conditions with logic”Build complex audiences by combining conditions in groups.
Example: “Enterprise desktop users from the US”
- Add condition: Country is United States — AND
- Add condition: Device type is Desktop — AND
- Add condition: Custom attribute
plan_tierequalsenterprise
Example: “Visitors from paid campaigns”
- Add condition: Query parameter
utm_mediumequalscpc— OR - Add condition: Query parameter
utm_mediumequalspaid_social
Reuse audiences across experiments
Section titled “Reuse audiences across experiments”Saved audiences appear in the audience library and can be applied to any experiment in the project.
- When adding an audience to an experiment, click Choose from Saved Audiences
- Select one or more audiences
- Multiple audiences combine with OR logic — the visitor enters the experiment if they match any selected audience
Estimate audience size
Section titled “Estimate audience size”After configuring conditions, the audience builder shows an estimated percentage of your traffic that qualifies. Use this to plan:
- Below 10% — The experiment will take significantly longer to reach significance. Consider broadening conditions.
- 10% to 50% — Good balance between precision and speed.
- Above 50% — The audience is broad. Confirm that all matching visitors are truly relevant.
Troubleshooting
Section titled “Troubleshooting”| Issue | Cause | Fix |
|---|---|---|
| No visitors entering experiment | Audience conditions too restrictive | Broaden conditions or check that custom attributes are being set before snippet execution |
| Wrong visitors included | Condition logic incorrect (AND vs. OR) | Review condition groups and test with the audience preview |
| Location targeting inaccurate | IP geolocation limitations | Use country-level targeting for reliability; avoid city-level for critical decisions |
| Custom attributes not recognized | Attributes set after snippet evaluation | Move the attribute-setting code above the Optimizely snippet in your page |