Google Analytics Tracking Code and Page Speed
For years, webmasters were concerned that the Google Analytics tracking code (known as ga.js) was slowing down their websites. As we know, on the Web, time is money. Improving your page load time is becoming a vital factor in the ROI of your website. Bounce rate, time on site, rankings, operating costs and conversions have all been cited as factors that can be affected positively by reducing your site load time. Speed, in general, is a driving force behind Web 2.0 and the rising number of media-rich websites.
Google’s recent push to speed up the Internet via Caffeine and algorithm updates placed page load time at the forefront when making improvements to its Analytics tracking code. We are now on the third generation of tracking code for Google Analytics, with the release of the asynchronous tracking code in May.
To understand more about the new Google asynchronous tracking code versus the old ga.js code, let’s take a look at how they both work. You’ll also find out how to perform the new Google Analytics setup and install Google Analytics’ new code.
Former Google Analytics Tracking Code: ga.js
Under the old system, the Google Analytics tracking code could block that pipeline from fully executing; therefore, inaccurate Analytics data was commonplace. That’s why it was considered a best practice to install the old tracking code at the bottom of the HTML code. At the bottom, it was the last thing to load and it would not slow down the rest of the page.
New Google Analytics Tracking Code: Asynchronous
This means there isn’t a “blocking” period between the time a link is selected and the time it’s ready for a user to start interacting with it. So there isn’t any download latency when the tracking code is executed.
Install Google Analytics’ Asynchronous Tracking Code
Sitewide improvement of page load times is a compelling reason to make the switch from the old Google Analytics tracking code to the new code. For the Google Analytics setup of the new asynchronous tracking code, follow these steps to install Google Analytics’ snippet below:
- Remove the existing tracking code and customizations from your site.
- Install the code. Google suggests most installations of the asynchronous tracking code be at the bottom of the Head section, just before the </head> tag. Although, some reports suggest page load time varies with the placement of the code. Search and social media company, Position², posted test results in April that showed variations in page load times with placement either inside the Head tags, just after the <body> tag or just before the </body> tag. [Source]
- Then, change the _setAccount method to your Web property ID.
- Reinstall customizations back in the asynchronous syntax.
var _gaq = _gaq || ;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
var s = document.getElementsByTagName(‘script’); s.parentNode.insertBefore(ga, s);
Full Speed Ahead
Site speed optimization cannot be considered an afterthought anymore; it has to be a priority. Google is on a mission, and if you’re not with ’em, essentially, you’re against ’em. In other words, if you’re not willing to be a part of Google’s initiative to make the Internet faster for its users, then eventually, your website may not reap the rewards from Google.
Every little bit you can do to improve your site’s speed is important. Google officially stated that page load time is now one of more than 200 variables that influence ranking in the search engine. In addition to implementing the Google asynchronous tracking code, tap into free tools such as the Google Page Speed tool to improve the latency of your websites.
A word of advice: Pay close attention to what Google is saying, not just in its official statements but also its casual mentions, its services, its patents on potential services and so on. Learn to decipher the elusive Google speak and you’ll have a better understanding of where search is headed and how to prepare your site for the future.