Tracking Outbound Link Clicks
It is possible to track outbound link clicks by adding an onclick event to the link. You have to do this manually because you have to make up a label/ fake url to track for it.
The syntax for tracking outbound links with the new Google Universal Analytics is like this:
<a href="http://www.google.com" onclick="ga('send','pageview','/outbound/google'];return true;">google</a>
If you change to use the new Universal Analytics main tags then you must update any tracking links that you have previously created in your content.
Legacy Information Below
Example for the older synchronous script
Lets say we want to link to google and we want to track in our google analytics when this link is clicked. We can construct the link like this:
<a href="http://www.google.com" onclick="mojoPageTracker._trackPageview('/outbound/google');window.open(this.href,'_self');return false;">google</a>
Note that we need to make up a label for tracking and it must be unique for each link you are tracking. In the above example we are recording the link click as 'outbound/google' and when we see results in google analytics this is the url it will show.
Example for the newer Async script
<a href="http://www.google.com" onclick="_gaq.push(['_trackPageview', '/outbound/google']);window.open(this.href,'_self');return false;">google</a>
Last Updated 2011-05-28 by Joe Audette