Advertisement
  1. SEJ
  2.  ⋅ 
  3. SEO

3 Reasons to Update to the New Google Analytics Snippet

Though the Google Analytics asynchronous tracking code isn’t technically all that “new” (considering its initial release date of 3/22/2010), plenty of webmasters whose websites were operating before this launch date never made the extra effort to switch from the ga.js version to the asynchronous code.

In fact, these webmasters are missing out when it comes to some of the perks provided by this new tracking code!

But before we get into these benefits, let’s cover a little background on what the Google Analytics asynchronous tracking code is and how it’s different from its Javascript predecessor…

To illustrate these concepts, think about the process of loading page data on your website as if this information was coming down a pipeline.  In the case of the original ga.js version of the Google Analytics snippet, the tracking code required the download of an entire Javascript library before the code could be unpacked and executed.

Unfortunately, this process blocked the entire pipeline, slowing page load times considerably.  Because of these delays, Google recommended installing the ga.js code snippets towards the end of the body HTML sections so that the Analytics script would be the last thing to load.  However, even this wasn’t enough to prevent delays, load errors and the inaccurate statistics that resulted.

The release of the asynchronous Google Analytics tracking code in March 2010 eliminated many of these concerns.  This new code snippet operates according to AJAX (aka – asynchronous Javascript and XML files) principles, meaning that it occupies a separate “pipeline” from the rest of a page’s source code.  As a result, the code can be loaded earlier in the page, enabling Google Analytics to capture more data without affecting page load times.

As a result of these distinctions, there are a number of different reasons to upgrade to the asynchronous tracking code from Google’s original ga.js version:

Reason #1 – Improved Site Speed

As mentioned previously, one of the key distinguishing features between the ga.js and asynchronous tracking codes is how they’re loaded by the site in question.  Because the asynchronous codes don’t require the loading and execution of a complete Javascript library, they can be launched much more quickly alongside the rest of a website.

The resulting increase in site speed is important for two reasons.  Not only is it an important part of keeping your site’s visitors happy and on your pages, it can also play a role in your site’s SEO.  Google has made no secret of the fact that it prefers fast sites over their slower counterparts; and in this race for extra seconds, something as simple as switching your Google Analytics snippet can make a big difference in your site’s optimization!

Reason #2 – Reduced Bounce Rate

Following on the logic that faster sites keep visitors happier and more engaged, it’s easy to see how switching your site to the newer Google Analytics snippet could reduce bounce rate by speeding up your load times.  Again, this results in two major benefits.

First, since web users today have incredibly short attention spans, even miniscule delays compared to what we once endured in the dial-up ages can turn visitors off and cause them to leave your site prematurely.  One the one hand, this can seriously limit your site’s income potential – after all, if you can’t keep visitors on your site, how can you expect to make sales?

In addition, there’s increasing evidence that suggests Google is taking bounce rate into account as a potential ranking factor.  Because this metric would go a long way towards providing information on whether or not search users believe the results provided in response to their queries are helpful, it’s easy to see how improving your site’s bounce rate could eventually lead to a corresponding increase in your natural search rankings.

Reason #3 – Improved Data Accuracy

Finally, be aware that making the switch to the newer asynchronous Google Analytics tracking code may result in improvements to your overall data accuracy.  Since the older ga.js scripts are typically launched only after the rest of a page’s code has been downloaded, there are a number of different potential error points.  Mistakes in the page’s earlier source code may prevent the script from loading at all, while bounces caused by slow load times may not be recorded and displayed correctly within the Analytics dashboard.

To switch to the new version of the Google Analytics snippet, all you need to do is to log in to your account, click on the “Admin” tab and then navigate to the “Tracking Codes” section.  The asynchronous tracking snippet will be displayed automatically and should look something like the following piece of code (where the “UA-XXXXX-Y” code will be replaced with your own profile identifier:

<script type=”text/javascript”>

var _gaq = _gaq || [];
_gaq.push([‘_setAccount’, ‘UA-XXXXX-Y’]);
_gaq.push([‘_trackPageview’]);

(function() {
var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
})();

</script>

Place your unique snippet into your web pages immediately before the closing </head> tag.  If you already have the traditional snippet installed on any of your web pages (typically immediately before the closing </body> tag), you’ll want to remove these code elements, as the two snippets are not compatible with one another.  Then, return to Google Analytics and use the validation feature found inside to ensure that your new tracking codes have been properly installed.

In addition, there are a few things you’ll want to keep in mind when making the switch between snippets. 

First, if your website runs on WordPress, Joomla, Drupal or any other CMS platform that allows you to enable Google Analytics through a plugin or add-on extension, you’re likely already using the asynchronous tracking code.  However, if you have concerns with your site’s load time or with the validity of the click data you’re receiving in your Analytics dashboard, it may be worth contacting your Google Analytics plugin’s owner to determine which type of tracking code is being used.

Alternatively, if your site is based on static HTML pages and the thought of editing each individual page sounds overwhelming, be aware that switching to the asynchronous tracking code to take advantage fo the benefits listed above isn’t an “all or nothing” proposition.  It’s perfectly alright to switch the snippet on some pages and not others – in fact, this may even be preferable if you’re only experiencing slow load times on some of your more complex or more highly trafficked pages.

Finally, know that some features within the extensive Google Analytics toolbox require the ga.js tracking code variant in order to perform correctly.  As an example, Google’s Event Tracking features are built on the ga.js snippet, meaning that this powerful conversion tracking method may not operate correctly in the presence of the asynchronous code.

For more details on how both types of tracking codes operate – as well as how to implement them correctly on your website – check out the new version of the Google Analytics Help section.

 

Category SEO
ADVERTISEMENT
Sujan Patel When I Work

Sujan Patel has over 12 years of digital marketing experience and has helped hundreds of clients increase web traffic, boost ...