import { analytics } from '../../../build/module'; const log = document.querySelector('.log'); document.addEventListener('click', (event) => { if (event.target instanceof HTMLButtonElement) { const type = event.target.getAttribute('data-event'); const source = event.target.getAttribute('data-source'); const productCategory = event.target.getAttribute('data-product'); if (type && source) { analytics.track({ type, source, productCategory, pageTitle: document.title, pageType: 'Example', }); if (log) { log.setAttribute('style', 'display: block'); log.textContent += `${type}: source=${source} product=${productCategory}\n`; log.scrollTo({ top: log.scrollHeight, behavior: 'smooth' }); } } } });