Although asynchronous tracking uses a different Analytics snippet and a different syntax for tracking calls than the traditional snippet, it supports the exact same tracking customizations as the traditional snippet. In fact, the asynchronous tracking syntax is also more flexible than the traditional snippet. For more details, see the Usage Guide.
into your pages. It activates Google Analytics tracking by inserting
the page. To use this on your pages, copy the code snippet below, replacing
your web property ID. Paste this snippet into your website template page so that it appears before
If you need to do more than basic page tracking, see the tracking reference for a list of methods available in the API and see the Usage Guide for details on using the asynchronous syntax. For step-by-step instructions on setting up tracking, see the Help Center article on setting up tracking.
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);
The snippet above represents the minimum
configuration needed to track a page asynchronously. It uses
_setAccount to set
the page's web property ID and then calls
send the tracking data back to the Google Analytics servers.
Important: If you are updating your pages from the traditional snippet to the latest, asynchronous version, you should remove the existing tracking snippet first. We do not recommend using both snippets together on the same page. For migration instructions, see Migrating to Async.