Tracking link clicks with google analytics?

You probably want to use event tracking – this is a simple Javascript function to can fire from the click event on your links. You will need to make sure you have the standard google tracking script on your page too.

From Google Event Tracking Guide

Event Tracking is a method available in the ga.js tracking code that
you can use to record user interaction with website elements, such as
a Flash-driven menu system. This is accomplished by attaching the
method call to the particular UI element you want to track. When used
this way, all user activity on such elements is calculated and
displayed as Events in the Analytics reporting interface.
Additionally, pageview calculations are unaffected by user activity
tracked using the Event Tracking method. Finally, Event Tracking
employs an object-oriented model that you can use to collect and
classify different types of interaction with your web page objects.


<a href="" onclick="_gaq.push(['_trackEvent', 'Google Link', 'Action label', 'Additional info']);">link</a>


The above is for the older version of the API – ga.js. If you are using the newer Universal tracking please refer to the docs. Effectively the data passed is the same as before, however the call is different.

Example for event tracking using the newer API:

<a href="" onclick="ga('send', 'event', 'Google Link', 'Action label', 'Action Value');">link</a>

Leave a Comment