Skip to main content


Optimizely Knowledge Base

Events: Tracking clicks, pageviews, and other visitor actions

  • Use click, custom, and pageview events to track visitor behaviors on your site.
  • Measure the impact of your experiments and campaigns.

Events are the "verbs" of Optimizely campaigns and experiments. They're how you track actions that a visitor takes, such as clicks, pageviews, form submissions, and purchases.

Events always live on pages, which are URL templates in Optimizely that you use to identify parts of your site where you'll experiment. For example, you might set up a click event that tracks clicks to a Contact Sales button on your homepage. Or, you might set up a custom event to track revenue through your checkout flow (note that if you're using Optimizely X to test on a checkout page, you might need to configure your site for PCI compliance).

Events are reusable, so you can quickly add them to any campaign or experiment that you build.

You can build three types of events in Optimizely X Web:

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

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

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

Like pages, events are restricted to individual projects. This means that you'll set up, track, and manage events in a single project (unless your Optimizely X plan includes cross-project events).

After you add an event to a campaign or experiment, it's called a metric. Metrics are displayed on your Results page and help you measure differences in visitor behavior, based on changes you make to your site in a variation in an experiment or personalized experience.

Events are always on. An event will begin tracking data when it's set up. If it's added as a metric to a running experiment, the data for the event will be added retroactively: from the date the event was created or the date the experiment was published, whichever is more recent.

Learn more about how to:

An important part of good experiment design is choosing the right events to track. This article discusses how to balance “macro” conversions like revenue with “micro” conversions to design an effective experiment.

Tracking an event across origins

Sometimes, you may wish to track events across different origins. For example, you might want to have metrics that measure actions on and These are different origins, so you'll need set up cross-origin targeting in your snippet. Otherwise, you won't see any data for cross-origin metrics on your Results page.

Events in Personalization

Use events in Personalization to behaviorally target campaigns and deliver personalized experiences.

Events are always on. They constantly gather information on the behaviors that you identified, even if you haven’t created a campaign or connected events with an existing campaign. This is useful when you use Optimizely X Web Personalization.

If you're using Personalization, always-on events help you create audiences based on behavior. For example, you can target visitors who triggered a certain event over a certain time period, such as “People who searched 2+ times in the last 30 days.” You can also target more specific behaviors with tags.