/ Published in: JavaScript
Google Analytics is a very popular tool for tracking your website’s user behaviour, and visits. This is simply an optimised version of Google’s asynchronous tracking snippet. To learn what has been optimised, and why it is faster than Google’s own version, follow link.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<!-- asynchronous google analytics change the UA-XXXXX-X to be your site's ID --> <script> var _gaq = [['_setAccount', 'UA-XXXXX-X'], ['_trackPageview']]; (function(d, t) { var g = d.createElement(t), s = d.getElementsByTagName(t)[0]; g.async = true; g.src = '//www.google-analytics.com/ga.js'; s.parentNode.insertBefore(g, s); })(document, 'script'); </script>
URL: http://mathiasbynens.be/notes/async-analytics-snippet