title: Google analytics - _trackEvent before _setAccount? Does order matter?
body: <p>So this will work:
  </p>
  
  <pre class="lang-js prettyprint-override"><code>var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-65432-1']);
  _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);
  })();
  
  _gaq.push(['_trackEvent', 'Videos', 'Play', 'Gone With the Wind']);
  </code></pre>
  
  <hr>
  
  <p><strong>But what if the visitor can come by a link like <code>http://example.com?autoPlay=Wind</code>?</strong> So then the video is already requested, and starts playing, generating:</p>
  
  <pre class="lang-js prettyprint-override"><code>var _gaq = _gaq || [];
  _gaq.push(['_trackEvent', 'Videos', 'Play', 'Gone With the Wind']);
  </code></pre>
  
  <p>event. But then the regular tracking code still runs at the bottom of the page, that's why we have async for:</p>
  
  <pre class="lang-js prettyprint-override"><code>var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-65432-1']);
  _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);
  })();
  </code></pre>
  
  <p>So do I have to move at least the <code>_setAccount</code> to the top, or will it just work as it's already in the queue by the time I call <code>ga.js</code>? Or I could just make my own queue... But here I see a clue that <a href="https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApi_gaq#_gaq.push" rel="nofollow">they made sure</a> not to delete <code>_gaq</code> if something is already in it even before <code>_setAccount</code>. And also there are multiple trackers for different contexts... <strong>So does this mean it's perfectly legal to ignore the order altogether?</strong> Sorry for the simple question, but I can found exactly nothing on what is allowed with async and what is not.</p>
  
  <p>Thanks for help!</p>