Google Tracking Code

Oh, do not ask, “What is it?” Let us go and make our visit.

Eh, right you are, Mr. Eliot. One moment please while we connect you…

A quick interjection here on asynchronous tracking code, because I think its worth migrating to asynchronous if your website is still using the traditional ga.js. And as for urchin … ah lads. Get. With. Program.

Unlike a traditional installation, asynchronous tracking optimizes how browsers load ga.js (that piece of JavaScript code that tracks your web pages) so its impact on user experience is minimized. It also allows you to put your Analytics snippet higher in the page without delaying subsequent content from rendering; this is now the Google default tracking code, unlike in the old days (ok, last year) when Google delivered up options like page tagging using a JavaScript snippet.

You’ll notice one key difference between placements of the asynchronous tracking code and the traditional tracking snippet:

  • the asynchronous snippet is placed at the bottom of the <head> section of your HTML file or template.
  • the traditional snippet is placed at the bottom of your page, just before the closing </body> tag.

Because the asynchronous tracking snippet can execute without blocking other code or content, you can place it at the bottom of the <head> section for the best tracking results.

Basically, in December 2010 Google Analytics announced an alternative tracking setup by using a “parallel rail” to execute JavaScript, meaning analytics wouldn’t slow down your site, and your site wouldn’t hold up analytics: asynchronous code; to maximize site speed and make analytics less invasive and more accurate.

This is important for your online business page load speed, because your analytics will no longer prevent your page from loading while it tries to connect to Google’s servers. Also, if you have a slow site and you’re missing a lot of credit where it’s due (because your analytics code is at the bottom of the page, waiting patiently to execute), asynch is the business.

  • Faster overall page load time.
  • Improved collection for short visits to rich media or script-heavy pages.
  • Collecting (and retaining) user clicks that occur before the tracking code loads.

If your site is a pillock and slow to load, analytics might not get the chance to execute, missing those visits you worked so hard to ensare: asynch ensures that the queue of messages to be sent to Google Analytics continues to process, even as users navigate away from the landing page.

In short, if that’s possible, the Google Analytics asynch code does its thing in the lay-by while your website careers down the internet autobahn at a rate of knots; and then it catches up, like an unshakeable, long-limbed, well-trained puppy, eager and biddable.

Cute.