Skip to content

Commit 5724b31

Browse files
authored
💄 style(html): update Google Tag Manager implementation (#2768)
- replace Google Analytics script with Google Tag Manager script - add noscript tag for non-JS environments to improve tracking accuracy
2 parents 3a5ca67 + cc76842 commit 5724b31

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

docs/_layouts/default.html

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,11 @@
33
<head>
44
<meta charset="utf-8">
55
<!-- Google Tag Manager -->
6-
<!-- Google tag (gtag.js) -->
7-
<script async src="https://www.googletagmanager.com/gtag/js?id=G-44XG57BE28"></script>
8-
<script>
9-
window.dataLayer = window.dataLayer || [];
10-
function gtag(){dataLayer.push(arguments);}
11-
gtag('js', new Date());
12-
13-
gtag('config', 'G-44XG57BE28');
14-
</script>
6+
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
7+
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
8+
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
9+
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
10+
})(window,document,'script','dataLayer','GTM-TZT4HG96');</script>
1511
<!-- End Google Tag Manager -->
1612
{% seo %}
1713
<link rel="canonical" href="{{site.cannonicalBase}}{{page.url}}" />
@@ -23,6 +19,9 @@
2319
<link href="{{site.baseurl}}/assets/css/base16.css" rel="stylesheet" />
2420
</head>
2521
<body>
22+
<!-- Google Tag Manager (noscript) -->
23+
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-TZT4HG96"
24+
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
2625
<!-- End Google Tag Manager (noscript) -->
2726
{%- include header.html -%}
2827
<div class="mainContainer">

0 commit comments

Comments
 (0)