1window.dataLayer = window.dataLayer || []; 2function gtag() { 3 dataLayer.push(arguments); 4} 5gtag('js', new Date()); 6// Drupal's global gtag ID. For more info: https://developers.google.com/tag-platform/devguides/gtag-integration 7gtag('set', 'developer_id.dMDhkMT', true); 8 9(function (drupalSettings) { 10 if (!drupalSettings.gtag) {return;} 11 const config = drupalSettings.gtag; 12 13 // Append a <script> to <head>, but wait for the configured Didomi vendor 14 // to be consented first. With no vendor configured, append directly. 15 function appendWhenConsented(script, vendorId) { 16 function append() { 17 document.getElementsByTagName('head')[0].appendChild(script); 18 } 19 if (!vendorId) { append(); return; } 20 var appended = false; 21 function attempt() { 22 if (appended) return true; 23 if (window.Didomi && 24 typeof window.Didomi.getUserConsentStatusForVendor === 'function' && 25 window.Didomi.getUserConsentStatusForVendor(vendorId) === true) { 26 appended = true; 27 append(); 28 return true; 29 } 30 return false; 31 } 32 window.didomiOnReady = window.didomiOnReady || []; 33 window.didomiOnReady.push(function () { 34 if (attempt()) return; 35 var method = (window.Didomi && typeof window.Didomi.on === 'function') ? 'on' 36 : ((window.Didomi && typeof window.Didomi.addEventListener === 'function') ? 'addEventListener' : null); 37 if (method) { window.Didomi[method]('consent.changed', attempt); } 38 }); 39 } 40 41 if (config.consentMode === true) { 42 gtag('consent', 'default', { 43 ad_storage: 'denied', 44 analytics_storage: 'denied', 45 ad_user_data: 'denied', 46 ad_personalization: 'denied', 47 wait_for_update: 500, 48 }); 49 } 50 51 if (config.tagId.length !== 0) { 52 const script = document.createElement('script'); 53 script.async = true; 54 script.src = `https://www.googletagmanager.com/gtag/js?id=${config.tagId}`; 55 script.type = 'text/javascript'; 56 appendWhenConsented(script, drupalSettings.svg_theme_components_cp_didomi?.gtm_didomi_vend
56or_id); 57 } 58 59 const additionalConfigInfo = config.additionalConfigInfo || []; 60 if (additionalConfigInfo.length === 0) { 61 gtag('config', config.tagId); 62 } else { 63 gtag('config', config.tagId, additionalConfigInfo); 64 } 65 66 const otherIds = config.otherIds || []; 67 otherIds.forEach((id) => gtag('config', id)); 68 69 const events = config.events || []; 70 events.forEach((event) => gtag('event', event.name, event.data)); 71})(drupalSettings);
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.