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