Posted By

brianyang on 02/27/10


Tagged


Versions (?)

Google Analytics Script


 / Published in: JavaScript
 

add google analytics tracking at top of page

  1. var _gaq = _gaq || [];
  2. _gaq.push(['_setAccount', 'UA-9999999-2']);
  3. _gaq.push(['_trackPageview']);
  4.  
  5. (function() {
  6. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  7. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  8. (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
  9. })();

Report this snippet  

You need to login to post a comment.