@@ -3,6 +3,9 @@ import '../fonts/font-face.css';
33import ' ../tailwind.css' ;
44import ' ./loadingSpinner.css' ;
55const { title, theme = ' light' } = Astro .props ;
6+
7+ const DEV = (import .meta as any ).env .DEV ;
8+ const enableAnalytics = ! DEV ;
69---
710
811<html data-theme ={ theme } >
@@ -73,8 +76,45 @@ const { title, theme = 'light' } = Astro.props;
7376 border: none;
7477 }
7578 </style >
79+
80+ <!-- Google Tag Manager -->
81+ {
82+ enableAnalytics && (
83+ <script
84+ is :inline
85+ set :html = { `
86+ (function (w, d, s, l, i) {
87+ w[l] = w[l] || [];
88+ w[l].push({ "gtm.start": new Date().getTime(), event: "gtm.js" });
89+ var f = d.getElementsByTagName(s)[0],
90+ j = d.createElement(s),
91+ dl = l != "dataLayer" ? "&l=" + l : "";
92+ j.async = true;
93+ j.src = "https://www.googletagmanager.com/gtm.js?id=" + i + dl;
94+ f.parentNode.insertBefore(j, f);
95+ })(window, document, "script", "dataLayer", "GTM-T69W3PKG");
96+ ` }
97+ />
98+ )
99+ }
100+ <!-- End Google Tag Manager -->
76101 </head >
77102 <body >
103+ <!-- Google Tag Manager (noscript) -->
104+ {
105+ enableAnalytics && (
106+ <noscript >
107+ <iframe
108+ src = " https://www.googletagmanager.com/ns.html?id=GTM-TFGF383S"
109+ height = " 0"
110+ width = " 0"
111+ style = " display:none;visibility:hidden"
112+ />
113+ </noscript >
114+ )
115+ }
116+ <!-- End Google Tag Manager (noscript) -->
117+
78118 <slot />
79119 </body >
80120</html >
0 commit comments