1 2/////////////////////////////////////////////////////////////////////// 3/////////////////////////////////////////////////////////////////////// 4/** 5 * RWI-0751 [BW] 2025-11-25 6 * Cookie Consent Controls 7 * @link https://cookieconsent.orestbida.com/ 8 */ 9 10 11 12/** 13 * Update gtag consent according to the users choices made in CookieConsent UI 14 */ 15function updateGtagConsent() { 16 var analyticsGranted = CookieConsent.acceptedService(SERVICE_ANALYTICS_STORAGE, CAT_ANALYTICS); 17 gtag('consent', 'update', { 18 [SERVICE_ANALYTICS_STORAGE]: analyticsGranted ? 'granted' : 'denied', 19 [SERVICE_FUNCTIONALITY_STORAGE]: CookieConsent.acceptedService(SERVICE_FUNCTIONALITY_STORAGE, CAT_FUNCTIONALITY) ? 'granted' : 'denied', 20 [SERVICE_PERSONALIZATION_STORAGE]: CookieConsent.acceptedService(SERVICE_PERSONALIZATION_STORAGE, CAT_FUNCTIONALITY) ? 'granted' : 'denied', 21 // [SERVICE_SECURITY_STORAGE]: CookieConsent.acceptedService(SERVICE_SECURITY_STORAGE, CAT_SECURITY) ? 'granted' : 'denied', // grouped with strictly necessary cookies 22 }); 23 24 // Fire an immediate page_view after analytics consent is granted so GA realtime reflects activity right away. 25 if (analyticsGranted) { 26 gtag('event', 'page_view'); 27 } 28} 29 30/** 31 * All config. options available here: 32 * https://cookieconsent.orestbida.com/reference/configuration-reference.html 33 */ 34var cookieConsentConfigDefault = { 35 guiOptions: { 36 consentModal: { 37 layout: "bar", 38 position: "bottom", 39 equalWeightButtons: false, 40 flipButtons: true 41 }, 42 preferencesModal: { 43 layout: "box", 44 position: "right", 45 equalWeightButtons: false, 46 flipButtons: true 47 } 48 }, 49 50 // Trigger consent update when user choices change 51 onFirstConsent: () => { 52 updateGtagConsent(); 53 }, 54 onConsent: () => { 55 updateGtagConsent(); 56 }, 57 onChange: () => { 58 updateGtagConsent(); 59 }, 60 61 categories: { 62 [CAT_NECESSARY]: { 63 enabled: true, // this category is enabled by default 64 readOnly: true, // this category cannot be disabled 65 }, 66 [CAT_ANALYTICS]: { 67 enabled: true, 68 autoClear: { 69 cookies: [ 70 { 71 name: /^_ga/, // regex: match all cookies starting with '_ga' 72 }, 73 { 74 name: '_gid', // string: exact cookie name 75 } 76 ] 77 }, 78 // See: https://cookieconsent.orestbida.com/reference/configuration-reference.html#category-services 79 services: { 80 [SERVICE_ANALYTICS_STORAGE]: { 81 label: 'Enables storage (such as cookies) related to analytics e.g. visit duration.', 82 } 83 } 84 }, 85 [CAT_FUNCTIONALITY]: { 86 enabled: true, 87 services: { 88 [SERVICE_FUNCTIONALITY_STORAGE]: { 89 label: 'Enables storage that supports the functionality of the website or app e.g. language settings.', 90 }, 91 [SERVICE_PERSONALIZATION_STORAGE]: { 92 label: 'Enables storage related to personalization e.g. video recommendations.', 93 }, 94 } 95 } 96 }, 97 98 language: { 99 default: 'en', 100 translations: { 101 en: { 102 consentModal: { 103 title: 'This site uses cookies', 104 description: 'This website uses cookies necessary to ensure proper function and provide security, plus additional cookies for tracking and analytics. Additional cookies are not set unless you agree.', 105 acceptAllBtn: 'Accept all', 106 acceptNecessaryBtn: 'Reject all', 107 showPreferencesBtn: 'Manage Individual preferences' 108 }, 109 preferencesModal: { 110 title: 'Manage cookie preferences', 111 acceptAllBtn: 'Accept all',
112 acceptNecessaryBtn: 'Reject all', 113 savePreferencesBtn: 'Accept current selection', 114 closeIconLabel: 'Close modal', 115 sections: [ 116 { 117 title: "Cookie usage", 118 description: "This website uses cookies necessary to ensure proper function and provide security, plus additional cookies for tracking and analytics." 119 }, 120 { 121 title: "Strictly necessary cookies", 122 description: "These cookies are essential for the proper functioning of the website, as well as for security to authenticate users, prevent fraud, and protect users as they interact with a service.", 123 linkedCategory: CAT_NECESSARY, 124 }, 125 { 126 title: "Analytics", 127 description: 'Cookies used for analytics help collect data that allows services to understand how users interact with a particular service. The
127se insights allow services both to improve content and to build better features that improve the userâs experience.', 128 linkedCategory: CAT_ANALYTICS 129 }, 130 { 131 title: 'Functionality', 132 description: 'Cookies used for functionality allow users to interact with a service or site to access features that are fundamental to that service. Things considered fundamental to the service include preferences like the userâs choice of language, product optimizations that help maintain and improve a service, and maintaining information relating to a userâs session, such as the content of a shopping cart.', 133 linkedCategory: CAT_FUNCTIONALITY, 134 }, 135 { 136 title: 'More information', 137 description: 'For more information about cookies and your choices, please review our <a href="/privacy.html">privacy policy</a>.' 138 } 139 ] 140 } 141 } 142 } 143 } 144}; 145 146// cookieConsentConfig could be handed to us from the parent page, let's merge it with the default config 147// Merge cookieConsentConfig, if present, on top of the default config 148var cookieConsentConfigFinal; 149if (typeof cookieConsentConfig === 'object' && cookieConsentConfig !== null) { 150 // Deep merge helper 151 function deepMerge(target, source) { 152 for (var key in source) { 153 if ( 154 source.hasOwnProperty(key) && 155 source[key] !== null && 156 typeof source[key] === 'object' && 157 !Array.isArray(source[key]) && 158 !(source[key] instanceof RegExp) && 159 !(source[key] instanceof Date) 160 ) { 161 if (!target[key] || typeof target[key] !== 'object' || Array.isArray(target[key])) { 162 target[key] = {}; 163 } 164 deepMerge(target[key], source[key]); 165 } else { 166 target[key] = source[key]; 167 } 168 } 169 return target; 170 } 171 cookieConsentConfigFinal = deepMerge( 172 deepMerge({}, window._defaultCookieConsentConfig || cookieConsentConfigDefault || { 173 language: { 174 default: 'en', 175 translations: {/* fallback */} 176 } 177 }), 178 cookieConsentConfig 179 ); 180} else { 181 // Default 182 cookieConsentConfigFinal = window._defaultCookieConsentConfig || cookieConsentConfigDefault || cookieConsentConfig; 183} 184 185 186console.log('Running CookieConsent', cookieConsentConfigFinal); 187CookieConsent.run(cookieConsentConfigFinal); 188 189 190
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.