Event Tracking. So Easy, Your Mom Could Do It.

Google Analytics Event TrackingOkay, don’t hate me just yet. It’s not that I think you can’t understand the other blog posts I have read about event tracking… But after spending hours and failing at multiple attempts when teaching myself how to set up Google Analytics event tracking, I realized that most of the guides out there are confusing and overwhelming. In fact, the best guide that I found using a Google Search had some incorrect code and some contradictory statements, which only made things more frustrating.

DISCLAIMER: This rambling is assuming you already have Google Analytics set up for your website. It is also intended for basic uses of event tracking for the everyday person. If you need additional help with the advanced stuff, send me an email and I can work with you directly.

The purpose of this Google Analytics event tracking “how-to” is to simplify the process and make event tracking easy and painless for anyone. Yes, anyone… even if you think the word “code” has something to do with a super-secret encryption message used in the movie National Treasurer (fun fact, a friend of mine from high school was an extra in that movie). Anyways, this guide will explain Google Analytics event tracking in good ole’ fashioned plain English.

The very basics, for the true beginners

(A.K.A. mom)

(If you are not a complete newb, you can skip to the next section)

For those of you who really are starting from square one here, let me lay out some simple explanations of event tracking and why you should be using it. Here are some frequently asked questions about event tracking that I have heard.

  • What is an event for a website?
    • An event is basically just a defined action that analytics can not track on its own, without event tracking in place.
  • What is event tracking?
    • Event tracking uses variables defined in your website code, which allows you to track how and where your website users are completing events.
  • Why is event tracking important for my online success?
    • Chances are, you are already spending a ton of time, money, or both on your website. Event tracking is the only way to identify which elements are helping you to reach your online goals. It is important that you (or your online partner like Ironistic) measure this data to determine where, and how, improvements can be made to increase your return on investment.
  • What types of events can I track with Google Analytics?
    • This could be a long list. I’ll cut to the chase and let you know how I personally use event tracking the most for our clients:
      • Email link clicks
      • Banner clicks
      • Ad clicks
      • Image clicks
      • External link clicks
      • Document downloads
      • Video plays
      • and the list goes on…
    • The cool thing is, you can track everything I mentioned above using pretty much the same method!

Okay, so let’s get to it.

I could write a few paragraphs explaining all the information in the Google Developer’s Guide, but this is event tracking made simple… so I will skip all the technical jargon. You can review Google’s guide here if you want to learn more.

Here is a quick reference guide for the elements of HTML code that we will be defining in the next step (bear with me, it’s actually not as bad as it seems).

This shows how the code is laid out depending on the version of analytics you use (don’t worry, I built a code generator for you, so you won’t have to memorize this!)

Classic Analytics (ga.js) – you may want to get with the times and upgrade to Universal Analytics

_trackEvent(category, action, opt_label, opt_value, opt_noninteraction)

Universal Analytics (analytics.js)

ga(‘send’, ‘event’, ‘category’, ‘action’, ‘label’, value);

Anatomy of event tracking defined

    • category (required)
      • “The name you supply for the group of objects you want to track.”
      • This is important because it determines how your data will be organized in Google Analytics. It can be anything you want really… let’s say you have 5 email links throughout your site you want to track. You could make the category for each one “Email Link.”
    • action (required)
      • “A string that is uniquely paired with each category, and commonly used to define the type of user interaction for the web object.”
      • Using the email link example above, the action here would simply be “click.” Some other situations may be appropriate for using “hover,” “download” “play,” etc.
    • label (optional)
      • “An optional string to provide additional dimensions to the event data.”
      • I typically make this the URL or Page Name. That way it is easy to identify where the event took place. Using our email example, if I label my email link in the footer, “footer,” I will be able to see in Google Analytics when someone “clicks”(action) on an “email link”(category) from the “footer”(label).
    • value (optional)
    • non-interaction (optional)
      • A boolean that when set to true, indicates that the event hit will not be used in bounce-rate calculation.
      • This can be useful if you are tracking an event that takes a user off of your website (which, honestly, if you are linking off your website you should always open in a new window!). This will exclude your click from being counted as a bounce.

Now for The Fun Part

Now that you understand the basics of what event tracking is and why you should be using it… here is where I want to make this easy for you. Fill out the form below and I will show you the exact snippet of code to place within the event you want to track. Be sure to check which Google Analytics code you are using because the event tracking will be different. Now you give it a try!

Hannah’s Ridiculously Easy to Use Event Tracking Code Generator

  • Example: email links, downloads, external links, videos etc
  • Example: click, play, hover, download, etc.
  • Example: Email link in footer, /about-us/, registration form, etc.
  • This field is for validation purposes and should be left unchanged.

More Examples:

See the examples below for placement of your code (pasted code is in red):

Classic Analytics (ga.js)

<a href=”mailto:hwatkins@ironistic.com” onClick=”_gaq.push([‘_trackEvent’, ’email links’, ‘click’, ‘footer’,, ‘true’]);”>Email Me</a>
<a href=”/documents/registration-form.pdf” onClick=”_gaq.push([‘_trackEvent’, ‘downloads’, ‘download registration form’, ‘/documents/registration-form.pdf about us page right rail’, 3, ‘true’]);”>click here to download</a>

Universal Analytics (analytics.js)

<a href=”mailto:hwatkins@ironistic.com” onClick=”ga(‘send’, ‘event’, ’email links’, ‘click’, ’email link in footer’, 3,);”>Email Me</a>

<a href=”/documents/registration-form.pdf” onClick=”ga(‘send’, ‘event’, ‘downloads’, ‘download registration form’, ‘/documents/registration-form.pdf about us page right rail’, 3,);”>click here to download</a>

Tracking events for button clicks, image clicks, sidebar ad clicks, etc. is the same concept as above. Just add the snippet of code within the element that is being tracked. After you have added all of your event tracking code, you can view the data in Google Analytics by clicking on “Events,” under “Behavior.”

Well, there you have it! The simple guide: Google Analytics Event Tracking. So easy, your mom could do it. Hopefully, you’ve learned something today that you can go to go forth, improve your website, and increase your goal conversions.

Request A Quote
Let's take your business to the next level. Fill out the form below to get started!

"*" indicates required fields

Name*
Sign me up for IronMail
This field is for validation purposes and should be left unchanged.