1/* 2 * Script to enable Google Analytics for this website. 3 */ 4const GA_MEASUREMENT_ID = "G-4TNGT8TGMK"; 5const EU_COUNTRIES = ["AT", "BE", "BG", "HR", "CY", "CZ", "DK", "EE", "FI", "FR", "DE", "GR", "HU", "IE", "IT", "LV", "LT", "LU", "MT", "NL", "PL", "PT", "RO", "SK", "SI", "ES", "SE"]; 6 7// Set up dataLayer and gtag immediately â the script tag in <head> is already loading 8window.dataLayer = window.dataLayer || []; 9function gtag() { dataLayer.push(arguments); } 10gtag("js", new Date()); 11gtag("config", GA_MEASUREMENT_ID); 12 13$(document).ready(function () { 14 15 $.get("https://ipapi.co/json/", function (data) { 16 let userCountry = data.country_code; 17 let consent = localStorage.getItem("ga_consent"); 18 19 if (EU_COUNTRIES.includes(userCountry)) { 20 if (consent === "granted") { 21 // Already consented â nothing to do, GA is already running 22 } else if (consent === null) { 23 // First visit â show banner 24 $("#cookiebanner").addClass("show"); 25 } 26 // consent === "denied": GA should not run â disable it 27 if (consent !== "granted") { 28 gtag("consent", "update", { analytics_storage: "denied" }); 29 } 30 } 31 // Non-EU: GA runs without consent, no banner 32 33 // Accept 34 $("#acceptcookies").off("click").on("click", function () { 35 localStorage.setItem("ga_consent", "granted"); 36 $("#cookiebanner").removeClass("show"); 37 gtag("consent", "update", { analytics_storage: "granted" }); 38 }); 39 40 // Decline 41 $("#rejectcookies").off("click").on("click", function () { 42 localStorage.setItem("ga_consent", "denied"); 43 $("#cookiebanner").removeClass("show"); 44 gtag("consent", "update", { analytics_storage: "denied" }); 45 }); 46 }); 47 48});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.