1function astraCtaDL() { 2 document.addEventListener('click', function (event) { 3 4 const button = event.target.closest(`.button a[class*="button"], .button a[class*="cta"], .button a[data-id*="cta"], .button [class*="button"] a, .button [class*="cta"] a, .button [data-id*="cta"] a`); 5 6 if (!button) { 7 return; 8 } 9 const clickText = button.querySelector('.cmp-button__text, .button-text')?.textContent.trim() || button.textContent.trim(); 10 if (button.dataset.ctaTracked === 'true') { 11 return; 12 } 13 14 button.dataset.ctaTracked = 'true'; 15 16 setTimeout(() => { 17 delete button.dataset.ctaTracked; 18 }, 1000); 19 20 window.dataLayer = window.dataLayer || []; 21 22 window.dataLayer.push({ 23 event: 'CTA', 24 click_text: clickText, 25 click_url: button.href 26 }); 27 }); 28} 29 30function onDomReady(fn) { 31 if (document.readyState === "loading") { 32 document.addEventListener("DOMContentLoaded", fn, { once: true }); 33 } else { 34 fn(); 35 } 36} 37 38onDomReady(() => { 39 astraCtaDL(); 40}); 41function astraTextLinkDL() { 42 document.addEventListener('click', function (event) { 43 44 const link = event.target.closest(`.text .cmp-text a[class*="button"], .text .cmp-text a[class*="cta"], .text .cmp-text a[data-id*="cta"], .text .cmp-text [class*="button"] a, .text .cmp-text [class*="cta"] a, .text .cmp-text [data-id*="cta"] a`); 45 46 if (!link) { 47 return; 48 } 49 50 if (link.dataset.textTracked === 'true') { 51 return; 52 } 53 54 link.dataset.textTracked = 'true'; 55 56 setTimeout(() => { 57 delete link.dataset.textTracked; 58 }, 1000); 59 60 window.dataLayer = window.dataLayer || []; 61 62 window.dataLayer.push({ 63 event: 'CTA', 64 click_text: link.textContent.trim(), 65 click_url: link.href 66 }); 67 }); 68} 69 70function onDomReady(fn) { 71 if (document.readyState === 'loading') { 72 document.addEventListener('DOMContentLoaded', fn, { once: true }); 73 } else { 74 fn(); 75 } 76} 77 78onDomReady(() => { 79 astraTextLinkDL(); 80}); 81function addTitleCtaClass() { 82 document.querySelectorAll('.title .cmp-title .cmp-title__text a.cmp-title__link').forEach((link) => { 83 link.classList.add('cta'); 84 }); 85} 86function astraTitleDL() { 87 document.addEventListener('click', function (event) { 88 89 const titleLink = event.target.closest(`.title a[class*="button"], .title a[class*="cta"], .title a[data-id*="cta"], .title [class*="button"] a, .title [class*="cta"] a, .title [data-id*="cta"] a`); 90 91 if (!titleLink) { 92 return; 93 } 94 95 if (titleLink.dataset.titleTracked === 'true') { 96 return; 97 } 98 99 titleLink.dataset.titleTracked = 'true'; 100 101 setTimeout(() => { 102 delete titleLink.dataset.titleTracked; 103 }, 1000); 104 105 window.dataLayer = window.dataLayer || []; 106 107 window.dataLayer.push({ 108 event: 'CTA', 109 click_text: titleLink.textContent.trim(), 110 click_url: titleLink.href 111 }); 112 }); 113} 114 115function onDomReady(fn) { 116 if (document.readyState === 'loading') { 117 document.addEventListener('DOMContentLoaded', fn, { once: true }); 118 } else { 119 fn(); 120 } 121} 122 123onDomReady(() => { 124 addTitleCtaClass(); 125 astraTitleDL(); 126}); 127 128function astraTeaserDL() { 129 document.addEventListener('click', function (event) { 130 131 const link = event.target.closest('a'); 132 133 if (!link) { 134 return; 135 } 136 137 // Hero Teaser CTA 138 if (link.matches('.cmp-teaser__action-link') && link.closest('.teaser') && !link.closest('.list')) { 139 window.dataLayer = window.dataLayer || []; 140 141 window.dataLayer.push({ 142 event: 'CTA', 143 click_text: link.textContent.trim(), 144 click_url: link.href 145 }); 146 return; 147 } 148 149 // Related Articles 150 const articleLink = link.closest('.list .cmp-teaser__link, .list .cmp-list__item > a'); 151 152 if (!articleLink) { 153 return; 154 } 155 const listItem = articleLink.closest('.cmp-list__item'); 156 const articleTitle = listItem?.querySelector('.cmp-teaser__title')?.textContent?.trim() || listItem?.querySelector('.cmp-list__item-link')?.textContent?.trim() || ''; 157 158 let sectionTitle = ''; 159 const container = articleLink.closest('.list')?.parentElement; 160 const sectionHeading = container?.querySelector('.text h1, .text h2, .text h3, .text h4, .text h5, .text h6, .text p, .cmp-title__text'); 161 162 if (sectionHeading) { 163 sectionTitle = sectionHeading?.textContent?.trim() || ''; 164 } 165 166 window.dataLayer = window.dataLayer || []; 167 168 window.dataLayer.push({ 169 event: 'article', 170 action: 'related_article_click', 171 section_title: sectionTitle, 172 article_title: articleTitle, 173 click_text: articleLink.textContent?.trim() || articleTitle, 174 click_url: articleLink.href 175 }); 176 }); 177} 178 179function onDomReady(fn) { 180 if (document.readyState === 'loading') { 181 document.addEventListener('DOMContentLoaded', fn, { once: true }); 182 } else { 183 fn(); 184 } 185} 186 187onDomReady(() => { 188 astraTeaserDL(); 189}); 190function astraAccordionDL() { 191 document.addEventListener('click', function (e) { 192 const trigger = e.target.closest('.accordion .cmp-accordion .cmp-accordion__button'); 193 194 if (!trigger) { 195 return; 196 } 197 198 const payload = { 199 event: 'accordion', 200 accordion_name: trigger.textContent.trim(), 201 action: 202 trigger.getAttribute('aria-expanded') === 'true' 203 ? 'close' 204 : 'open' 205 }; 206 207 window.dataLayer = window.dataLayer || []; 208 window.dataLayer.push(payload); 209 }); 210} 211 212function onDomReady(fn) { 213 if (document.readyState === 'loading') { 214 document.addEventListener('DOMContentLoaded', fn); 215 } else { 216 fn(); 217 } 218} 219 220onDomReady(function () { 221 astraAccordionDL(); 222});
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.