Happy Holidays everyone! While some of us have been taking time off, the fine folks at Google Analytics have been working hard at improving the technical side of their web analytics solution. It’s very important for the continued growth of Google Analytics that new tracking codes and functions be released from time to time. Today, I’d like to cover some of the more recent technical releases, including a new tracking code and some updates to the Google Analytics API.
On the first day of December 2009, Google Analytics introduced an alternate way of tracking your website’s pages with its new asynchronous tracking code (nicknamed “async”). The async tracking code takes advantage of a faster loading time and improved browser execution to provide better, more reliable, higher accuracy data. Async still uses the ga.js file, but it is far less dependent upon how the browser loads ga.js, making for a better user-experience for the web visitor.
The way that it works is that the async tracking code is placed toward the bottom of the <head> section of each web page of a website. Then, similar to the ga.js tracking code, the web property ID is specificed (your “UA” number) and then the call to _trackPageview is made, which sends data back to Google Analytics servers. Here’s what the base async tracking code looks like:
<script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXXX-X']); _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'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]). appendChild(ga); })(); </script>
The _gaq object that you see at the beginning of the script is what makes the asynchronous tracking possible with Google Analytics. It’s like a queue, collecting each object until the browser is ready to execute them (vs. the standard tracking code which waits for the browser to begin collecting data).
However, with the async tracking code, there is more than one way to skin a cat. Instead of using multiple calls to _gaq.push, you can push all of your commands at once, if you prefer:
_gaq.push( ['_setAccount', 'UA-XXXXX-X'], ['_trackPageview'] );
Heck, you can even split your async tracking script into two parts, if that is more convinient for you. If your site uses a lot of javascript and rich media, you should definitely consider switching to the async tracking code. Even if you have a “lightweight” site, you should still switch over and reap the benefits of faster, more accurate website traffic data.
The next time you log-in to your Google Analytics account, and you’re looking for your tracking code by clicking on the “Check Status” link, you may see a new wizard:
This Google Analytics Tracking Code Wizard is designed to make your life a bit easier by asking you a series of questions on the left of the tracking code. Depending upon your answers, your Google Analytics Tracking Code will be modified accordingly, which should reduce the amount of time digging through Google’s technical documents online. This wizard is also available when you create a new profile or Google Analytics account.
Obviously, you should always consult with a Google Analytics Authorized Consultant (like us) before doing any technical implementation on your site.
If you’re really into the Google Analytics Tracking Code, you can subscribe to the Google Analytics Changelog, where you can receive updates as they happen to the Google Analytics Tracking Code. Some of the newest updates have been the deprecation of _setVar, the added controls for cookie expiration times, and new organic search engines added to ga.js. Check out the changelog and subscribe to it today!
The Google Analytics API Client Python Library was just updated a couple of weeks ago, allowing developers to write programs and applications in the languages that they know and love.
This update coincides with the new API features that were launched three weeks ago. The new Google Analytics API features include support for Advanced Segmentation, Goal 5-20 configuration data, and new support for Custom Variables. If you’re a developer and haven’t used the API in a few weeks, log-in today and check out how powerful the GA API has now become!
How about something a little less technical? Google Analytics has released several new features in 2009. Most recently, the Google Analytics team released Annotations, which are notes that you can insert directly into any trending graph in Google Analytics. This allows marketers, website owners, and IT departments to keep track of all important events and bring “tribal data” from your company right into Google Analytics! Log-in to your account today and begin to import and share your knowledge across your organization!
We hope that you have a happy new year and enjoy all of these new technical Google Analytics updates in 2010!