1// Site-owned Google Consent Mode contract. This synchronous script must precede GTM. 2(function (window, document) { 3 'use strict'; 4 if (window.TalkableConsent && window.TalkableConsent.__bootstrapVersion) return; 5 6 var COOKIE_NAME = 'tk_consent'; 7 var DENIED = { 8 analytics_storage: 'denied', 9 ad_storage: 'denied', 10 ad_user_data: 'denied', 11 ad_personalization: 'denied' 12 }; 13 14 window.dataLayer = window.dataLayer || []; 15 window.gtag = window.gtag || function () { window.dataLayer.push(arguments); }; 16 window.gtag('consent', 'default', DENIED); 17 18 function readConsent() { 19 var match = document.cookie.match(new RegExp('(^| )' + COOKIE_NAME + '=([^;]+)')); 20 if (!match) return null; 21 try { return JSON.parse(decodeURIComponent(match[2])); } catch (error) { return null; } 22 } 23 24 function resolve(analyticsGranted, source, emitEvent) { 25 var analyticsState = analyticsGranted === true ? 'granted' : 'denied'; 26 // Consent UI can be invoked more than once. Emit the public event and 27 // Google update once per actual state transition, including first denial. 28 if (api.__hasResolved && api.analyticsStorage === analyticsState) return; 29 window.gtag('consent', 'update', { 30 analytics_storage: analyticsState, 31 ad_storage: 'denied', 32 ad_user_data: 'denied', 33 ad_personalization: 'denied' 34 }); 35 api.analyticsStorage = analyticsState; 36 api.__hasResolved = true; 37 if (emitEvent !== false) { 38 window.dataLayer.push({ 39 event: 'talkable_consent_resolved', 40 talkable_analytics_consent: analyticsState, 41 talkable_consent_source: source === 'stored_preference' ? 'stored_preference' : 'cmp_choice' 42 }); 43 } 44 } 45 46 var api = window.TalkableConsent = window.TalkableConsent || {}; 47 api.__bootstrapVersion = 1; 48 api.__hasResolved = false; 49 api.analyticsStorage = 'denied'; 50 api.resolve = resolve; 51 52 var saved = readConsent(); 53 if (saved && typeof saved.analytics === 'boolean') { 54 resolve(saved.analytics, 'stored_preference'); 55 } 56})(window, document);
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.