Event tracking doesn’t have to be so hard, it’s just not presented in a very user-friendly way.

Google Analytics event tracking has changed a while back, and while their documentation is pretty good, it’s far from being really explicit, and for those out there who don’t have any coding knowledge is a downright nightmare.

The truth is that there’s nothing to worry about, the system is set-up so well that you don’t need a developer to set up the event tracking, you just need to know what goes where, and you’ll also need to have a clear idea of how you want Analytics to show the reporting.

Let’s start over. According to the guys at google, these are the parameters you need to think about before starting your implemention. Please try to pay attention especially to the “Required” column.

Field Name Value Type Required Description
eventCategory text yes Typically the object that was interacted with (e.g. 'Video')
eventAction text yes The type of interaction (e.g. 'play')
eventLabel text no Useful for categorizing events (e.g. 'Fall Campaign')
eventValue integer no A numeric value associated with the event (e.g. 42)

Now the way to actually embed this into your site is via javascript, but it can done in two ways. The easiest way is by setting an “onclick” action on your buttons/links and an “onchange” action if you’re trying to target things like form inputs/radios/checkboxes. The final code needs to look like this:

That’s really all there is to it. Add the “onclick” code to the buttons you want to track and you’re good to go. You only need to set fields for the eventCategory and eventAction parameters, but this really is the case of more info is better. If you’re a developer and you want to use the same action on multiple links, like for example if you’re running an affiliate program you can create a javascript function and insert it in any of your site’s js files, just like the one below:

and then simply pass the URL of your affiliate link in the callback for the function to know which link was pressed.

You can do this for a series of other purposes, simply by changing the variable URL with one of your choices. That’s all you really need to do to in order to set up a successful Google Analytics event tracking campaign and hypercharge your website’s conversions.

  • Comments (1)
  • Views (21717)

About the Author

Andy is the brain behind our development and success here at BigBangThemes. He has been developing websites and improving the way you interact with emails for over 7 years and his passion for customer satisfaction is tireless.

  1. avatar image
    phim hay at July 13, 2017 Reply

    Good post. I learn something new and challenging on websites I stumbleupon everyday.
    It will always be helpful to read through content from
    other authors and practice something from other sites.