With the advent of Google Analytics asynchronous tracking code, many sites need to review the automatic tagging code they’re using to track items such as downloaded files and outgoing link clicks. Unfortunately Google doesn’t offer an official library for this purpose; each Google Analytics or Urchin administrator is on their own in selecting an extended tracking script.
Some of the important issues to consider
- How accurate is the tracking code? Will it work in all major browsers?
- Is the tracking code compatible with other JavaScript code in the site?
- Is it possible to configure downloads as either events or page views, based on file type? My general feeling is that document downloads should be configured as page views. Image or other non-document downloads should be configured as events. There are some limits using events in Google Analytics which need to be considered on a case by case basis.
- Is it possible to configure external link clicks as events or page views, independent of the download configuration? I would generally advise configuring external link clicks as events since site visitors will view the target page on someone else’s site. Do keep in mind current Google Analytics events limitations. Events cannot be used in defining goals nor profile filters.
- How much code will the tracking code add to a site? The code will need to be loaded at least for the first page a user views from your site. Slow loading times can be an issue for users stuck with slow cellular connections (Mobile Broadband is a misleading marketing invention – in many cases it is really not much faster than dialup) and may penalize a site in search engine results. Reliance on a Jquery library comes with significant overhead, somewhat mitigated if the jquery code from a central repository is already in a user’s browser cache or is already loaded by the site.
- How fast does the script execute on a page with many links? This will depend on several factors, including the number of links on the page, the browser’s internal JavaScript engine and the available computer resources.
- Is the tracking code script encumbered by licensing restrictions?
- What version of the Urchin / Google Analytics tracking code is supported? Google has released three versions to date, as noted in the table below. Each tracking code script is usually developed for a specific version of the Google Analytics/Urchin tracking code. Urchin, through versions up until 6.501, is only compatible with urchin.js. Urchin 7 will most likely support ga.js.
| Version | Code | Introduced | Note |
|---|---|---|---|
| 1 | urchin.js | Google recommends that all sites migrate to ga.js except for Urchin users. Urchin users should install at least version 6.501 before migrating. | |
| 2 | ga.js | October 2007 | |
| 3 | asynchronous ga.js | December 2009 | asynchronous tracking improves both page loading times and data collection accuracy. |
Table 1: Google Analytics Tracking Code versions
Only one of the scripts I’m aware of currently tracks downloads or external links triggered by a right click on a link. The same is true regarding the ability to selectively track downloads as events or page views depending on the type of download, i.e. by file extension. The idea is to be able to track document downloads (pdf, doc, odt, txt) as page views and non-document downloads as events.
| Source | Documentation | Urchin.js | ga.js | asynchronous ga.js | Download Tracking | Download tracked as | External link clicks | External link clicks tracked as | mailto clicks | mailto clicks tracked as | Left, Right & Middle Click tracking | Notes | License | Version | Requires Jquery | Size | Total Size | Code Location [you should NOT link directly to the file: 1) it isn't nice; 2) It is a potential security risk] |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Advanced Web Metrics / Brian Clifton | http://www.advanced-web-metrics.com/blog/2008/06/08/updated-tracking-script-for-gajs/ | √ | √ | page view | √ | page view | √ | page view | Brian is known in the web analytics community for his excellent book on Google Web Analytics. | not specified | not specified | 2.2K | 2.2K | http://www.advanced-web-metrics.com/scripts/addLinkerEvents.js | ||||
| Advanced Web Metrics / Brian Clifton | http://www.advanced-web-metrics.com/blog/2007/09/10/tracking-links-to-direct-downloads-automatically/ | √ | √ | page view | √ | page view | √ | page view | not specified | Jan 15th 2009 | 3.2K | 3.2K | http://www.advanced-web-metrics.com/scripts/addLinkerEvents-ga.js | |||||
| Antezeta / Sean Carlos | http://antezeta.com/news/google-analytics-tracking-scripts | √ | √ | event or page view, based on file extension | √ | event or page view | √ | Uses onmouseup to track all mouse clicks. Will not currently track keyboard enter. Outgoing links can be tracked as events or page views independent of file downloads. File downloads can be tracked as either pages views or events, based on file extension. Program based on code originally written by Ronald Heft for his WordPress plugin. | not specified; donations welcome | 1.0 beta | √ | 2.1K | 72.8k | Commented version: http://antezeta.com/j/galinks-full.js Minimized version: http://antezeta.com/j/galinks-min.js | ||||
| Francesco Terenzani | http://www.terenzani.it/54/urchintrack-utility-tracciare-link-esterni-e-download-con-google-analytics | √ | √ | page view | √ | page view | Requires download extensions specified in each page – rather than in JavaScript include file. | not specified | 0.2 | 996b | + list of file extensions | http://www.terenzani.it/wp-content/lab/javascript/ga-urchin.trackLinks/GA-urchin.trackLinks.js | ||||||
| Francesco Terenzani | http://www.terenzani.it/113/tracciare-link-esterni-e-download-con-google-analytics | √ | √ | √ | page view | √ | page view | Requires download extensions specified in each page – rather than in JavaScript include file. | not specified | 1.02 | 1.3K | + list of file extensions | http://www.terenzani.it/wp-content/lab/javascript/_ftTrack/_ftTrack.js | |||||
| Goodwebpractices.com / David Towers | http://www.goodwebpractices.com/roi/track-downloads-in-google-analytics-automatically.html | √ | √ | page view | √ | page view | √ | page view | not specified | not specified | 2.6K | 2.6K | http://www.goodwebpractices.com/downloads/gatag.js | |||||
| Immeria / Stephane Hamel | http://code.google.com/p/gaddons/ | √ | √ | events. Can be changed to pages but changes exits and mailto to pages as well. | √ | events or pages | √ | events or pages | Based on a script originally published by Justin Cutroni in “Google Analytics Short Cuts”. A modified version tracks center and right mouse buttons: http://www.diird.vic.gov.au/__data/assets/js_file/0009/119592/gaAddons-diird.js | Mozilla Public License | V2.8 | 5.4K | 5.4K | http://immeria.net/js/gaAddons.js | ||||
| Immeria / Stephane Hamel | http://immeria.net/gaAddons/ | √ | √ | event or page view | √ | event or page view | √ | event or page view | Can estimate page loading time; beware this is only a rough estimate. Can change bounce rate definition based on time on single page Supports integration with iPerceptions 4Q survey tool. Under active development, expect more features in the future. | Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License | v2.0.6 | 1.3.2+ | 5.6K | 76.6K | http://gaddons.googlecode.com/files/gaAddons-2.0.min.js | |||
| Solutions for WordPress | ||||||||||||||||||
| Joost de Valk | http://yoast.com/wordpress/google-analytics/ | √ | √ | event or page view | √ | event or page view | WordPress plugin. Earlier versions work with non-asynchronous ga.js code. Includes support for Custom Variables which allow segmentation on Logged in users, Author name, Single category, All categories, Tags, Publication year, Post type. | GPL; donations welcome | 4.0.8 | http://downloads.wordpress.org/plugin/google-analytics-for-wordpress.4.0.8.zip | ||||||||
| Ronald Heft | http://ronaldheft.com/code/analyticator/ | √ | √ | event or page view (must be same for both downloads and exit clicks) | √ | event or page view | WordPress plugin. | not specified; donations welcome | 6.1.1 | √ | http://wordpress.org/extend/plugins/google-analyticator/ | |||||||
What’s your experience tracking outbound links and download with Google Analytics and Urchin?
Similar Posts:
- Google Analytics Event Tracking – New Option to Avoid Impacting Bounce Rate
- Web Analytics and the Missing Right Clicks Conundrum
- Use events to track 404 page not found errors in Google Analytics
- Remove WordPress version information from your blog and feeds
- Web Analytics Embedded JavaScript Page Tracking Code: Place at the top or bottom of the page?
Registration is now open for the next SEO Course (March 22 and 23) and Google Analytics Course (March 14 and 15) in Milan. Don’t miss the opportunity!




How do I use http://www.antezeta.com/j/galinks-full.js ?
Hello,
yes, how do you implement it? How do you add more filetypes – .dmg for us Mac users? Does it have to be placed before or after the Google Script? Where do you see the results in Google Analytics?
It would be nice to have some more information about the usage of the script before we add it to our websites
Please!
Thank you,
Jan