File size: 2,331 Bytes
11dbfc8
1c8195c
11dbfc8
 
 
1c8195c
229d4b4
3e3029f
 
 
 
 
 
 
184689c
 
 
b3563cb
3e3029f
11dbfc8
 
b2387f6
1c8195c
572bb0e
 
 
184689c
572bb0e
184689c
572bb0e
 
 
 
 
 
 
 
 
184689c
572bb0e
 
 
 
 
b3563cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11dbfc8
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!DOCTYPE html>
<html lang="en" class="h-full">
	<head>
		<meta charset="utf-8" />
		<link rel="icon" href="%sveltekit.assets%/favicon.png" />
		<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
		<title>HuggingChat</title>
		<script>
			if (
				localStorage.theme === "dark" ||
				(!("theme" in localStorage) && window.matchMedia("(prefers-color-scheme: dark)").matches)
			) {
				document.documentElement.classList.add("dark");
			}

			// For some reason, Sveltekit doesn't let us load env variables from .env here, so we load it from hooks.server.ts
			window.gaId = "%gaId%";
			window.gaIdDeprecated = "%gaIdDeprecated%";
		</script>
		%sveltekit.head%
	</head>
	<body data-sveltekit-preload-data="hover" class="h-full dark:bg-gray-900">
		<div class="contents h-full">%sveltekit.body%</div>

		<!-- Google Tag Manager -->
		<script>
			if (window.gaId) {
				const script = document.createElement("script");
				script.src = "https://www.googletagmanager.com/gtag/js?id=" + window.gaId;
				script.async = true;
				document.head.appendChild(script);

				window.dataLayer = window.dataLayer || [];
				function gtag() {
					dataLayer.push(arguments);
				}
				gtag("js", new Date());
				/// ^ See https://developers.google.com/tag-platform/gtagjs/install
				gtag("config", window.gaId);
				gtag("consent", "default", { ad_storage: "denied", analytics_storage: "denied" });
				/// ^ See https://developers.google.com/tag-platform/gtagjs/reference#consent
				/// TODO: ask the user for their consent and update this with gtag('consent', 'update')
			}
		</script>

		<!-- Google Analytics v3 (deprecated on 1 July 2023) -->
		<script>
			if (window.gaIdDeprecated) {
				(function (i, s, o, g, r, a, m) {
					i["GoogleAnalyticsObject"] = r;
					(i[r] =
						i[r] ||
						function () {
							(i[r].q = i[r].q || []).push(arguments);
						}),
						(i[r].l = 1 * new Date());
					(a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]);
					a.async = 1;
					a.src = g;
					m.parentNode.insertBefore(a, m);
				})(
					window,
					document,
					"script",
					"https://www.google-analytics.com/analytics.js",
					"ganalytics"
				);
				ganalytics("create", window.gaIdDeprecated, "auto");
				ganalytics("send", "pageview");
			}
		</script>
	</body>
</html>