Analytics Demos and APIs

Google Analytics launched a brand new site to showcase many of the most popular Google Analytics demos and tools. The entire site is

  • Open sourced
  • Uses public APIs
  • Available on GitHub

Check it out at: http://goo.gl/Yu1xaa

GA-dev-tools-screen10-29-2014

Here is the code you need for Google Analtyics:

Highlighted is statewide analytics tracking code. Place it before closing </head> tag in your web page.

<script type="text/javascript">
 
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXXXXX']); // your google analytics profile code from your agency's google account
  _gaq.push(['_gat._anonymizeIp']);
  _gaq.push(['_setDomainName', '.ca.gov']);
  _gaq.push(['_trackPageview']);
 
  _gaq.push(['b._setAccount', 'UA-3419582-2']); // statewide analytics - do not remove or change
  _gaq.push(['b._setDomainName', '.ca.gov']);
  _gaq.push(['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>