Skip to content

Set Up Audiences for Web Experimentation

⏱ 15 minutes intermediate

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.

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
  1. Open your experiment and navigate to the Audiences tab
  2. Click Create New Audience (or select a saved audience to reuse)
  3. Name the audience descriptively (e.g., “US mobile returning visitors”)
  4. Add conditions using the builder (see condition types below)
  5. Click Save Audience

Target visitors by geographic location detected from their IP address.

ConditionExample
CountryUnited States
Region / StateCalifornia
CitySan 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.

ConditionOptions
Device typeDesktop, Tablet, Mobile
BrowserChrome, Firefox, Safari, Edge
Operating systemWindows, macOS, iOS, Android
Screen resolutionExact or range-based matching
ConditionWhat it captures
New vs. returningWhether the visitor has been seen before (cookie-based)
Number of sessionsTotal visit count
Time since first visitDays since first tracked visit
Referral URLThe page or domain that sent the visitor

Target visitors based on URL parameters. Useful for campaign-specific experiments.

  1. Select Query Parameter as the condition type
  2. Enter the parameter name (e.g., utm_campaign)
  3. Choose a match type — Equals, Contains, or Matches regex
  4. Enter the value (e.g., spring_sale)

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).

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 window object at page load

Build complex audiences by combining conditions in groups.

Example: “Enterprise desktop users from the US”

  1. Add condition: Country is United States — AND
  2. Add condition: Device type is Desktop — AND
  3. Add condition: Custom attribute plan_tier equals enterprise

Example: “Visitors from paid campaigns”

  1. Add condition: Query parameter utm_medium equals cpc — OR
  2. Add condition: Query parameter utm_medium equals paid_social

Saved audiences appear in the audience library and can be applied to any experiment in the project.

  1. When adding an audience to an experiment, click Choose from Saved Audiences
  2. Select one or more audiences
  3. Multiple audiences combine with OR logic — the visitor enters the experiment if they match any selected audience

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.
IssueCauseFix
No visitors entering experimentAudience conditions too restrictiveBroaden conditions or check that custom attributes are being set before snippet execution
Wrong visitors includedCondition logic incorrect (AND vs. OR)Review condition groups and test with the audience preview
Location targeting inaccurateIP geolocation limitationsUse country-level targeting for reliability; avoid city-level for critical decisions
Custom attributes not recognizedAttributes set after snippet evaluationMove the attribute-setting code above the Optimizely snippet in your page