Skip to main content
menu_icon.png

Everything you need to switch from Optimizely Classic to X in one place: See the Optimizely X Web Transition Guide.

x
Optimizely Knowledge Base

Set up events in Optimizely X Web

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

THIS ARTICLE WILL HELP YOU:
  • Track visitor behaviors on your site, such as clicks, pageviews, and custom events
  • Create events so you can measure the impact of your experiments and campaigns

In Optimizely, events help you measure success in an experiment. You can think of events as the “verbs” of Optimizely X. They track the actions that people take on your site, such as clicks, pageviews, form submissions, and purchases.

With events, you can track three kinds of visitor behavior:

  • Click events capture visitor clicks on elements like buttons or offers

  • Pageview events capture visitor pageviews and are tracked automatically for each page that you set up

  • Custom events capture additional information about other kinds of visitor behaviors

This article walks you through how to set up each kind of event.

Events always live on pages. If you haven't set up a page yet, you'll need to do that first.

Here's a short video on setting up events. Scroll down further for step-by-step instructions.

 

 

Set up a click event

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. Here's how to set up a click event:

  1. Navigate to Implementation > Pages and select the page where you want to add the event. You can also create a new page instead.

  2. In the left panel, in the Events section, select Create and then Click.

  3. Click the element to which you want to attach a click event.
    In the Selector field, the Editor automatically populates the selector for the element you chose. You can type or paste the element’s selector into the Selector field if you prefer.

  4. In the Name field, enter a name for your event.

  5. Click Save.

Track multiple selectors

You can track multiple CSS selectors in a click event by comma-separating them (just like in Optimizely Classic), but there is currently no multi-select capability in Optimizely X Web.

Set up a click event on a new element

Sometimes, when you create a variation, you'll use the Editor to insert a new element that doesn't exist in the original. Here's how to set up an event to track clicks to the new element.

In this example variation, the Wishlist option has been added to the navigation bar.

To track clicks for an element that is created in a variation:

  1. Click Create.

  2. Click Element Change.

  3. Select the element and scroll down to Track Clicks.

  4. Check the box under Enable Event Tracking. 

  5. Add a click goal name.

  6. Click Save.

Set up a pageview event

Pageview events are added automatically for each page you create, so you don’t have to do anything to set them up. To view your pageview events, navigate to Implementation Events.

Set up a custom event

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—any event that isn’t a click or pageview.

Here's how to set up a custom event:

  1. Navigate to Implementation > Events.

  2. Click Create New Event.

  3. Select Custom.

  4. Under New Custom Event, enter a name for the event and an API name. Based on your entry in the API Name field, the code in the API Call field will populate theeventName.

  5. Add the API call to your site.
    For more information about implementing the API call, see our developer documentation.

  6. Click Save Event.

Related articles

Learn the strategy for choosing effective events for your experiment.

Learn to build: