Skip to main content

Hey, Optimizely X users! Don't waste time looking for resources about Optimizely X Web Experimentation. We've got them for you here

Optimizely Knowledge Base

Events: Track visitor behaviors

This article is about Optimizely X. If you're using Optimizely Classic, check out this article instead.
  • Optimizely X Web Experimentation
  • Optimizely X Web Personalization
  • Optimizely X Web Recommendations

  • Track visitor behaviors on your site, such as clicks, pageviews, and custom events
  • Measure the impact of your experiments and campaigns

Events are the "verbs" of campaigns and experiments in Optimizely. You'll use them track actions that a visitor takes, like clicks, pageviews, form submissions, and revenue. They're reusable, so you can add them quickly to any campaigns or experiments that you're building.

Once you add an event to a campaign to track visitor behaviors, it's called a metric.

There are three kinds of events you can track:

  • Click events capture visitor clicks on elements like buttons or offers. You create them on a page, and they inherit the URL targeting from that page.

  • Pageview events are tracked automatically for each page that you set up.

  • Custom events capture additional information using custom code. You can use them to track behaviors like watching a video, submitting a form, or other actions that aren’t always reflected in clicks.

Use events in Experimentation to measure differences in visitor behavior, based on changes you make to a variation. Use events in Personalization to behaviorally target campaigns and deliver personalized experiences.

Events are always-on. This means that they constantly gather information on the behaviors that you identified, regardless of whether you’ve created or connected any campaigns to those events. This allows you to:

  • Create audiences based on behavior. You can target visitors who triggered a certain event over some time period (“People who searched 2+ times in the last 30 days”), or get more specific with tags.

  • Measure the impact of your campaigns on the Results page.

Set up a click event

Here's a video walkthrough of how to set up a new click event. Read on to see it step by step.



  1. To select the page where you'll add events, navigate to Implementation > Pages.

    Or, create a new page.

  2. In the Events section, click Create. Then, select Click.

  3. Click the element to which you'd like to attach a click event. In the Selector field, the Editor will automatically populate the selector for the element you chose. Or, paste in your own selector.

    In the Name field, name your button.

  4. Click Save.

Set up a pageview event

Pageview events are added automatically for each page you create; no action is required from you. To view your pageview events, navigate to Implementation Events.

Set up a custom event

To capture an event other than a click or pageview (for example, viewing a video or browsing image 6 in photo carousel), you'll need to set up a custom event.

  1. Navigate to Implementation > Events.

    Select New Custom Event.

  2. Categorize your new custom event. This will populate the API Call with the proper eventName, which you'll add to your site.

  3. Add the generated API call to your site. For more information on how you or your developer would implement this, see our developer documentation.

View and manage events

To view all your events, navigate to Implementation > Events

You'll see click and pageview events organized according to the page they're attached to, as well as custom events.

To delete or archive events, click the Actions () icon.

Related articles

Continue setting up Optimizely X by adding reusable events, tags, and audiences.

Learn to build:

Learn the strategy of choosing effective events for your experiment.