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

by Patrick Altoft on / 6 responses

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.

thanks to SEO agencies and digital agencies for the help on this.

Patrick Altoft is Director of Search at Branded3, a Leeds SEO & Digital Agency specialising in SEO, Web Design, Development & Social Media.

Get daily posts direct to your inbox

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

Comments

Read the 6 comments below, or add your own!

June 20, 2007 at 7:17am

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?

Reply

June 20, 2007 at 7:36am

Thanks Robert. Here is the link:
Ultimate Google Analytics

Reply

July 6, 2007 at 2:20pm

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

Reply

December 18, 2007 at 11:06pm

Thanks. very useful

Reply

seo
April 21, 2010 at 10:56am

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

Reply

Ethan Williams
September 5, 2011 at 4:35pm

Looks like you can use each link’s onclick event to do this:

http://techoctave.com/c7/posts/58-entourage-js-automatic-download-tracking-for-asynchronous-google-analytics

That decreases the file size. Also the onclick event is standard so you don’t have to tackle the cross-browser issues found in native event attaching:

Reply

Leave a comment

Your email address will not be published. Fields marked with an asterisk are required.
 

  *

  *

You can use one of the following tags:
<a href=""><blockquote><code><em><strike><strong>