Digital Analytics Event Tracking

by Scott Fillman


Posted on Jun 05, 2020


Beyond Pageviews

By default, most digital analytics tools track pageviews and visits. While these are great indicators of how well your website or marketing campaigns are performing, events capture what happens between pageviews and during visits.

Tracking User Behavior

It's great to know if someone navigated to a page and which pages on your site have high traffic volume. It is even better to know if visitors clicked the main call-to-action or subscribed to your newsletter while visiting one of your pages.

Benefits

Pageview metrics tell you which pages on your website or screens within your mobile app were visited. Events tell you what happened on visited pages or screens. This is what makes event tracking so valuable.

Ideal Uses

Events are useful because they are flexible and do not have to be sent to your web analytics platform at the same time as pageviews. Pageviews are usually only sent to your web analytics platform when each page on your website loads. Events can be sent between page loads or page refreshes.

Events Track Interactive Elements

Dynamic features that live on pages often function without new pageviews occuring (in between page loads or refreshes), so pageview-based tracking does not capture users’ interactions with those features. Event tracking is best utilized to gather insight into user behaviour for a few specific purposes:

  • Campaign performance
  • Feature use
  • User experience insight
  • Content effectiveness
Campaign Performance

Launching campaigns to drive traffic to your website can increase traffic and generate revenue. Event tracking allows you to not only track which pages were visited by visitors that arrived from a specific campaign, but also track whether those visitors also clicked on your primary call-to-action or signed up for your website.

Feature Use

If you add a new feature to your website, such as a tool that allows a visitor to get a quote for a product or service that your company provides, you may want to know how many users utilize it. You can use event tracking to track when visitors add information to the quoting feature and also when a quote is successfully generated.

User Experience Insight

When you make changes to your website, such as changing your website’s sign up process, you can use events to measure which steps of the sign process are completed and which form fields users filled out. If you find that a large number of people are dropping out of the sign up process when they reach a specific step of form field, you can use that insight to make improvements to ensure more people complete the sign up process.

Content Effectiveness

When a visitor lands on a page, you don’t always know if they are engaging with the page’s content. You can use a “Read More” button to reveal additional page content to know that a visitor expressed interest in a specific piece of content.

Take a Strategic Approach

Events can be applied to virtually any interactive element, widget, form, button, or feature on your website. That doesn’t mean that they should be applied to every element on your site. Ideally, you should identify and prioritize the elements and features on your site that contribute to the overall purpose of your website and drive business value or value to the mission of your organization.

Track Actions that Matter

You should ensure that the events you track provide actionable data. Actionable data provides insight that guides user experience improvements, campaign optimization, and conversion rate optimization. Tracking interactions that don’t contribute to conversions creates clutter and noise in your event reports.

Getting Started

Organize Your Event Strategy

Before adding event tracking to your site, consider the purpose your website serves, the user journey, and the main activities you would like users to engage in while visiting. Group the most important activities as they relate to the purpose of your website. This group creates a set of activities that are ideal candidates for event tracking.

Consider Your Website’s Features

Also, consider the features that you have invested resources in or plan to enhance in the future. Prioritize your feature list and consider adding event tracking to gather insight into feature utilization. Focus on high value features and activities first. It is better to track a finite number of meaningful events than to dilute opportunities for insight by tracking countless events with questionable value and oversaturating your reports.

Identify the Most Valuable Visitor Actions

Keeping in mind the purpose of your site and the website’s most valuable features, focus on the most important two or three things that you want users to do while visiting. Do you want them to make a purchase, sign up for a trial account, or request a quote? Or is your site a content site and its primary purpose is to provide valuable knowledge or support documentation to visitors? These activities become the highest priority events to track, and your primary conversions.

List Other Valuable Visitor Actions

Next, return to consider the other valuable actions you would like visitors to take while visiting your site. Some examples are signing up for a newsletter, submitting a contact form, clicking a phone number, or clicking a call-to-action button. These may not be primary conversions, but they demonstrate engagement beyond passively browsing website content. These activities can become events that track your secondary conversions.

Make a Plan

Gather your primary and secondary conversions and apply them to the user journey. Doing so creates a strategic roadmap for adding event tracking to your website.

Example: Considering Your Website’s Purpose and Making a Plan

Let’s say, for example, that we ran a website that allows users to reserve rental boats and off-road vehicles at a local campground or park reserve (motor boats, pontoons, all-terrain vehicles, paddle boards, kayaks, etc.).

We want to track visits and pageviews to measure our audience, but we also want to use event tracking to track interactions on our pages to make sure we understand how well our page layouts, content, and reservation features are performing. We would likely decide that the purpose of the website is to drive users to make a reservation. Knowing this, we can begin to form a measurement plan that will be used for our event tracking strategy.

