Google Analytics: How to track all your outgoing links the easy way

by Patrick Altoft on June 20, 2007

One of the common questions asked following my posts about Google Analytics was “How can I track the traffic to external links without adding the onClick code to each and every link?”

With a bit of searching I found a script that you can place in the header file at the top of each of your pages (you might need to edit the templates if you run Wordpress). The script tracks clicks to external links and reports them in Google Analytics. You need to filter the results in the “Top Content” tab to show page views for “outgoinglink” to get the pages to show.

You can find the script here.

Let me know how it works out for you.

Patrick Altoft is Director of Search at Leeds based digital & SEO agency Branded3. Patrick also runs Blogstorm.

You can get our blog posts delivered for free by email every day - simply add your email address to the box below or alternatively grab the RSS feed.

Read some similar posts

{ 5 comments… read them below or add one }

Robert Irizarry 20 Jun 2007 at 7:17 am

Good stuff. Just a heads up for Wordpress users that the plugin Ultimate Google Analytics also tracks outgoing links as part of its functionality. I wonder how different the actual code implementation is?

Patrick Altoft 20 Jun 2007 at 7:36 am

Thanks Robert. Here is the link:
Ultimate Google Analytics

Desty 06 Jul 2007 at 2:20 pm

I put my code in the sidebar since every page calls the sidebar, except for the actual ‘pages’ posts.

Planet Apex 18 Dec 2007 at 11:06 pm

Thanks. very useful

seo 21 Apr 2010 at 10:56 am

I have placed this script before closing head tag. But I was not able to find outbound link report.

Leave a Comment (registration is optional)

Registration is free, takes about 5 seconds and is worth doing.

You can use these HTML tags and attributes:
<a href=""> <b> <blockquote> <code> <em> <i> <strike> <strong>