Skip to content
This repository was archived by the owner on Nov 13, 2024. It is now read-only.

Commit 92cdedd

Browse files
committed
#1: Update Google Analytics script
1 parent 777ddfb commit 92cdedd

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

theme/main.html

+6-13
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,14 @@
2020
{%- endfor %}
2121

2222
{% if config.google_analytics %}
23+
<!-- Global site tag (gtag.js) - Google Analytics -->
24+
<script async src="https://www.googletagmanager.com/gtag/js?id={{ config.google_analytics[0] }}"></script>
2325
<script>
24-
(function(i, s, o, g, r, a, m) {
25-
i['GoogleAnalyticsObject'] = r;
26-
i[r] = i[r] || function() {
27-
(i[r].q = i[r].q || []).push(arguments)
28-
}, i[r].l = 1 * new Date();
29-
a = s.createElement(o),
30-
m = s.getElementsByTagName(o)[0];
31-
a.async = 1;
32-
a.src = g;
33-
m.parentNode.insertBefore(a, m)
34-
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
26+
window.dataLayer = window.dataLayer || [];
27+
function gtag(){dataLayer.push(arguments);}
28+
gtag('js', new Date());
3529

36-
ga('create', '{{ config.google_analytics[0] }}', '{{ config.google_analytics[1] }}');
37-
ga('send', 'pageview');
30+
gtag('config', '{{ config.google_analytics[0] }}');
3831
</script>
3932
{% endif %}
4033
</head>

0 commit comments

Comments
 (0)