Skip to content

Commit 69479cf

Browse files
authored
docs: add analytics (#2183)
1 parent dd05486 commit 69479cf

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

apps/typegpu-docs/src/layouts/PageLayout.astro

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import '../fonts/font-face.css';
33
import '../tailwind.css';
44
import './loadingSpinner.css';
55
const { 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>

apps/typegpu-docs/src/pages/index.astro

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,11 @@ const showcaseVideoResolution = [2048, 1200];
334334
callToAction="Join our Discord server"
335335
href="https://discord.gg/8jpfgDqPcM"
336336
/>
337+
<FooterLink
338+
label="Privacy Policy"
339+
callToAction="Read our privacy policy"
340+
href="https://swmansion.com/privacy"
341+
/>
337342
</div>
338343
</div>
339344
</div>

0 commit comments

Comments
 (0)