Based on our last post, “How to begin with Google Analytics”, you now have the power to install Google Analytics and track your users’ interactions with your website. Our next tutorial is all about how to set up tracking events in Google Analytics.
What are Events?
According to the developer’s guide, Event Tracking in Google Analytics lets you track user interactions with content. The content tracks independently from a web page or a screen load. Types of user interactions include:
- Mobile Ad Clicks
- Flash elements
- AJAX embedded elements
- Video Plays
- and much more
So how do we track our custom events? Here we go…
Implementing Event Tracking in Google Analytics
Let’s start with an example: We have a PDF presentation that can be downloaded from our Sales page. What we want to know is the number of times the presentation is downloaded in order to determine if we can improve those numbers.
So, when people click on the link to download the presentation, we want to send a custom request to the Google Analytics platform, informing it that the event has taken place.
Every event that we track will include the following user-defined components:
A category is the name of a group of objects that you track. So for our example we will call our category “PDFs”.
Action is the result of the interaction that our user had with our particular object. For our example we will call our action: “Downloaded”.
Label is a string that identifies the particular event. For our example we will set the label to: “Sales Presentation PDF 2016”.
Finally, value is an integer value that you can store alongside your object. It can show the number of seconds a video was played or assign a dollar value to a downloaded file. For our example, let’s say that our sales team knows that a person who downloads the sales PDF spends $20 more from our company. Thus, we assign a $20 value to the download of the PDF.
Our markup on our website looks like a simple link with an ID of “my-download”:
<a id="my_download" href="sales-presentation-2016.pdf">Download our Sales Presentation Now!</a>
For this example, I will use JQuery to track the download event in the following way:
Tracking Social Interactions
You can track social interactions in this same way. Instead of tracking a download, let’s say that we want to track the number of times our users click on the Facebook “Like” button.
To do so simply add the following tracking code to your page:
As you can see in both examples, the first parameter in our GA function is called “send”. This “send” refers to the name of the method that is being called.
Ensure the Tracking Events in Google Analytics is Installed Correctly
So how do we know if our hits are processed properly and are correctly tracked in our website? We can use Chrome Browser’s Developer Tools in the Tab: Network. (see image below).
When you click on the event that you are tracking, it will reflect in a request sent to Collect Google Analytics . From that tab you can determine if the parameters you set are correct.
That’s it! So now you know how to setup your Google Analytics account. You know how to add the tracking code to each page of your website. You know how to set up valuable goals. And you have the capacity to track custom and social events.
Is this something that interests you as a marketer? AndiSites would love to hear from you. Contact us today!
You might also like to read all our blog posts about Google Tools.