Skip to content

Commit 11e728b

Browse files
committed
Add support for Google Analytics 4
1 parent 74f244f commit 11e728b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

_includes/analytics.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,14 @@
99
ga('send', 'pageview');
1010
</script>
1111
{% endif %}
12+
{% if site.gtag %}
13+
<!-- Global site tag (gtag.js) - Google Analytics -->
14+
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.gtag }}"></script>
15+
<script>
16+
window.dataLayer = window.dataLayer || [];
17+
function gtag(){dataLayer.push(arguments);}
18+
gtag('js', new Date());
19+
20+
gtag('config', '{{ site.gtag }}');
21+
</script>
22+
{% endif %}

0 commit comments

Comments
 (0)