chat-ui / src /app.html
Adrien Denat
πŸ“ˆ Add GTM (#119)
572bb0e unverified
raw
history blame
1.46 kB
<!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");
}
</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 (["hf.co", "huggingface.co"].includes(window.location.hostname)) {
const script = document.createElement("script");
script.src = "https://www.googletagmanager.com/gtag/js?id=G-8Q63TH4CSL";
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("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>
</body>
</html>