Example: Create a Plan

Creating a measurement plan to guide your event tracking strategy can be beneficial and can even be as simple as putting together a single page document or a simple list.

Considering the example of our boat and off-road vehicle reservation website, we would break the user journey into three stages:

  1. Awareness / Research
    • Visitors are made aware of our website and learning about the online reservation service our business offers
    • We want to know how many visitors we have, how they got to our website, and which calls-to-action are driving visitors to explore further
  2. Rental Consideration
    • Visitors are exploring the types of vehicles they can reserve online
    • We want to know how many visitors are viewing our rental vehicles and which vehicles users are viewing most often, as well as how many visitors are clicking to enter the reservation process
  3. Booking / Retention
    • Visitors are going through the reservation process, providing information to reserve a rental vehicle by filling out and submitting online forms
    • We want to know how many people started the booking process, each step they complete, and whether or not they successfully submit a reservation, as well as the vehicle they reserved and the dates / duration of the vehicle rental

Identifying the stages of user journey and the most important user actions at each stage identifies the opportunities for adding event tracking to the website.

Events vs Goals

Before moving forward, it is essential to differentiate between events and goals. Goals represent the most important actions a user can take on your site and align to your website’s business objectives. Goals are likely to be the primary conversions discussed earlier. You can create goals from events, elevating them to specific reports and allowing conversion rates to be calculated automatically within your web analytics platform. Not every event should be a goal. Not every goal has to be an event (goals can be created from pageviews as well). Keep your goals succinct to ensure your overall conversion rate represents only valuable conversions.

Event Dimensions
Structure

Events generally contain four pieces of information. These four components are sent to your web analytics platform from your website and they show up in your reports as built-in dimensions (Category, Action, Name) and metrics (Value). Here are the four pieces of information that make up an event:

  • Category
  • Action
  • Name / Label (optional, recommended)
  • Value (optional, recommended)

Each piece of information holds a value that you define and send to the event reports in your web analytics platform. These pieces of information become dimensions that you can use to analyze data within your web analytics reports.

Category: The category event dimension is the top-level means of grouping your events.

Action: The action event dimension describes the activity or interaction of the event.

Name / Label: The name event dimension provides additional details about the event.

Value: The event value is a metric that is sent as an integer, allowing events to be measured quantitatively.

Let's explore an example approach that can be taken for event tracking.

Categories: By Event Subject

In some cases, analysts seek to group events based on the subject of the event.

For example:

Actions: By Past-Tense Verb

In other cases, analysts seek to group events by the types of activities and use a verb or action word to describe what happened.

For example:

Event Names / Labels

Event names provide an additional descriptor for an event. For example, the name could include the text or name of a call-to-action button or describe a form that was submitted.

Some examples of the way event names are used:

Putting it all together, you may have events that may look something like this in your event reporting:

The example approach outlined above may not work for all cases and the framework you develop for organizing your event dimensions should be based on your business, website structure, and purpose for your event analysis.

Event Tracking is Flexible

Putting some thought and planning into how you use event tracking allows for event metrics to be grouped and rolled-up, as well as broken down and analyzed at the level needed to gain insight into user behaviour and feature usage. Web analytics platforms provide flexibility in assigning events to categories, so there is not necessarily a single approach that works in all cases.

Tracking Events

Best Practices When Tracking Events

There are some general guidelines that should be followed to ensure you gain the maximum benefit from event tracking.

  • Limit the number of categories - there is no recommended hard limit, but having more than 15-20 categories can make rolling-up and aggregating metrics at the category-level difficult and can make gathering insight challenging due to oversaturation.
  • Limit the number of actions - similar to categories, there is no recommended hard limit, but having more than 20-25 actions can make rolling-up and aggregating metrics at the action-level difficult and can make gathering insight challenging due to oversaturation.
  • Leverage event names - using category and action dimensions to group and describe the action taken, use event names to provide additional context or supplemental information about the event.
  • Compliment with custom dimensions - keeping event dimensions simple and concise, you can use custom dimensions to send additional information about the event (which section of the page the event happened on, the type of element interacted with, etc.).
  • Plan ahead - especially with tag management systems, it can be tempting to add event tracking everywhere, diluting the meaningfulness of events. Take time to ensure meaningful interactions and valuable content are being tracked with events so that you can maintain focus on the most important aspects of your website and the user journey.

Using Web Analytics JavaScript Trackers

Javascript Event Tracking

To track an event using Matomo’s tracking library, use the built-in Javascript trackEvent function:

