Skip to content

Instantly share code, notes, and snippets.

@cbcwebdev
Created December 24, 2011 00:27
Show Gist options
  • Save cbcwebdev/1515779 to your computer and use it in GitHub Desktop.
Save cbcwebdev/1515779 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
// protect against multiple google analytics instances
var _gaq = _gaq || [];
// inform google whose account is being used
_gaq.push(['_setAccount', 'UA-27464642-1']);
// inform google to track a pageview on this page
_gaq.push(['_trackPageview']);
// self executing function
(function()
{
// build a <script> tag on the fly
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';
// insert the google analytics script right before the first script element on the page
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment