Added support for Google Analytics async snippet loading (#921)

Snippet from Google: https://developers.google.com/analytics/devguides/collection/analyticsjs/#alternative_async_tracking_snippet

Recommended by HTML5Boilerplate:
https://github.com/h5bp/html5-boilerplate/blob/master/dist/index.html
This commit is contained in:
Christian Oliff 2018-12-28 22:46:24 +09:00 committed by Martin Donath
parent 4e72119d20
commit f9b4a63ebc

View File

@ -22,13 +22,7 @@
<!-- Google Analytics integration --> <!-- Google Analytics integration -->
<script> <script>
(function(i,s,o,g,r,a,m){ window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
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");
/* General initialization */ /* General initialization */
ga("create", ga("create",
@ -59,3 +53,4 @@
}); });
} }
</script> </script>
<script async src='https://www.google-analytics.com/analytics.js'></script>