// Scroll depth tracking var maxScroll = 0; window.addEventListener('scroll', function() { var pct = Math.round((window.scrollY / Math.max(1, document.body.scrollHeight - window.innerHeight)) * 100); if (pct > maxScroll && pct % 25 === 0) { maxScroll = pct; gtag('event', 'scroll', { percent_scrolled: pct }); } }, { passive: true }); // Time on page var startTime = Date.now(); window.addEventListener('beforeunload', function() { gtag('event', 'time_on_page', { seconds: Math.round((Date.now() - startTime) / 1000) }); });