A long overdue blog post!  The modifications below will enable you to track email links, document downloads & outbound links on your site with Google Analytics.  There are other ways to do this (such as using Event Tracking) but this is the simplest way & can be then used to add goals into your Google Analytics profiles.

Please note: the code here is correct for the “Async” version of Google Analytics.

Tracking Email Link Clicks

Google Analytics can track clicks on outbound links & email links with a small update to the code around the link.  We tend to use automated systems that come from the plug-ins within WordPress – our preferred CMS of the moment.  However, if you cannot setup this up then you can use the modification below to track your email links:

Original Link

<a href=””></a>

Updated Link

<a href=”” onClick=”javascript: _gaq.push([‘_trackPageview’, ‘/email/contact-page’]);”></a>

When you review your content report the click on the email link will show in there under the page view that you set in the code above.  You can then add this as a goal into your Google Analytics reports.

Tracking Downloads

We can also use the same modification for downloaded documents such as PDFs, doc files etc.  Again we normally use a plug-in for Wordpress that automates this function but the manual method is shown below:

Original Link

<a href=””>Download the map</a>

Updated Link

<a href=”” onClick=”javascript: _gaq.push([‘_trackPageview’, ‘/downloads/map’]);”>Download the map</a>

Tracking Outbound Links

Want to understand which links people are using to leave your site?  This quick modification will show you which of your outbound links are the most popular.  Again this information is viewable in your Top Content report & goals can be setup if you wish to track the outbound links:

Original Link

<a href=””>Click here for other site</a>

Updated Link

<a href=”” onClick=”javascript: _gaq.push([‘_trackPageview’, ‘/outbound/’]);”>Click here for other site</a>

If there are any other modifications that you’d like to see here please request them below & I’ll follow up this post with any requests!

Google Analytics v2.0
Creative Commons License photo credit: vrypan

Tags: , , ,