1(function ($) { 2 $(document).on("consentUpdated.ctUltimateGdpr", function (event, level, level_ids) { 3 let consent = {}; 4 5 function applyConsent1(level) { 6 switch (level) { 7 case '2': 8 consent.necessary = true; 9 break; 10 case '3': 11 consent.necessary = true; 12 consent.functional = true; 13 break; 14 case '4': 15 consent.necessary = true; 16 consent.functional = true; 17 consent.analytics = true; 18 break; 19 case '5': 20 consent.necessary = true; 21 consent.functional = true; 22 consent.analytics = true; 23 consent.marketing = true; 24 break; 25 } 26 } 27 28 function applyConsent2(level) { 29 // Block each cookie group individually 30 switch (level) { 31 case '5': 32 consent.necessary = true; 33 break; 34 case '6': 35 consent.functional = true; 36 break; 37 case '7': 38 consent.analytics = true; 39 break; 40 case '8': 41 consent.marketing = true; 42 break; 43 } 44 } 45 46 function ctSetGConsentMode(consent) { 47 // Define consent mode states based on user consent 48 const consentModeStates = { 49 'ad_storage': consent.marketing ? 'granted' : 'denied', 50 'analytics_storage': consent.analytics ? 'granted' : 'denied', 51 'functionality_storage': consent.functional ? 'granted' : 'denied', 52 'personalization_storage': consent.functional ? 'granted' : 'denied', 53 'security_storage': consent.necessary ? 'granted' : 'denied', 54 'ad_user_data': consent.marketing ? 'granted' : 'denied', 55 'ad_personalization': consent.marketing ? 'granted' : 'denied' 56 }; 57 58 if (typeof gtag === 'function') { 59 // Fallback to using gtag for consent update if GTM API is not available 60 gtag('consent', 'update', consentModeStates); 61 } 62 63 // Store consent mode in localStorage for persistence 64 localStorage.setItem('consentMode', JSON.stringify(consentModeStates)); 65 } 66 67 if (level) { 68 applyConsent1(level); 69 } 70 71 // If level_ids array is provided, iterate through each id and apply consent 72 if (level_ids) { 73 level_ids.forEach(function (level_id) { 74 applyConsent2(level_id); 75 }); 76 } 77 78 ctSetGConsentMode(consent); 79 }); 80})(jQuery);
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.