top of page
bottom of page
console.log('Custom code loaded');
document.addEventListener('click', (e) => { if (e.target.matches('.zoomable-image')) { window.wixAnalytics.trackEvent('ImageZoom', { image_id: e.target.getAttribute('data-image-id') }); } }); document.addEventListener('click', (e) => { if (e.target.matches('.expand-image')) { window.wixAnalytics.trackEvent('ImageExpand', { image_id: e.target.getAttribute('data-image-id') }); } }); document.addEventListener('gallerySwipe', (e) => { window.wixAnalytics.trackEvent('ImageSwipe', { direction: e.detail.direction, index: e.detail.index }); }); let fired = {25:false, 50:false, 75:false, 100:false}; window.addEventListener('scroll', () => { const depth = (window.scrollY + window.innerHeight) / document.body.scrollHeight * 100; [25, 50, 75, 100].forEach(level => { if (!fired[level] && depth >= level) { fired[level] = true; window.wixAnalytics.trackEvent('ScrollDepth', { level }); } }); }); const hero = document.querySelector('#hero'); let heroStart = null; const observer = new IntersectionObserver(entries => { entries.forEach(entry => { if (entry.isIntersecting) { heroStart = Date.now(); } else if (heroStart) { const duration = Math.round((Date.now() - heroStart) / 1000); window.wixAnalytics.trackEvent('TimeInView', { section: 'hero', seconds: duration }); heroStart = null; } }); }); if (hero) observer.observe(hero);