testafdsfdsfasdf document.addEventListener('DOMContentLoaded', function() { var popupDisplayed = false; function showPopup() { if (!popupDisplayed) { document.getElementById('exitIntentPopup').style.display = 'block'; popupDisplayed = true; } } // Detecting mobile users based on screen width var isMobile = window.matchMedia("only screen and (max-width: 760px)").matches; if (isMobile) { // Show popup after 10 seconds for mobile users setTimeout(showPopup, 10000); } else { // Exit intent for desktop users document.addEventListener('mouseout', function(e) { if (!popupDisplayed && e.clientY < 50) { showPopup(); } }); } // Close the popup when clicking outside of it document.getElementById('exitIntentPopup').addEventListener('click', function(event) { if (event.target === this) { this.style.display = 'none'; } }); });
Written by
Lena Marsh · Head of SEO Strategy

Lena leads strategy across Lucorpmedia's ecommerce and multi-location accounts. Former in-house director of growth for two 8-figure DTC brands.