Updated tracking script for ga.js

Categories: GA specific Your Comments 9 »

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

Just to let you know that I have finally gotten round to updating the combined tracking script hack I had for urchin.js to the new ga.js. If you know what I am referring to, the new script is listed here: http://www.advanced-web-metrics.com/blog/ga-scripts/

Essentially the combined tracking script is a modification of the GATC so that it tracks:

  • outbound links - Automatically
  • file downloads - Automatically
  • mailto links - Automatically

Therefore, instead of having to manually modify such links by adding an onClick event handler to your ‘a’ tags, this script will do it all for you.

Why is this necessary?

Outbound links (links to other websites from yours), file downloads (e.g. PDFs, exe, xls etc.) and mailto links (links to an email address) can be important indicators as to whether your site is engaging with visitors. If so, you will certainly want to track these and potentially define them as goals in your Google Analytics reports.

Normally you do this by creating a virtual pageview. However if you have hundreds/thousands of these, or even just a few dozen that constantly change, manually tagging them is an administrative nightmare.

This script uses the properties of the browser (Document Object Model, or DOM for short), to capture links that are non-standard pageviews and automatically create the event handler for you.

The result is that your outbound links, file downloads and mailto links are tracked for you and are always up to date. The default virutal locations for these in your Google Analytics reports are:

/ext/, /downloads/, /mailto/

respectively, though of course you can change these as you wish.

Related posts:

Are you using this or creating your own hacks for Google Analytics? Please post your comments and share your thoughts here.

Tracking error pages from Wordpress

Categories: GA Hacks, GA specific Your Comments 5 »

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

GA Hacks My standard word of caution for all “GA Hacks” posts - This is a tech tip and requires you to have a knowledge of html and javascript to implement and use it…

Tracking error pages is something that page tag solutions cannot track out of the box - including Google Analytics. In Chapter 9 of the book I describe how to track all your error pages using Google Analytics. Essentially, you modify the server error template to include the GATC, then use an advanced filter to rewrite the URL string.

However, if you are a Wordpress user, there is a simpler method than tinkering with your web server…

Wordpress includes a template file called "404 template" (404.php). This is the file used to display an error message if a page is not found. By default it does not contain very much:

<?php get_header(); ?>
	<div id="content">
	  <h2>Error 404 - Not Found</h2>
	</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

Modifying it to this (assuming you are using ga.js in your pages):

<?php get_header(); ?>
	<div id="content">
	  <h2>Error 404 - Not Found</h2>
	<script type="text/javascript">
	  pageTracker._trackPageview("/missing pages" _udl.pathname+_udl.search)
	  document.write("<p>The page: " +_udl.pathname+_udl.search+ " is not found</p>")
	</script>
	</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

allows you to to view the URLs of missing pages in the Google Analytics Content > Top Content report (see screenshot).

Google Analytics Top Content report

As a tip, use the inline filter as shown to bubble up these pages - otherwise they could be buried deep in your reports. Once you have identified the missing URLs, click through on the pages and then select "Navigation Summary". This tells you which links within your website point to these missing pages - that is, have broken links.

The code _udl.pathname and _udl.search are Google Analytics variables captured by the GATC, so it is important that the GATC is loaded first.

Tip: if you are still using the legacy urchin.js page tag (why?), subsitute the string urchinTracker for pageTracker._trackPageview in the above functions.

Obviously there is more than one way to skin a cat. Please let me know if you have used a different hack to acheive this by leaving a comment.

Book corrections and typos

Categories: GA specific Your Comments 13 »

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

Many thanks to those who have provided feedback on the book so far. A couple of typo’s have slipped by me, so I wanted to post them here immediately. Please add if you find more. I will create a separate corrections page if needed.

  • page 181/182:

The code pageTracker._addOrganic("images.google", "prev"); should be placed just before the line pageTracker._initData(); - Not after, as mentioned on page 178 (grey box, positioning of GATC hacks).

pageTracker._addOrganic("images.google", "prev");
pageTracker._initData();
  • page 191, point a (referring to Figure 9.8a):

The regular expression pattern should be: (\?|&)(q|p)=([^&]*) as shown in Figure 9.8a. Note the change in position of *

Thanks to Bart Geerling, Amsterdam for these two.

Book launch: Advanced Web Metrics with Google Analytics

Categories: Events, GA Implementation ABCs, GA specific, KPIs Your Comments 16 »

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

Finally after 18 months I am excited to announce that the book has been published by John Wiley & Sons, Inc and is now available from Amazon and other outlets. The book started shipping on March 17th (coincidentally my birthday!) and just made the SES New York conference. Lucky for me as it sold out on the first day thanks to Sharon Preiss of Mobile Libris for her promotional work there.

