Skip to content

Commit

Permalink
Update Google Universal Analytics to load async (mmistakes#2079)
Browse files Browse the repository at this point in the history
  • Loading branch information
coliff authored and mmistakes committed Mar 5, 2019
1 parent 83937e4 commit 3b6cf7b
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions _includes/analytics-providers/google-universal.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', '{{ site.analytics.google.tracking_id }}', 'auto');
ga('set', 'anonymizeIp', {{ site.analytics.google.anonymize_ip | default: false }})
ga('send', 'pageview');
window.ga=function(){ga.q.push(arguments)};ga.q=[];ga.l=+new Date;
ga('create','{{ site.analytics.google.tracking_id }}','auto');
ga('set', 'anonymizeIp', {{ site.analytics.google.anonymize_ip | default: false }});
ga('send','pageview')
</script>
<script src="https://www.google-analytics.com/analytics.js" async></script>

0 comments on commit 3b6cf7b

Please sign in to comment.