Skip to content

Commit 8e1f56e

Browse files
added Google Tag Manager
1 parent a862fa6 commit 8e1f56e

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

src/layouts/Layout.astro

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ const structuredData = {
5858
>
5959
<head>
6060
<!-- Google tag (gtag.js) -->
61-
<script is:inline src="https://www.googletagmanager.com/gtag/js?id=G-ZXC7NG6S55"></script>
61+
<script
62+
is:inline
63+
src="https://www.googletagmanager.com/gtag/js?id=G-ZXC7NG6S55"></script>
6264
<script is:inline>
6365
window.dataLayer = window.dataLayer || [];
6466
function gtag() {
@@ -67,6 +69,20 @@ const structuredData = {
6769
gtag("js", new Date());
6870
gtag("config", "G-ZXC7NG6S55");
6971
</script>
72+
<!-- Google Tag Manager -->
73+
<script is:inline>
74+
(function (w, d, s, l, i) {
75+
w[l] = w[l] || [];
76+
w[l].push({ "gtm.start": new Date().getTime(), event: "gtm.js" });
77+
var f = d.getElementsByTagName(s)[0],
78+
j = d.createElement(s),
79+
dl = l != "dataLayer" ? "&l=" + l : "";
80+
j.async = true;
81+
j.src = "https://www.googletagmanager.com/gtm.js?id=" + i + dl;
82+
f.parentNode.insertBefore(j, f);
83+
})(window, document, "script", "dataLayer", "GTM-MMG7M2PS");
84+
</script>
85+
<!-- End Google Tag Manager -->
7086
<meta charset="UTF-8" />
7187
<meta name="viewport" content="width=device-width" />
7288
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
@@ -151,6 +167,15 @@ const structuredData = {
151167
</head>
152168

153169
<body>
170+
<!-- Google Tag Manager (noscript) -->
171+
<noscript
172+
><iframe
173+
src="https://www.googletagmanager.com/ns.html?id=GTM-MMG7M2PS"
174+
height="0"
175+
width="0"
176+
style="display:none;visibility:hidden"></iframe></noscript
177+
>
178+
<!-- End Google Tag Manager (noscript) -->
154179
<slot />
155180
</body>
156181
</html>

0 commit comments

Comments
 (0)