This commit is contained in:
parent
2390166452
commit
2fcd802260
@ -62,8 +62,51 @@
|
|||||||
location.subscribe((l) => {
|
location.subscribe((l) => {
|
||||||
if (l.push) scrollTo({ top: 0 })
|
if (l.push) scrollTo({ top: 0 })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
let cookiesAllowed = false
|
||||||
|
window.addEventListener("ccAccept", (e) => {
|
||||||
|
// @ts-ignore
|
||||||
|
if (e.detail[1] == cookieName) cookiesAllowed = true
|
||||||
|
})
|
||||||
|
//isCookieSet isnt really precise
|
||||||
|
function checkCookie(cookieName: string) {
|
||||||
|
// Get all cookies
|
||||||
|
var allCookies = decodeURIComponent(document.cookie)
|
||||||
|
// Split into individual cookies
|
||||||
|
var cookies = allCookies.split(";")
|
||||||
|
var ccTagCookies: string[] = []
|
||||||
|
cookies.forEach((e) => {
|
||||||
|
e.includes("ccTags") ? (ccTagCookies = e.split(",")) : void 0
|
||||||
|
})
|
||||||
|
for (var i = 0; i < ccTagCookies.length; i++) {
|
||||||
|
var c = ccTagCookies[i]
|
||||||
|
// Trim whitespace
|
||||||
|
while (c.charAt(0) == " ") c = c.substring(1)
|
||||||
|
// If the cookie's name matches the given name
|
||||||
|
if (c == cookieName) return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
cookiesAllowed = checkCookie("googleAnalytics")
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<svelte:head>
|
||||||
|
{#if cookiesAllowed}
|
||||||
|
<!-- Google tag (gtag.js) -->
|
||||||
|
<!-- Google tag (gtag.js) -->
|
||||||
|
<script async src="https://www.googletagmanager.com/gtag/js?id=G-F384Z2JF20"></script>
|
||||||
|
<script>
|
||||||
|
window.dataLayer = window.dataLayer || []
|
||||||
|
function gtag() {
|
||||||
|
dataLayer.push(arguments)
|
||||||
|
}
|
||||||
|
gtag("js", new Date())
|
||||||
|
|
||||||
|
gtag("config", "G-F384Z2JF20")
|
||||||
|
</script>
|
||||||
|
{/if}
|
||||||
|
</svelte:head>
|
||||||
|
|
||||||
<main class="">
|
<main class="">
|
||||||
<Header />
|
<Header />
|
||||||
<div class="content-container" id="siteContainer">
|
<div class="content-container" id="siteContainer">
|
||||||
|
Loading…
Reference in New Issue
Block a user