Editor’s Note: This article was originally published by Web Marketing Today. Practical Ecommerce acquired Web Marketing Today in 2012. In 2016, we merged the two sites, leaving Practical Ecommerce as the successor.
Event tracking is one of Google Analytics most underutilized tools. From monitoring PDF downloads to video views, Event tracking counts the number of times a specific action takes place on a website, where that action might not create a unique page view.
In a typical Google Analytics installation, a “page view” is generated whenever a visitor displays a specific, unique URL in his browser. As an example, a visitor that goes to “http://yourwebsite.com/home” and “http://yourwebsite.com/hours-of-operation” has generated two page views, since he visited two unique URLs.
However, many user interactions take place on the same page. Perhaps users click on a map to your location, which opens up a new window to Google Maps, or they watch a video about your business, or they download a coupon to use in your store or restaurant.
Google Analytics gives us the ability to track these interactions in several ways. One of them is via Events, which this article will address.
What Is a Google Analytics Event?
An “Event” in Google Analytics is a user action — a mouse click — that causes something to occur on a web page that does not necessarily cause a user to go to a new page.
For example, a restaurant site may contain a PDF menu. If someone clicks on “View our Menu,” for example, the PDF file is either downloaded or it opens up as a PDF file in a browser window.
In a standard web environment, neither of these two actions causes the Google Analytics JavaScript code to execute, which means the data is not captured.
Google Analytics Events allows us to track these actions, and also to understand what keywords and traffic sources are causing visitors to do them. Events have two major components, for tracking purposes: Category and Action.
For this tutorial, assume we are creating Categories and Actions for the Cibon restaurant website, pictured below. Our Category could be “Menu Views,” and our Action could either be “Dine-In Menu” or “Take-Out menu.”
Setting up a Google Analytics Event to track Restaurant Menu Views
Utilizing Events requires making a simple modification to the links to our menu PDFs. Currently, the code appears as follows:
A simple explanation of the above code is that the link is pointing to a file called “cibon-dine-in.pdf,” and clicking it would cause the PDF to open in a new window, or prompt the user to download and save it.
But this code provides Google Analytics no way to know how many times visitors clicked on the PDF. All Google Analytics knows is that a visitor was on http://www.cafecibon.com/menu.php, a unique URL. The visitor hasn’t necessarily seen your menu.
Knowing how many visitors have downloaded the “Take Out Menu,” versus “Dine In” menus could be helpful. To understand this, make the following link modifications.
<a href="menu/cibon-dine-in.pdf" onClick="_gaq.push(['_trackEvent', 'Menu_Views', 'Dine_In']);"> target="_blank">
and
<a href="menu/cibon-take-out.pdf" onClick="_gaq.push(['_trackEvent', 'Menu_Views', 'Take_Out']);"> target="_blank">
Now each time a visitor clicks to open either of the menus, an Event is recorded. In Google Analytics, the restaurant will know the following.
- Keywords. What keywords did visitors use to find the website and download a menu?
- Traffic sources. Is your Facebook page causing visitors to download the “Dine In” menu?
- Popularity. Do visitors prefer to download “Dine In” or “Take Out”?
Looking at Events in Google Analytics
To reach the data you are now collecting, log into your Google Analytics account. Under Content in the left sidebar select Events.
Here, you will see an overview of how many times the Events you created occurred. Navigating through the options will give you several different views, and adding secondary dimensions through the interface can display keyword data, referral sources, and other pieces of information you can use to gauge the effectiveness of your website.
To determine how many visitors select “Take Out” versus “Dine In,” for example, the restaurant owner could navigate to Top Events, click on, say, “Menu_Views.” I’ve mocked up hypothetical results below.
Summary of Google Analytics Events
The uses of Events in Google Analytics are almost infinite. For the restaurant example, you could add a Category called “Image_Views” with Actions to track each download of an image from the main menu page. This can track both the effectiveness of your photography, as well as provide insights into which menu items are generating the most interest.
You could create a Category called Coupons, with an Action correlated to a “Print Now” link on the website.
Perhaps most importantly, Events can be tied to Goals, which gets your analytics into form, so you can use analytics to grow your business. In the end, after all, that is the purpose of your website.