Skip to main content
menu_icon.png

Everything you need to learn Optimizely X in one place: See our resource pages for Web Experimentation and Personalization.

x
Optimizely Knowledge Base

Set up an event 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.
  • Set up events so you can measure the impact of your experiments and campaigns.

In Optimizely, events help you measure success in an experiment. You'll use events to track actions that visitors take, like clicks, pageviews, form submissions, and purchases.

This article walks you through how to set up an 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

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

Set up a click event on a new element

Sometimes, when you create a variation you'll use the Editor to insert a new 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 custom event

To capture an event that isn’t a click or pageview, you’ll set up a custom event.

  1. Navigate to Implementation > Events.

  2. Click Create New Event.

  3. Select Custom.

  4. Under New Custom Event, select a category from the drop-down menu. In this example, we selected Added to Cart.
    Based on your selection, the API Call field will populate with the proper eventName.

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

  6. Click Save Event.

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.

 

Related articles

Learn the strategy for choosing effective events for your experiment.

Learn to build: