On this page

Web Experiment targeting

Web Experiments target both pages and audiences. Amplitude evaluates page targeting first, then audience targeting. Both targeting methods evaluate locally in the browser when the page first loads.

Web Experiments use Pages to control where experiment variants apply on your website. Pages define when a web experiment applies, including targeting conditions that match specific URLs and visual editor URLs for previewing experiments.

Audience targeting

By default, a new Web Experiment targets all users. Audience targeting lets you target specific users for your experiment. Users outside the target audience receive the default experience and don't count towards analysis.

If any segment matches, Amplitude buckets that user into a variant based on the rollout and variant distribution. For a segment to match, the user must meet all conditions you set.

Browser properties (local)

Browser properties are available client-side and don't require network requests, so Amplitude evaluates them with low latency.

Real-time behavioral targeting (local)

Beta feature

Real-time behavioral targeting is in beta. Behavior and APIs may change before general availability.

Real-time behavioral targeting lets you target users based on actions they perform during their current and previous sessions. Amplitude evaluates these conditions in real time as users perform Amplitude events, without network requests.

When users become eligible: the moment a behavioral condition becomes true (for example, after the 5th article view), users become eligible and Amplitude buckets them into the experiment.

How it works: the Web Experiment SDK listens to Amplitude events as they fire in the browser, stores behavioral signals in localStorage, and evaluates targeting conditions in real time.

The SDK persists events for real-time behavioral targeting only when the events appear in your targeting conditions and the experiment is on. There's no historical look-back before you turn on the experiment, so the effective evaluation window is whichever is shorter: the time window you set, or how long the experiment has been running.

If you don't load Analytics and Web Experiment together through the unified script tag, call window.amplitude.add(window.webExperiment.plugin()) so the web experiment client receives tracked event notifications.

Supported conditions

Real-time behavioral targeting supports event-based conditions:

  • Event counts: target users who performed an event a specific number of times.
  • Time windows: evaluate behavior within the current session or over a specific time period (last X hours or days).
  • Property filtering: combine multiple property conditions with AND logic (for example, "where category = 'electronics' AND item_value > 200").
  • Cross-page tracking: behavioral signals persist across page navigations and browser sessions.

Example targeting rules

Real-time behavioral targeting vs. cohorts

Use real-time behavioral targeting when:

  • You react to what a user does in this session, not only what they did days or weeks ago. For example, you show a discount after someone views three product pages this session.
  • You target behavior that isn't in a cohort yet, including anonymous users who aren't synced to a cohort but show intent during the current session.
  • You run experiments tied to high-intent moments: cart abandonment, repeat page views, scroll depth, where the targeting condition and the experiment need to resolve in the same session.
  • You need eligibility to update the instant the user crosses the threshold, without waiting on cohort refreshes or remote membership checks.

Use cohorts instead when:

  • You target stable attributes or longer historical patterns, such as users who purchased three or more times in the last 90 days or users in a curated churn-risk cohort.
  • You target behavior from before the experiment started. Real-time behavioral targeting only persists events after you turn on the experiment.
  • You need complex server-side queries across historical data beyond a few weeks.

User properties (remote)

You can perform advanced targeting based on Amplitude ID resolution, IP geolocation, property canonicalization, behavioral cohorts, and historical user properties. Targeting user properties may increase page display latency because Amplitude needs to make network requests.

Page display delay

When active web experiments target a page, Amplitude injects an anti-flicker overlay if at least one experiment targets the page and has "Anti-flicker" on. The overlay is a blank element that covers your page while it loads. Amplitude removes the overlay after it evaluates the remote properties, or after a 1-second timeout.

Bucketing

Bucketing refers to the variant a user sees, based on the rollout and distribution. Rollout is the percentage of users in the experiment. Distribution defines which variant a user experiences if the user is in the rollout. Web Experiment distributes variants evenly by default. Amplitude recommends this distribution.

Bucketing stays consistent when the user has the same ID. Because most experiments bucket by Device ID, Web Experiment may place users in a different bucket if they visit on a new device, browser, or use private browsing.

Increasing rollout doesn't re-bucket users who're already in the rollout. For example, if your experiment has rolled out to 10% of users, and you increase the rollout to 50%, the original 10% of users don't change variants. If you change the distribution from evenly distributed to 20% -> control, 80% -> treatment, users who started in the control jump to the treatment.

Was this helpful?