function readCookieConsent() { const name = "cookiespool_consent"; const ca = document.cookie.split(";"); for (let i = 0; i < ca.length; i++) { const c = ca[i].trim(); if (c.indexOf(name) == 0) { return JSON.parse(c.substring(name.length + 1, c.length)); } } return null; } function createCookiespoolObject() { if (document.getElementById("cookiespool-modal-container") !== null && document.getElementById("cookiespool-modal-container") !== undefined) { window.cookieSpool.openSettings(); } else { setTimeout(() => { cookiespoolBannerPopupInitiate(); }, 300); } } function cookiespoolBannerPopupInitiate() { window.cookieSpool = new CookieSpool({ tenantId: "3956d019-b9c0-4be7-ae94-aa46b6115162", siteId: "9b03623d-6f3d-4d29-9d84-07f8a6d0ce62", language: document.documentElement.lang, enableClose: false, onChangeSettings: consent => { triggerGTMTagSettings(consent); // GTM Settings gtag({"event": "Pageview"}); // GTM Pageview } }); } // GTM update consent entegrasyon fonksiyonu function triggerGTMTagSettings(parConsent) { gtag("consent", "update", { "ad_storage": parConsent.choices.marketing ? "granted": "denied", "analytics_storage": parConsent.choices.performance ? "granted" : "denied", "functionality_storage": parConsent.choices.functional ? "granted" : "denied", "personalization_storage": parConsent.choices.functional ? "granted" : "denied", "wait_for_update": 2000 // milliseconds to wait for update }); gtag("event", "cookiespool_consent_update"); } window.dataLayer = window.dataLayer || []; function gtag() { dataLayer.push(arguments); } const consent = readCookieConsent(); if (consent !== null && consent.userId !== null) { triggerGTMTagSettings(consent); // GTM Settings } createCookiespoolObject();