1// eslint-disable-next-line import/no-cycle 2import { sampleRUM, isInternalPage } from './lib-franklin.js'; 3// eslint-disable-next-line import/no-cycle 4import { getEnvType, loadConsentManager, loadScript } from './scripts.js'; 5 6// Core Web Vitals RUM collection 7sampleRUM('cwv'); 8 9async function loadAdobeLaunch() { 10 const adobeotmSrc = { 11 dev: 'https://assets.adobedtm.com/467469cdd595/f9651373cafd/launch-a46d93f0c752-development.min.js', 12 preview: 'https://assets.adobedtm.com/467469cdd595/f9651373cafd/launch-8108dcbd2d02-staging.min.js', 13 live: 'https://assets.adobedtm.com/467469cdd595/f9651373cafd/launch-9e812df82057.min.js', 14 }; 15 await loadScript(adobeotmSrc[getEnvType()]); 16} 17 18window.addEventListener('consentmanager', () => { 19 if (window.uc) { 20 // unblock adobe launch 21 window.uc?.deactivateBlocking(['f6nkjdUL']); 22 } 23}); 24 25/** 26 * Google Tag Manager 27* */ 28async function loadGTM() { 29 const scriptTag = document.createElement('script'); 30 scriptTag.innerHTML = ` 31 (function (w, d, s, l, i) { 32 w[l] = w[l] || []; 33 w[l].push({ 34 'gtm.start': 35 new Date().getTime(), event: 'gtm.js' 36 }); 37 var f = d.getElementsByTagName(s)[0], 38 j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; 39 j.async = true; 40 j.src = 41 'https://www.googletagmanager.com/gtm.js?id=' + i + dl; 42 f.parentNode.insertBefore(j, f); 43 }(window, document, 'script', 'dataLayer', 'GTM-TZS45SW')); 44 `; 45 document.head.prepend(scriptTag); 46} 47 48function loadGAScript(url, callback) { 49 const head = document.querySelector('head'); 50 let script = head.querySelector(`script[src="${url}"]`); 51 if (!script) { 52 script = document.createElement('script'); 53 script.src = url; 54 script.async = true; 55 head.append(script); 56 script.onload = callback; 57 return script; 58 } 59 return script; 60} 61 62async function loadGA() { 63 const gaId = 'UA-150288508-1'; 64 loadGAScript(`https://www.googletagmanager.com/gtag/js?id=${gaId}`, () => { 65 // eslint-disable-next-line 66 window.dataLayer = window.dataLayer || []; function gtag() { dataLayer.push(arguments); } gtag('js', new Date()); gtag('config', gaId); ga('send', 'pageview'); ga('create', gaId, 'auto'); 67 }); 68} 69 70if (!isInternalPage()) { 71 await loadConsentManager(); 72 await loadAdobeLaunch(); 73 if (getEnvType() === 'live') { 74 await loadGTM(); 75 await loadGA(); 76 } 77}
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.