Note, I will be hosting a launch party on Thursday April 24th in London. If you are interest in web analytics, and of course Google Analytics specifically, it would be great to meet my potential audience. If you would like to attend, please email me at: .

Why should I buy the book?

If you have an interest in measuring the success of your web site and you have heard of Google Analytics, then this book is aimed at you. The purpose is to help you drive your business and help you make money from your web site. The content covers the whole spectrum of web analytics using Google Analytics - from initial measurement planning considerations, to GA best practice implementation, advanced configuration, hacks (workarounds), KPIs and real world usage, including analyst tasks such as identifying poor performing pages and funnel optimisation.

Who is the book aimed at?

The book is aimed at a broad audience - essentially anyone with an interest in making their web site successful. That includes website owners, marketers, web designers, developers, content creators, PR departments and all the various intermediaries. It’s about measuring for success (the title of the first section) and applies best practice techniques on how to do so using Google Analytics.

It’s a jumpstart for any business to get up to speed on web measurement but is also for experienced marketers and webmasters to go deep into understanding how to track engagements and how to optimise a website using Google Analytics. There are approximately 178 images to illustrate ideas, analysis and to show example reports from real-world sites. Where possible I have been consistent with example images in order to maintain a coherent story for the reader to follow.

OK, so give me some details on the content…

Spanning over 353 pages across 11 chapters, the content of the book is written entirely for the latest Google Analytics tracking code (ga.js) and is split into four key sections:

  • Part I - Measuring Success, is an overview of why understanding your web traffic is important to your business and covers different data collection methodologies (page tags and log analysers), data accuracy considerations and where exactly Google Analytics fits in.
  • Part II - Using Google Analytics Reports, explains how to navigate and use the Google Analytics interface and includes 10 Top reports to whet your appetite and begin the analysis of your website.
  • Part III - Implementing Google Analytics, is the best practice installation and configuration guide detailing how to track all online marketing channels, Flash events, banners, file downloads and more. There is also an advanced section entitled Google Analytics Hacks featuring implementation techniques not documented elsewhere.
  • Part IV - Using Visitor Data to Drive Website Improvement, is the largest section of the book. It describes how to build a culture of measurement in your organisation from objectives and key results, to key performance indicators. This is followed by a chapter dedicated to real-world tasks that covers optimising checkout systems, pay-per-click campaigns (including AdWords), SEO, and e-mail marketing efforts. There is also an introduction to multi variate testing.

Downloads

You can download the Table of Contents, Chapter 1 and the book Index from here or order directly from Wiley (US and Canada only) or Amazon.com. If you use a different Amazon country, simply edit the .com part of the domain from the link accordingly.

Have you read the book?

If you have already had a chance to read the book, please share your own perspective via comments below. I would be deeply appreciative if you could consider writing a review for the book on Amazon. Books like this live and die by their Amazon reviews and I am prepared to take the risk - I hope I don’t regret saying that!

Google is Like a Bank

Categories: Events, GA specific, General web analytics Your Comments 2 »

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

I have heard the notion of Google being analogous to a bank for a number of years. Recently, Jim Sterne also referred to this bank analogy while we were discussing online privacy at the Orion Analytics panel of SES London. So I wanted share and expand upon this discussion.

Please take a moment to read my disclaimer before continuing - that is, the views express on this site are entirely my own and do not represent those of my employer.

Is Google entering into online banking?

In this respect no (I am not considering Checkout here). What I mean by being analogous to a bank, is in the way that data itself has become “currency”. Information has always been valuable - no one likes to be the last to know, and being the first to know gives you a competitive advantage. So whether online or not, the storage and access of data, its security and privacy, is of paramount importance to anyone who hands over information to be stored by a third party.

That is pretty much everybody with Internet access and includes individuals, small businesses and corporations alike. Google occupying such a strong online position - the conduit for many people to find information, products, businesses etc. obviously has an important role to play when it come to data privacy and security.

It’s important that privacy and security have no intrinsic value

A key factor that makes a good, secure and private data storage system, is the strict application of a one size fits all privacy and security policy. That is, regardless of whether you are one of the worlds largest brands spending millions of dollars on operations, manufacturing or marketing, or a small company selling your handicrafts locally - your data should be treated with equal importance.

As an example, imagine if a search engine or bank provided a greater level of security and privacy to large advertisers rather than smaller advertisers (or to those that saved more than others). Even the perception of such a practice would be disastrous for the organisation in charge of protecting your data “currency”. You of course want bullet proof controls whether you save $1 or $100 million dollars. That is how the banking system works and is also how Google operates with respect to handling all visitor and customer data.

» Read the rest of this entry »

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