1const dl = drupalSettings.gtm ? drupalSettings.gtm.settings.data_layer : 'dataLayer'; 2window[dl] = window[dl] || []; 3 4(function (drupalSettings) { 5 if (!drupalSettings.gtm) {return;} 6 function init() { 7 const config = drupalSettings.gtm; 8 9 window[dl].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' }); 10 const gtmSettings = config.settings; 11 if (gtmSettings.include_classes === true) { 12 window[dl].push({ 13 'gtm.allowlist': gtmSettings.allowlist_classes ?? [], 14 'gtm.blocklist': gtmSettings.blocklist_classes ?? [], 15 }); 16 } 17 18 let gtm_environment = ''; 19 if (gtmSettings.include_environment === true) { 20 const gtm_auth = gtmSettings.environment_token ?? ''; 21 const gtm_preview = gtmSettings.environment_id ?? ''; 22 gtm_environment = `>m_auth=${gtm_auth}>m_preview=${gtm_preview}>m_cookies_win=x`; 23 } 24 config.tagIds.forEach(function (tagId) { 25 const script = document.createElement('script'); 26 script.async = true; 27 const dLink = dl != 'dataLayer' ? `&l=${dl}` : ''; 28 script.src = `https://www.googletagmanager.com/gtm.js?id=${tagId}${gtm_environment}${dLink}`; 29 script.type = 'text/javascript'; 30 document.getElementsByTagName('head')[0].appendChild(script); 31 }); 32 } 33 34 if (window.waitRedirection) { 35 document.body.addEventListener('redirected', () => { 36 init(); 37 }); 38 } else { 39 init(); 40 } 41})(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.