Skip to main content

Getting started with event tracking

Modified on: Mon, 12 Oct, 2026 at 7:04 PM

Summary

Learn how to set up event tracking in Siteimprove to measure visitor interactions, such as clicks, video plays and form submissions, that page view tracking doesn't capture.

Prerequisites

The Siteimprove Analytics script is installed on your website. 

Learn how to add the Siteimprove Analytics script to your website.

What are events and why should I track them?

What are events?

Whenever someone views a page on your website, the Siteimprove tracking script counts a page view, because it registers that the page has loaded in their browser.

Interactions that don't load a new page are not tracked by default. These include:

  • Clicks on play, pause or stop in embedded audio or video.
  • Clicks that open a lightbox or pop-up, including image galleries.
  • Clicks that reveal or hide content on the page.
  • Clicks that submit forms without loading a new page.

Event tracking lets you record these interactions.

Why track events?

Tracking events shows you whether visitors interact with your website the way you expect them to. Once event tracking is set up, you can:

  • Measure how often specific events occur.
  • See which pages on your website generate the most events.
  • Include events in your key metrics and funnel analysis.
  • Filter your analytics data by visitors who performed specific events.
Tracking events doesn't change the number of page views for a page.

Setting up event tracking

There are three ways to set up event tracking:

  • Add events in the tracking tool (no code required).
  • Quick-add events (no code required).
  • Install the event tracking code (requires access to your website's code).

All users can view event tracking configurations. Only administrators and account owners can add, edit or delete them.
Option 1: Adding events in the tracking tool (no code)

Before you start: The tracking tool loads your page through Siteimprove's servers. If your website uses a firewall, CDN or bot protection that blocks unknown traffic, ask your IT team to allow the IP addresses listed under Siteimprove Analytics IP addresses in What IP addresses and user agents are used by Siteimprove? We recommend adding them as their own group, separate from other Siteimprove IP addresses. That way, rules or rate limits you set for other Siteimprove services won't block the tool.

Instructions:

  1. Go to the Events section in Marketing Analytics.
  2. Click Edit event configurations.
  3. Click Edit events in on-page tool.
  4. Select the site you want to track events on.
  5. Find the page you want to work on by searching for its title or URL.
  6. Interact with the page, for example by opening dropdowns or accordions, until the element you want to track is visible. You can also switch devices to see your page at different screen sizes.
  7. Click Add event.
  8. Click the element you want to track.
  9. The CSS selector field fills in automatically, and every element on the page that matches it is highlighted. If you edit the selector, the highlighting updates as you type, so you can check that it covers exactly the elements you want.
  10. Enter a category, an action, and preferably a label for the event. See Defining category, action, and label below.
  11. Choose where to track the event:

    This page
    Tracks the element only on the URL you're viewing now.

    Multiple pages
    Tracks the element on every page whose URL contains the text you enter. For example, entering /products/ tracks it on all pages under that path.

  12. Click Save.

Option 2: Quick-adding events (no code required)

  1. Go to the Events section in Marketing Analytics.
  2. Click Edit event configurations.
  3. Click Quick-add events.
  4. Enter the CSS selector of the element you want to track. You can find an element's CSS selector by inspecting your website's code.
  5. Enter a category, an action, and preferably a label for the event.
  6. Choose a match type and enter a URL.

    is exactly
    Tracks the element only on that exact URL.

    contains
    Tracks the element on every page whose URL contains the text you enter.

  7. Click Save.

How URL matching works

These rules apply to both options above:

  • Matching uses the full URL. That includes https://, www., any query string (?…) and any anchor (#…).
  • "This page" and "is exactly" need a character-for-character match. A different query string, an added trailing slash or a missing www. all count as a different URL.
  • "Multiple pages" and "contains" handle those differences. Use them whenever the same page can be reached through slightly different URLs.
  • The text you enter is matched literally. Characters such as * or ? have no special meaning.
  • Uppercase and lowercase letters are treated the same.

Option 3: Installing the event tracking code (requires access to your website's code)

Step 1: Prepare the event queue

Add this line once per page, anywhere before your event code. It lets your code send events even if the Siteimprove Analytics script hasn't finished loading yet.

<script>window._sz = window._sz || [];</script>

Step 2: Send events

Each event is sent like this:

_sz.push(['event', 'CATEGORY', 'ACTION', 'LABEL']);

Replace CATEGORY, ACTION and LABEL with your own values. Category and action are required. If either one is missing, the event isn't sent. The label is optional, but we recommend it because it tells you which element was used.

Example: track clicks on all download buttons

This example finds every element with the class download-button and records a click event for each one. It's a good choice when you want to track several similar elements without editing each one.

<script type="text/javascript">
 _sz = _sz || [];
 document.querySelectorAll('.download-button').forEach(function (button) {
 button.addEventListener('click', function () {
 _sz.push([
 'event',
 'Downloads', // category
 'Click', // action
 button.textContent.trim() // label: the button's text
 ]);
 });
 });
 </script> 

Alternative: add tracking directly to one element

For a single element, you can put the tracking straight in its HTML. You still need the line from Step 1 on the page.

Original link:

<a href="https://example.com#fulltext"&gt;Read the full text about enrolling</a>

With tracking:

<a href="https://example.com#fulltext"
 onclick="_sz.push(['event', 'Content', 'Show more', 'Enrolling']);">
 Read the full text about enrolling
 </a> 

Here the category is "Content", the action is "Show more" and the label is "Enrolling".

Note: If the tracked element is a link that opens a new page in the same tab, the browser may leave the page before the event is sent. Clicks on those links may be under-counted.

Tracking YouTube videos

To track YouTube videos:

1.    The video must be embedded on the page. Videos that open in a pop-up window can't be tracked.

2.    The embed link must include the enablejsapi=1 parameter. For example:

<iframe src="https://www.youtube.com/embed/XXX?enablejsapi=1"&gt;</iframe>

What can be tracked depends on YouTube's API. For detailed video analytics, use YouTube Studio.

Defining category, action, and label

Every event needs a category and an action. We recommend also adding a label, which identifies the specific element the visitor interacted with. Together, these three values group and identify interactions so you can find them in your analysis.

Category

The category usually describes the type of element the visitor interacted with, such as video, audio, image, form or content. It groups the different types of events you track.

Action

The action describes what the visitor did, such as play, pause, open or submit. Decide whether to reuse general actions across several categories or to define specific actions for each category.

For example, the User Feedback tab on the Siteimprove website has two tracked actions: opening the tab and sending feedback. Both events use the category "Feedback", each with its own action.

Label

The label tells apart events that share a category and action, and it makes your data easier to read. It can be a video title, a section heading or anything else that identifies which element the visitor used.

For example, to track clicks on tabs on a front page, all tabs can use the category "Content" and the action "Tab". The labels "Apply", "Pay" and "Report" then show which tab was clicked.

Tracking limitations

You're welcome to set up custom event tracking on your website, but Siteimprove Support can't provide help with custom tracking code you've added yourself.

Advanced event tracking

No-code event tracking can track clicks on elements on your page. For more advanced tracking, fill out the event tracking spreadsheet and send it to support@siteimprove.com.

Note: Event configurations created by Support or added through the event tracking code don't appear in the Event configurations view.

Iframes

Content inside an iframe can only be tracked if the Siteimprove Analytics script is also loaded on the page inside the iframe. This usually isn't possible for third-party content.

HTML5 videos in iframes

HTML5 videos inside iframes can't be tracked.

Vimeo videos

Interactions with embedded Vimeo videos can't be tracked.

Government and public sector sites with digital ID and MFA

Some websites require multi-factor authentication with a national digital ID, such as MitID (Denmark) or DigiD (Netherlands). These systems give access only to a single person's own profile, for example tax records, healthcare data or citizen portals.

Setting up and testing advanced event tracking requires access to several user profiles. Because these authentication methods are tied to an individual's identity, Siteimprove can't bypass them or simulate access to other users' profiles. We therefore can't take on event tracking requests for pages behind digital ID-based MFA.

Event tracking analysis

Once your events are set up, you can follow them in the Event Tracking section in Analytics.

The section has four sub-sections: Category, Action, Label and Pages.

  

Additional resources

Event Tracking: Naming convention best practices

How to complete the Event Tracking spreadsheet

What IP addresses and user agents are used by Siteimprove?

Downloadable forms

xlsx

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.