Google Analytics async=true seems wrong in the Google documentation?

Posted by leeand00 on Pro Webmasters See other posts from Pro Webmasters or by leeand00
Published on 2012-07-05T21:22:46Z Indexed on 2012/07/06 3:24 UTC
Read the original article Hit count: 339

Filed under:

In the Google Analytics async example, they state that in order to include more than one tracker, you need to setup your pages for asyncrous tracking, and they do so using the following code:

<script type="text/javascript">

_gaq.push(
  ['_setAccount', 'UA-XXXXX-1'],
  ['_trackPageview'],
  ['b._setAccount', 'UA-XXXXX-2'],
  ['b._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>

The second tracker is not receiving any results. After looking at my tracking codes to ensure they are correct, I noticed that the ga.async = true statement is specified differently most of the time and is never set to a value of true, it's often set to async but never true. Could this be stopping my Analytics data from posting to the second tracker? or might it be something else?

Also what calls should I look for in the Net tab in firebug to ensure that GA is being called when the page loads?

© Pro Webmasters or respective owner

Related posts about google-analytics