How to Upgrade Your WordPress Site to Use Asynchronous Google Analytics Tracking

Nearly every WordPress site has Google Analytics tracking code on it in order to capture valuable information about website traffic and marketing effectiveness.  Google has made improvements to its tracking method within the past year and you will need to upgrade on your end in order to take advantage of the new asynchronous tracking.

What is Asynchronous Tracking and why would I want it?

Asynchronous tracking is an improvement to Google’s previous tracking code. It takes advantage of browser support for asynchronous JavaScript to enhance the speed in which the tracking code is loaded. This means the analytics tracking can be done at the same time as rendering other content, so that the tracking code will not cause delays on your page. Essentially, it helps your pages to render faster.  Google lists the advantages as:

  • Faster tracking code load times for your web pages due to improved browser execution
  • Enhanced data collection & accuracy
  • Elimination of tracking errors from dependencies when the JavaScript hasn’t fully loaded

If you’re still using the old tracking method, there’s no reason to put off switching. It’s very easy to change to asynchronous tracking, whether you’re adding the snippet yourself or using a plugin.

Two Ways to Upgrade to Asynchronous Tracking on WordPress:

Option 1: Change or Upgrade Your Plugin

If you’re using a plugin to add Google Analytics to WordPress, change to one that supports asynchronous tracking. As far as I know, the only two plugins that currently support the asynchronous tracking method are:

Google Analytics for WordPress by Joost de Valk

Asynchronous Google Analytics for WordPress by Bambang Sugiarto.

If you’re already using one of these but have been lazy about upgrading your plugins, make sure you get the latest version. If you’re using a different plugin to add your analytics tracking code, you may want to consider switching to one of these so that you can take advantage of the best tracking method available.

Option 2: Manually Add the Snippet

If you don’t want to use a plugin, or if you’ve already manually added the tracking code to your site, you will need to update your snippet to use asynchronous tracking. Check out Google’s guide to Getting Started with the Asynchronous Snippet. Copy the snippet from this page and replace the UA number with your own. Google recommends that you insert the new snippet at the bottom of the section of your pages, after any other scripts your page or template might use. Of course, you’ll want to remove your old snippet.

The most important reason to upgrade is to improve your loading time. Your page loading time affects your ability to capture your visitors’ attention. Anything you can do to shave off even one second of time on loading is going to be a valuable improvement to your site. Don’t wait to upgrade your tracking code. Now that you know how easy it is, you can handle it in under five minutes.

Comments (5)

Participate