Feedback Form

Tracking banners and other outgoing links - Automatically

Categories: GA Hacks, GA specific Your Comments 23 »

1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 5 out of 5)
Loading ... Loading ...

ga-hacks.gifA word of caution - This is a tech tip and requires you to have a knowledge of html and javascript to implement and use it…

[Update 03-Nov-2008: This hack is for the legacy urchin.js tracking code.
Always refer to the Scripts & Downloads section for the latest version.
]

Your site may offer a visitor a link to click through to an external web site such a subsidiary, an affiliate, advertiser or an trade organisation. For Google Analytics, a visit leaving your web site requires an edit to the page in order to track it. This is achieved by modifying your outbound links to call urchinTracker and is extremely easy to do. However, what if your web site has hundreds of separate outgoing links that are constantly evolving and being appended to? Clearly manually modifying each link becomes laborious and inefficient. To overcome this you can apply the example JavaScript code below to your web site:

<script type="text/JavaScript">
// Only links written to the page (already in the DOM) will be tagged
// Script can be called multiple times

function addExtLinkerEvents() {
var as = document.getElementsByTagName("a");
var extTrack = ["mysite.com"];
// replace mysite.com with your web site domain

for(var i=0; i<as.length; i++) {
	var tmp = as[i].getAttribute("onclick");
	// Track links off site – i.e. no GATC
	if (tmp != null &#038;&#038; tmp.indexOf('urchinTracker') > -1) continue;
	for (var j=0; j<extTrack.length; j++) {
		if (as[i].href.indexOf(extTrack[j]) == -1) {
			var splitResult = as[i].href.split("//");
			as[i].setAttribute("onclick",((tmp != null) ? tmp : "") +
			  "urchinTracker('/ext/" + splitResult[1]+ "');");
			// the above must be on one line - from as[i]... to ");
			break;
		}
	}
}
}
addExtLinkerEvents()
</script>

The script works by looking for links within the browser’s Document Object Model (DOM) that do not match the domain value given in the variable array extTrack. If the link does not match extTrack then it is considered an external link and so is modified to include the urchinTracker call. By this method, all external links will show in the Google Analytics reports as:

/ext/the-url-that-is-clicked-on

Where the-url-that-is-on clicked on is minus ‘http://’. You can modify the JavaScript to adjust the path as required,

IMPORTANT: The position of this code within your page is important. The code must be placed after your call to the Google Analytics Tracking Code (GATC). Alternatively, you can place the addExtLinkerEvents() call in an onLoad event handler and host the provided JavaScript in a separate file. As an example I show this below, assuming the javascript is hosted in a file called trackExternal.js, as follows:

<script src="http://www.google-analytics.com/urchin.js" type="text/JavaScript">
</script>
<script src="/trackExternal.js" type="text/JavaScript"></script>
<script type="text/JavaScript">
	_uacct = "UA-XXXXX-Y";
	urchinTracker();
</script>

<body onLoad=”addExtLinkerEvents()”>
	...your remaining web page content...
</body>

A note on performance: Each time your page loads, this script will go through all links referenced on the page to see if it is external. Clearly the more links on your page, the harder the script must work. As long as the number of links on each page number in the hundreds and not thousands, performance should not be a problem.

Also note that for pages with a large number of links, it is possible that visitors will click on an external link before the script has modified it. The result is that click through will not be tracked by Google Analytics which is an accuracy consideration that effects all web analytics vendors.

Did you find this tip useful? I am considering writing more of these tech tips if you feel they are useful. Please provide your feedback with a comment.

Why is Google Analytics unique (free)?

Categories: GA specific, General web analytics Your Comments 6 »

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

The Google Analytics business model is unique for the web analytics industry - a deep dive reporting tool suitable for companies of all sizes (past article - Who uses Google Analytics?) given away free of charge. But is there a catch to this uniqueness? Well in my view there is none. Of course I am slightly bias in my opinion, but the idea behind providing Google Analytics for free makes perfect sense to me:

  • Provide accountability and transparency to existing Google advertisers
  • Provide confidence and prove the value of online advertising to potential new advertisers

Lets face it, happy customers are good for any business. For Google, may be as a result of using Google Analytics, customers will remain advertisers for a longer period, become less likely to lapse their accounts (take breaks from advertising), even raise their AdWords budgets to capture a greater share of the search market. For those users that are not advertisers, perhaps Google Analytics will give them the confidence to try it - that is Google Analytics helps Google acquire more advertisers. So to me, giving away Google Analytics for free is a valid business model as it can help generate revenue for the business.

Compared to this return, the cost of providing analytics is not so great. Following Moore’s Law, data collection (bandwidth), data storage (hard disk space) and data processing (CPUs) are inexpensive to provide and becoming more so.

Is this such a unique business model?
Giving away your technology up front in the hope of making your money back later in other ways is used in other industries. For example, the mobile phone industry has been giving away cell phones to customers with annual contracts for many a year now. Satellite TV companies offer free receivers, dishes and installation with their contracts and Internet Service Providers ship their routers for free to new customers. Of course these are not directly analogous to Google Analytics, as they all require a customer commitment to spend a minimum fee usually over a 12 month period. With Google Analytics however, there is no commitment. In fact anyone can use it without charge (and cancel at any time) even if you are not a Google Advertiser.

However being free can also be a hindrance. Some people dumb down the product, claiming that decent features must come at a cost. Others speculate that sharing your data with Google is a bad thing - “they will hike up your bids”. But that is fraud and no business can survive that, as Enron proved. Perhaps by sharing your data, Google could provide a better service such as more qualified leads, better click fraud protection etc. - but that is pure speculation at this stage.

So until Microsoft release their alternative (Gatineau, which is most likely going to be free), Google Analytics remains a unique tool in the web analytics market.

Is having a free tool good or bad for the industry? Does it stifle competition or create new opportunities? Share your thoughts by adding a comment.

Who uses Google Analytics?

Categories: GA specific, General web analytics, Urchin software specific Your Comments 14 »

1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 5 out of 5)
Loading ... Loading ...

