(function () { // ===== HEAD INJECTION ===== const head = document.querySelector("head"); if (!head) return; // 1. Consent + gtag script (inline) const consentScript = document.createElement("script"); consentScript.innerHTML = ` window.dataLayer = window.dataLayer || []; function gtag() { dataLayer.push(arguments); } gtag("consent", "default", { ad_storage: "denied", ad_user_data: "denied", ad_personalization: "denied", analytics_storage: "denied", functionality_storage: "denied", personalization_storage: "denied", security_storage: "granted", wait_for_update: 2000, }); gtag("set", "ads_data_redaction", false); gtag("set", "url_passthrough", true); `; // 2. CookieYes script (external) const cookieYesScript = document.createElement("script"); cookieYesScript.id = "cookieyes"; cookieYesScript.type = "text/javascript"; cookieYesScript.src = "https://cdn-cookieyes.com/client_data/5cc8da229695a74aa267a2862a61baac/script.js"; // 3. Google Tag Manager (inline loader) const gtmScript = document.createElement("script"); gtmScript.innerHTML = ` (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-WW669H'); `; // Append in order head.appendChild(consentScript); head.appendChild(cookieYesScript); head.appendChild(gtmScript); // ===== BODY (noscript) INJECTION ===== const insertNoScript = function () { const body = document.body; if (!body) return; const noScript = document.createElement("noscript"); noScript.innerHTML = ` `; // Insert as FIRST thing in body if (body.firstChild) { body.insertBefore(noScript, body.firstChild); } else { body.appendChild(noScript); } }; // Ensure body exists before inserting if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", insertNoScript); } else { insertNoScript(); } })();