Latest posts by Alex Centeno (see all)
- Save 15 Minutes or More on WordPress with the Command Line - May 2, 2018
- Securing Your WordPress Login Page: You Can Never Be Too Safe - August 13, 2016
- DNS Records: Find me if you can! - July 3, 2016
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. You have the ability to set goals that clearly identify measurements for key performance indicators (KPI). So now let’s discuss how to track events.
According to the developer’s guide, Event Tracking in Google Analytics lets you track user interactions with content. The content is tracked 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…
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:
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.
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 should be reflected in a request sent to http://google-analytics.com/collect . 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!