wasp Its actually quite easy to detect which web analytics tool a web site is using - you can simply view the source code and look for the page tags yourself. Of course pure logfile analysers cannot be detected in this way, but those are now much less common due to their inherent limitations.

To save you the laborious task of manually checking html source code, there are now various tools available that can detect the javascript page tags for you. One excellent one I use myself is WASP - a Firefox plugin (by Stephane Hamel, Immeria blog) that shows you the web analytics vendor as you browse around the web. It can currently detect 32 different vendors including GA, Urchin, Omniture, Visual Sciences (Web Side Story), Webtrends, Unica, Clicktracks, Indextools plus many others.

Last week, I spent 30 minutes browsing around and found a number of household names now using Google Analytics and/or Urchin. These include:

Alliance & Leicester Bank, ABN Amro, Blockbuster, BOC Group, Dixons, FT.com, Halfords, Interflora, GE Money, Lycos, Harrods, Citibank, National Australia Bank Group, MySpace, Nestle, P&G, Roche, Royal Albert Hall, Stena Line, TUI, Unicef

What is interesting is the number of web sites that use multiple tools and there appears to be a pattern - US companies tend to be the ones with multiple vendor tags on their pages, while European organisations tend to only have one.

Any ideas on why this would be? Is it simply a sign of a more mature market that samples the benefits of multiple web analytics vendors? Please share your thoughts via comments.

New Google Analytics Authorised Consultants

Categories: GA specific Your Comments 4 »

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...


What is a GAAC? Google Analytics Authorised Consultants are experts in the field of web analytics with proven backgrounds and a high reputation. As independent companies, they are authorised to provide their professional services around the free Google Analytics product range.

GAACs provide chargeable services such as 1:1 consultation, implementation, training, data interpretation etc.

A warm welcome the latest new GAACs to join the global network - 5 for Europe 3, for the US and 1 for Australia:

A list of all GAACs is shown on the right menu.

A new phase for Google Analytics

Categories: GA specific Your Comments 4 »

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

New Google Analaytics interface

So the new generation of Google Analytics is released. Though still in beta, its a significant milestone and one that marks a new phase - Phase II. I talked about Phase I for Google Analytics at last year’s eMetrics summit in London. The initial phase was about shoehorning an existing product (Urchin) into the Google infrastructure - integrating with Adwords, scaling to handle traffic from mega sites, internationalising into 16 languages and of course making analytics accessible to all by giving it away for free.

So after the long wait, what does Phase II have to offer?

For me, the emphasis has been in 3 areas, which I list in reverse order of significance for my own usage:

  1. Performance improvements
  2. Feature improvements
  3. UI redesign

1. Performance improvements: You will probably only notice this if you are a high traffic web site (usually this means above 1m+ pageviews per day). A huge engineering effort has taken place to provide a more efficient way of storing and accessing data. This has resulted in faster data access, particularly when drilling down into the reports i.e. cross segmenting.

2. Feature improvements: New or improved features include a customisable dashboard for your summaries, pdf data export added, email scheduling of reports, and improved date range selection with dragable timeline.

3. UI redesign: As you can see, new features, although significant, are not the main purpose of this new release - it is the user-interface that has been given the most attention. As I discussed in my last post, simplifying web analytics so that data from your web site is more accessible and gaining insights on its performance more discoverable, are the keys to taking web analytics to the next level i.e. becoming mainstream. And the new user-interface is what I mean by accessible and discoverable.

So what about new features?

Essentially the front-end changes and back-end re-structuring that have taken place, now allow new features to be developed and published much more rapidly than before. So now that GA is fully Google-ised you can expect Phase III to include new integrations and new features to provide an even richer analytics experience. The trick though, is to always keep it simple and intuitive.

Have you had chance to play with the new Google Analytics? Please share your thoughts, positive or otherwise, by leaving your comments.

Copyright Advanced Web Metrics by Brian Clifton | Privacy | Contact:
Post Feed Comments Feed Log in