Google Analytics Event Tracking Guide
google analytics• 4 min read
Event tracking is a powerful Google Analytics feature that allows users to track website elements that would otherwise not be tracked with the basic Google Analytics code implementation. These types of web elements are found on almost every website that you visit daily and surprisingly, are rarely tracked by the websites owner. Here are a few examples of the web elements that I am talking about:
-Flash-driven events. (Example: Video players.)
-Ajax elements. (Example: Interactive elements that load without refreshing the whole page.)
-File downloads. (Example: PDF.)
These types of web elements are not automatically tracked with the basic Google Analytics tracking implementation and involve additional code implementation to be tracked correctly in Google Analytics.
Why are these site interactions not tracked? The basic Google Analytics implementation tracks data by pageview and unique account ID (UA-XXXXXX-X). Events such as clicking on a social media icon that sends a user to a different website, or downloading an MP3 that does not open a page, will not be tracked because these sites and files do not contain code with your unique account ID and necessary page tracking methods. This means that the data from these links will never be registered to your Google Analytics account.
Event Tracking Structure:
Event Tracking Code Snippet:
_trackEvent(category, action, label, value, noninteraction)
Example of the event tracking code snippet with a file download link:
<a href=”#” onClick=”_gaq.puch([‘_trackEvent’, ‘category’, ‘action’, ‘label’, ‘value’, ‘non-interaction’]);”>Web Element </a>
Customizable elements of the event tracking code:
category (required)- This is the name that you apply to the group of objects that you want to track. (Example: A good category name for a group of social media link events would be “Social Media” or “Social Media Links”
action (required) – A string that is paired with the category and is used to define the type of user interaction with the site element. (String examples: “Click”, “Download”, “Play”)
Label (optional) – A string that is used to provided additional information about the category and action. Think of it as a description of the site element. (Example: If you were tracking social media clicks, then you would want to use labels such as “Facebook” or “Twitter” depending on the name of the social media site link.)
Value (optional) – An integer that allows you to attach numerical data to each event.
Non-interaction (optional) - A boolean that effects the bounce-rate calculation of an event. If the Boolean is set to true, then the event hit will not be included in the bounce-rate calculation of that page.
Before you implement event tracking tags:
- Think of how you want to structure your data. This is an extremely important step in the event tracking process. Make sure that you have a clear data structure to ensure that the data will be processed and appear in your Google Analytics reports in an easy to understand format.
- Make sure that you are consistent with your naming conventions for each element (category, action, label). This will prevent future headaches when it comes to reporting your data.
Event Tracking Examples:
-It is very common to find sign up forms on websites. When a user fills out these forms and clicks submit, there are a variety of events that might happen. Some forms bring the user to a confirmation page after submitting the form, while many just show a pop up alert or a message on the same page as the form that confirms the successful submission. In any case, the basic Google Analytics implementation is not enough to accurately track how many forms have actually been submitted on your website. In these situations, event tracking is the simplest way to track this type of data in an organized manner.
Example of a form submission naming convention:
<a href=”#” onClick=”_gaq.push([‘_trackEvent’, ‘Forms’, ‘Click’, ‘Submission’]);”>
Note that I used only three of the five possible event tracking elements (category, action, label). You do not need to use all of the optional components (label, value, non-interaction).
Social Media Shares
Social media has quickly become an integral part of successful marketing strategies. The data from social media elements such as a social share, provide content feedback that is extremely valuable to a brand when validating if the websites content is relatable to the user or if it is completely off target. While this data can be tracked with various social media analytics platforms, the ideal approach for tracking this data would be use a platform that can easily connect social media data to the websites traffic data. Unfortunately, many social media analytics platforms lack this ability, which is why event tracking is the perfect solution to the problems that many social media analytics platforms face.
Example of a social media share naming convention:
<a href=”#” onClick=”_gaq.push([‘_trackEvent’, ‘Social Media’, ‘Share’, ‘Facebook’]);”>
Simple and Effective
Hopefully this article helped you understand that Google Analytics is a lot more powerful than providing reports on simple traffic data like visits, time on site and bounce rate. Event tracking is simple, effective and just one of the many customizable features of the Google Analytics platform. I highly suggest that you take a look at the event tracking documentation provided by Google to learn more about the tracking implementation, as well as to explore some of the other features that the Google Analytics platform has to offer.
Google Event Tracking Documentation: