1const dl = drupalSettings.gtm.settings.data_layer || 'dataLayer' 2window[dl] = window[dl] || []; 3 4(function (drupalSettings) { 5 const config = drupalSettings.gtm; 6 7 window[dl].push({'gtm.start': new Date().getTime(), event:'gtm.js'}); 8 const gtmSettings = config.settings; 9 if (gtmSettings.include_classes === true) { 10 window[dl].push({ 11 'gtm.allowlist': gtmSettings.allowlist_classes ?? [], 12 'gtm.blocklist': gtmSettings.blocklist_classes ?? [], 13 }); 14 } 15 16 let gtm_environment = ''; 17 if (gtmSettings.include_environment === true) { 18 const gtm_auth = gtmSettings.environment_token ?? ''; 19 const gtm_preview = gtmSettings.environment_id ?? ''; 20 gtm_environment = '>m_auth=' + gtm_auth + '>m_preview=' + gtm_preview + '>m_cookies_win=x'; 21 } 22 config.tagIds.forEach(function(tagId) { 23 const script = document.createElement('script') 24 script.async = true; 25 const dLink = dl!='dataLayer'?'&l='+dl:''; 26 const hostname = (config.hostnames[tagId] || 'www.googletagmanager.com'); 27 script.src = `https://${hostname}/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.