Skip to content

Commit c085a63

Browse files
authored
Updated Google Analytics code (alshedivat#123)
GA site tag was updated today, misc.html has been changed to reflect the same.
1 parent a734d4a commit c085a63

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

_includes/scripts/misc.html

+6-7
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@
66
{% endif %}
77

88
{% if site.enable_google_analytics %}
9-
<!-- Google Analytics -->
9+
<!-- Global site tag (gtag.js) - Google Analytics -->
10+
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
1011
<script>
11-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
12-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
13-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
14-
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
12+
window.dataLayer = window.dataLayer || [];
13+
function gtag() { dataLayer.push(arguments); }
14+
gtag('js', new Date());
1515

16-
ga('create', '{{ site.google_analytics }}', 'auto');
17-
ga('send', 'pageview');
16+
gtag('config', '{{ site.google_analytics }}');
1817
</script>
1918
{% endif %}
2019

0 commit comments

Comments
 (0)