Let’s Ask Google: How do I track events in Google Analytics?

Sergiy

askgoogleanalytics

Google Analytics has become a big part of my day here at the office. For those who don’t know, Google Analytics (I’ll call it “GA” for simplicity from now on) is a platform that is used to track your website’s statistics (big picture, read about it in depth here).

Google Analytics Image

Who uses Google Analytics and why?

Agencies, such as Spark, use GA, in addition to those tech savvy people who use it on their own, as more and more people are interested in their own conversions. Ecommerce websites need it to be able to calculate revenue and gather important information from the vast variety of reports GA provides. Considering platforms similar to GA, I found it to be the most customizable and easy to use (to a very certain extent).

Reporting Window in Google Analytics

Above is the reporting window in GA. This is where everything gets calculated and spat in your face. You will be overwhelmed with the amount of data there is, but when you figure it out, it gives you very good information about your website’s productivity. Set up filters, check your bounce rate, check the demographic behavior of the audience – the possibilities are almost endless.

Goals

Now that you have a brief understanding of what GA is all about, here is the juice. Goals are set up in the admin panel of GA, and this is what most of my time on Google Analytics consists of. There are 4 different types of custom goals you can set up: Destination, Duration, Pages/Screens per session, and Events.

Create a new goal screen
Destination
Destination goals are pretty straight forward. You set up a destination page url, and every time someone visits the page, it tracks it as a conversion. You can also set up funnels for the destination page, meaning if the person browsing your website follows the exact steps you’ve set up, only then it will be tracked as a conversion. So if you have yoursite.com/a.html as your destination page, and your first step in the funnel is yoursite.com and your second step is yoursite.com/b.html, if the person goes to /a.html straight from you home page, it wont be tracked as a conversion.

Duration
Durational goals are set up if you want to track the user’s time on your site. Every time a user goes over the time limit specified in one session, GA tracks it as a conversion. Personally, I haven’t dealt with these types of goals since the reporting menu has most of the information needed about bounce rates and such.

Pages/Screens per session
These types of goals are set up if you want to track the users engagement with your site. For example, if you set it to ‘Greater than 3,’ every time a user views more than 3 pages of your site in one session, that will be tracked as a conversion. This goal, just like the previous one, is usually not favoured, since information like average pages per session is already available to you.

Events
Here we are, finally. The type of goal that most confused me, and still sometimes does. The first search result for the query in question is this. A very long and confusing documentation that covers everything, and yet nothing at the same time. It never fully explained the right way to set up event tracking. I am not saying my way is the most correct one, but it works for me. This works for any link clicks, form submissions, email clicks, and pretty much anything that can have an “onclick” method.

Event goal setup screen

You get 4 fields to put in, but you only need the first two. Here is what email tracking would look like if you were doing it:

<a href="mailto:name@email.com" onclick="ga('send', 'event', 'email', 'click');">name@email.com</a>

The ’email’ is your category and the ‘click’ is your action (refer to the picture above). This is the simplest code I found for Universal Analytics. As long as your category is unique on every page, you will be tracking conversions like a pro!

Have any other tips or questions? Give me a shout!

Newsletter Sign-Up