trackEvent('category', 'action', 'name', 'value');

Executing this function within your website will send an event to be processed and logged within Matomo. When all four event values are sent via the trackEvent function, reports in Matomo will include an event category, an event action, and an event name and event value.

The trackEvent function is often executed via a push to _paq array, including the event components described above.

_paq.push(['trackEvent','category', 'action', 'name', 'value']);

For more information, see Matomo's event tracking guide.

Sending an event to Google Analytics is similar:

gtag('event', 'action', {'event_category': 'category','event_label': 'label','value':'value'});

Executing this function with the properly applied event data will send the event to be processed and logged within your Google Analytics reporting suite.

More information is available within Google's event tracking developer guide.

Example: Event Tracking

Newsletter Sign Up

As an example, let’s say that a new newsletter sign up form has been added to our off-road vehicle rental website:

The form is within a pop-up modal window that appears when users click on the “Newsletter” button. When a user signs up and the form is submitted, a thank you message appears briefly on the screen.

Event 1: “Newsletter” Call-to-Action Button Clicks

When considering the implementation of event tracking for our newsletter sign up form, we add an event to the modal with the sign up form when it is opened via the clicked “Newsletter” call-to-action button that is in the page header:

Event Category: CTAs

Event Action: Clicked

Event Name: Opened Newsletter Pop-Up

Event Value: 1

Matomo JavaScript Tracking:

_paq.push(['trackEvent', 'CTAs', 'Clicked', 'Opened Newsletter Pop-Up', 1]);

Google Analytics JavaScript Tracking:

gtag('event', 'Clicked', {'event_category': 'CTAs','event_label': 'Opened Newsletter Pop-Up','value':1});

This event shows us how many users expressed interest in signing up for our newsletter by clicking to open the newsletter sign up pop-up window.

Event 2: Newsletter Sign Up Form Submissions

Next, we add another event to track the successful submission of the form:

Event Category: Forms

Event Action: Submitted

Event Name: Newsletter Sign Up

Event Value: 1

Matomo JavaScript Tracking:

_paq.push(['trackEvent', 'Forms', 'Submitted', 'Newsletter Sign Up', 1]);

Google Analytics JavaScript Tracking:

gtag('event', 'Submitted', {'event_category': 'Forms','event_label': 'Newsletter Sign Up','value':1});

This event allows us to know how many visitors submitted the newsletter sign up form and joined our mailing list.

Putting These Events Together

Adding these events gives us insight into how many times users click the call-to-action to open and view the newsletter sign up form, as well as how many users complete the form. We can calculate how many of our website visitors that opened and viewed the newsletter sign up form followed through and successfully joined our mailing list. We can now understand if visitors are seeing the newsletter sign up call-to-action, clicking it, and completing sign up for our newsletter, and gather insight for button placement, form content, and validation for our newsletter to adjust our website to grow our mailing list.

Additional Event Tracking to Consider

We could also decide to send an event when form submission or validation is unsuccessful to better understand why the form is not being completed once opened and viewed. Such a scenario allows analysis to be conducted to inform how to change the form to increase the number of submissions or to identify any errors that could be preventing the form from functioning properly.

Using a Tag Manager

Event tracking can also be implemented via Matomo Tag Manager or Google Tag Manager. Tag managers support built-in event triggers for clicks, form submissions, and pageview-based events. A data layer can also be added to your website to provide supplemental data for events. Sending event data to a dataLayer often looks like this:

Matomo Tag Manager Data Layer:

_mtm.push('event':'click','category':'CTAs','action':'Clicked','label':'Sign Up','value':1);

Google Tag Manager Data Layer:

dataLayer.push('event':'click','category':'CTAs','action':'Clicked','label':'Sign Up','value':1);

As you can see, it looks similar to the event tracking snippets already outlined, however since it is going to a data layer (which is a JavaScript array of data objects that loads on your website), multiple tags in your tag manager can use this event data. In the prior examples, the data was only going specifically to Google's and Matomo's reporting suites and cannot be used by the other tags loaded in your tag manager. Also keep in mind that you can model the data layer objects that you send to your tag manager in any way that you see fit, so the examples above may or may not reflect your actual code.

You can learn more about Google Tag Manager and Matomo Tag Manager within their respective user guides.

Summing It Up

As already outlined, events are very useful to gain deeper insight into user behavior on your website or mobile application and there are a number of ways to track events both in terms of implementation and strategy. It is easy to start tracking everything and lose sight of the key interactions that demonstrate engagement and adoption, especially as your reports become oversaturated with trivial data. Planning your event tracking strategy should take nearly as much or more time than implementation to ensure your approach is sound and your reports provide valuable insights.