// gtag basic snippet code do not change window.dataLayer = window.dataLayer || []; function gtag() { dataLayer.push(arguments); } gtag('js', new Date()); gtag('config', '{id}', { 'cookie_domain': 'auto', }); document.onreadystatechange = function () { if (document.readyState === 'complete') { // function call to track the new contents post SPA journey buttonAndLinkClick(); } } function buttonAndLinkClick() { document.querySelector('.slds-button').addEventListener('click', (e) => { // gtag function call to send event hit to Google Analytics along with the variables gtag('event', 'CTA Button', { 'event_category': 'link_button_click', 'event_label': 'Submit button clicked' }); }); }