~xdavidwu/xdavidwu.link

ed38cbbf9e368be3a6f4215da13f695f3687b483 — Christian Oliff 5 years ago 31aba17
Update Google Universal Analytics to load async (#2079)

1 files changed, 5 insertions(+), 8 deletions(-)

M _includes/analytics-providers/google-universal.html
M _includes/analytics-providers/google-universal.html => _includes/analytics-providers/google-universal.html +5 -8
@@ 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>