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