Google Analytics – How To Manually Track Clicks On External Links
8 Comments 768 viewsThere is a tutorial on Google which explains How do I manually track clicks on outbound links?
However that tutorial doesn’t help a lot for non-geeks.
This is my effort to simply the outbound link tracking.
Assuming that you are using Asynchronous Google Analytics Tracking Code follow these steps
Step 1
Add following code just before closing head </head>
<script type="text/javascript">
function recordOutboundLink(link, category, action) {
_gat._getTrackerByName()._trackEvent(category, action);
setTimeout('document.location = "' + link.href + '"', 100);
}
</script>
Step 2
For each external/outbound link which you want to track add the tracking information
<a onclick="recordOutboundLink(this, 'External Website', 'externalwebsite.com');return false;" href="http://www.externalwebsite.com">
Google Analytics Report
You can find this outbound link tracking report under Google Analytics Content->Even Tracking
You can see more details on this report from the menus in left.

Do you know how to do this without having to add tracking code to every single link? Is there a way to track all outgoing links easily?
[Reply]
Ajay Kumar Singh Reply:
April 27th, 2011 at 7:16 am
Unfortunately yes, you have to add tracking code to each outgoing link.
I don’t think there is any other easier way to track all outgoing links.
[Reply]
At last! Someone has put it simply. Thank you!
[Reply]
hai
[Reply]
But that will not open a new page… What must be changed?
[Reply]
Ajay Reply:
January 11th, 2012 at 5:06 pm
I think it is not possible to use _blank in the outbound link, so unfortunately you can’t open the link in a new window.
[Reply]
Christopher Regan Reply:
March 16th, 2012 at 9:03 pm
Ajay: did you ever get your _blank to work with event tracking?
Cheers,
Christopher
[Reply]
Ajay Reply:
March 16th, 2012 at 10:25 pm
Nop.
AFAIK it is official that it doesn’t work. It is not possible.
[Reply]