Skip to content

Commit 6914fec

Browse files
committed
new blog
1 parent 5071f3f commit 6914fec

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

_includes/head.html

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,14 @@
4040

4141
<!-- Google Analytics -->
4242
{% if site.theme_settings.google_analytics %}
43+
<!-- Google tag (gtag.js) -->
44+
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.theme_settings.google_analytics }}"></script>
4345
<script>
44-
(function (i, s, o, g, r, a, m) {
45-
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
46-
(i[r].q = i[r].q || []).push(arguments)
47-
}, i[r].l = 1 * new Date(); a = s.createElement(o),
48-
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
49-
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
50-
51-
ga('create', '{{ site.theme_settings.google_analytics }}', 'auto');
52-
ga('send', 'pageview');
46+
window.dataLayer = window.dataLayer || [];
47+
function gtag(){dataLayer.push(arguments);}
48+
gtag('js', new Date());
49+
50+
gtag('config', '{{ site.theme_settings.google_analytics }}');
5351
</script>
5452
{% endif %}
5553
</head>

0 commit comments

Comments
 (0)