The GA Autotrack Plugin(s)

The official Google Blog recently introduced autotrack for Google Analytics, a library designed to make some recurring tasks in GA easier for non-developers.

First I was going to say “Google introduced…”, but that would have been wrong. The documentation for autotrack states that

“[t]he autotrack library is not an official Google Analytics product and is not covered by Google Analytics Premium support.”

which is an information that would not have been amiss in the blog article.

You can read up on the capabilities in the autotrack documentation – there is no point in repeating that here (that’s what links are for; I sometimes wish more people remembered that), plus I do not think autotrack adds that much actual value (anybody who can modify the page code to include autotrack is probably already smart enough to implement declarative event tracking by other means, especially since this means you have to modify your page to include the proper data attributes on the first place; so I’m not sure that this really fits the intended audience of ‘non developers’).

In my opinion the best thing about autotrack is that it allows to study in depth a concept that has existed for some time in GA but did not get much love so far, i.e. the idea of plugins – I think so far the only plugin that is widely used is GAs own Enhanced E-Commerce plugin. Plugins allow you to wrap recurring requirements into a function and include it with your GA page tracking code, and if nothing else this is at least interesting in terms of technology.

Autotrack is a collection of GA plugins, and I guess I will have a close look at the way they do their respective thing. And speaking of code, another thing autotrack does is to showcase that Google employees (even in, apparently, “unofficial” products) write much better code than other vendors. Professionally I often work with Adobe Analytics, which is a lot, lot better than GA in enriching and post-processing data – but the Adobe javascript tracking code is an abomination from the 1990s, and the plugins are just as horrible. Google did a good thing here when it dropped all remnants of the original Urchin code and replaced it with nicely designed and documentes APIs.

Two things I’d like to point out:

I am somewhat annoyed with one of the features, namely the “sessionDurationTracker”. The problem this aims to solve is that the last pageview in a session is generally not considered when calculating session length, and the tracker tries to ameliorate this by sending a hit via navigator.sendBeacon on the unload event. Now, the unload event is not the most reliable event and sendBeacon not yet supported everywhere, and a measuring point that might or might fire will not get representative data (seeing that apparently neither IE nor Edge support beacon you will get a systematic error that disadvantages MS Browsers in performances reports).  Plus I generally do not like techniques that re-define key metrics, because that way you lose your baseline for benchmarks. On of the nice things with GA has always been that you have a huge number of other pages  to compare performance against (GA even includes a benchmark reports for an industry vertical), but if everyone and his dog invent their own definition of session duration or whatnot this will no longer work.

The other thing is that I do not know why they have bothered. The best way to implement Google Analytics is via the Google Tag Manager, which currently  does not support plugins beyond Enhanced E-Commerce (which it includes automatically).  Maybe I should add an plugin API for GTM to my wishlist.

So for me this is mostly useless except as a technology demonstration (and don’t get me wrong, this is still very much appreciated). YMMV, so go and have a look.

Leave a Reply

Your email address will not be published. Required fields are marked *