Skip to content

Instantly share code, notes, and snippets.

@Godoy
Created April 21, 2016 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Godoy/dd3ba485f46012247b53b07e4693dbe7 to your computer and use it in GitHub Desktop.
Save Godoy/dd3ba485f46012247b53b07e4693dbe7 to your computer and use it in GitHub Desktop.
async load analytics javascript script tag
(function(){
window['GoogleAnalyticsObject'] = 'ga';
window['ga'] =
window['ga']
||
function(){
(window['ga'].q = window['ga'].q || [])
.push(arguments)
},
window['ga'].l = 1 * new Date();
a = document.createElement('script'),
m = document.getElementsByTagName('script')[0];
a.async = 1;
a.src = '//www.google-analytics.com/analytics.js';
m.parentNode.insertBefore(a, m)
})();
ga('create', 'UA-XXXXXXXX-1', 'auto');
ga('send', 'pageview');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment