1let consentController; 2 3const Consent = class Consent { 4 userConsent; 5 6 dataLayerPolicies = { 7 measurement_cookies: "analytics_storage", 8 targeting_cookies: "ad_storage", 9 experience_cookies: "personalization_storage", 10 }; 11 12 constructor(consent) { 13 consentController = this; 14 consentController.userConsent = consent ?? []; 15 16 17 } 18 19 refreshGTMConsent(isConsentUpdate) { 20 consentController.pushDataLayerEvent( 21 consentController.gatherGTMConsent(), 22 isConsentUpdate 23 ); 24 } 25 26 pushDataLayerEvent(consent, isConsentUpdate) { 27 const dataLayer = window.top.dataLayer || []; 28 29 if (isConsentUpdate) { 30 consent.event = "consent.update"; 31 dataLayer.push(consent); 32 } 33 34 //console.log("CONSENTS: ", consent); 35 36 window.top.dataLayer = dataLayer; 37 } 38 39 gatherGTMConsent() { 40 let dataLayerConsent = {}; 41 42 for (const policyName in consentController.dataLayerPolicies) { 43 dataLayerConsent[ 44 consentController.dataLayerPolicies[policyName] 45 ] = policyName in consentController.userConsent && 46 consentController.userConsent[policyName] 47 ? "granted" 48 : "denied"; 49 } 50 //console.log(dataLayerConsent); 51 return dataLayerConsent; 52 } 53};
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.