Skip to content

Instantly share code, notes, and snippets.

@huobazi
Last active April 1, 2016 18:05
Show Gist options
  • Save huobazi/02aadbc7d1560247ee8c to your computer and use it in GitHub Desktop.
Save huobazi/02aadbc7d1560247ee8c to your computer and use it in GitHub Desktop.
GA.js
// Google Analytics
(function(window, document, undefined) {
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'XXX']);
_gaq.push(['_setDomainName', 'XXX']);
_gaq.push(['_trackPageview', document.location.pathname +
document.location.search + document.location.hash]);
(function(d, t) {
var ga = d.createElement(t);
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == d.location.protocol ?
'//ssl' : '//www') + '.google-analytics.com/ga.js';
var s = d.getElementsByTagName(t)[0];
s.parentNode.insertBefore(ga, s);
})(document,'script');
})(this, this.document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment