1(function initGtm() { 2 var gtmMeta = document.querySelector('meta[name="gtm-id"]'); 3 var gtmId = gtmMeta ? gtmMeta.getAttribute("content") : ""; 4 5 if (!gtmId || !gtmId.trim()) { 6 return; 7 } 8 9 var dataLayer = (window.dataLayer = window.dataLayer || []); 10 11 dataLayer.push({ 12 event: "dataLayerInit", 13 originalLocation: 14 document.location.protocol + 15 "//" + 16 document.location.hostname + 17 document.location.pathname + 18 document.location.search, 19 }); 20 21 window.dataLayer = window.dataLayer || []; 22 window.dataLayer.push({ 23 "gtm.start": new Date().getTime(), 24 event: "gtm.js", 25 }); 26 27 var firstScript = document.getElementsByTagName("script")[0]; 28 var gtmScript = document.createElement("script"); 29 30 gtmScript.async = true; 31 gtmScript.src = 32 "https://www.googletagmanager.com/gtm.js?id=" + 33 encodeURIComponent(gtmId); 34 35 if (firstScript && firstScript.parentNode) { 36 firstScript.parentNode.insertBefore(gtmScript, firstScript); 37 return; 38 } 39 40 document.head.appendChild(gtmScript); 41})();
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.