How to Track Events in Google Analytics

Posted by & filed under .

I like to know what my users click on when they are browsing my websites, by tracking what users do on your website you can more easily optimize your links to get a better conversion.

So how do i track clicks on my website you might ask?
It is actually quite simple to do if you already have your Analytics Tracking code installed in the head of your HTML or PHP document.

Lets say I wanted to track the amount of users that downloads my EBook on my squeeze page after they confirmed the auto responder subscription and have been redirected to the download page.

Imagine that our current download link looks like this:
<a class=”button” href=”ebook.pdf” >Download eBook Here!</a>

By adding a onClick event handler to any link on our website with this script inside it you will be able to see in real time what users are clicking on on your website.

onClick=”_gaq.push([‘_trackEvent’, ‘Category‘, ‘Action‘, ‘Label‘]);”

  • Category is the category in which the event will be labeled under, For example you could use “Downloads” as the category for all your download links.
  • Action is what type of event it is, in this case, it would be a “click”, so I would call this “Clicked Download Link”
  • Label is an optional value that you could for example use to refer to what was downloaded, in this case I would use “EBook – How To Train Your Dog Effectivly”


You simply turn it into this:

<a href=”ebook.pdf” onClick=”_gaq.push([‘_trackEvent’, ‘Download’, ‘Clicked Download Link’, ‘EBook – How To Train Your Dog Effectivly’]);”>Download Ebook Here!</a>


When you have added this to your Website/Squeeze Page/Blog Post you can go into Google Analytics under “Real-Time” → Events, and see your events being fired off in real time.

For a summary of all events that has happened since you added the event tracking code you can go to Content → Events → Overview to see something similar to this:

Content → Events → Overview → Event Label

Content → Events → Overview → Event Label

I hope you enjoyed this short little tutorial.
If you found this helpful I would appreciate it if you share it with your friends :)

One Response to “How to Track Events in Google Analytics”

Leave a Reply

Your email address will not be published. Required fields are marked *