I have this detector script in order to detect if user/mouse is leaving from the page (exit trap). Its working well except script is too fast, sometimes it detects when mouse is initially coming into page from the adress bar. How to delay it for 30 seconds so that check is done only if user has stayed 30 secs on page?
jQuery(document).ready(function($) {
jQuery(document).setTimeout(function(f) {
jQuery(document).mousemove(function(e) {
if (e.pageY - jQuery(document).scrollTop() <= 7)
if ( document.referrer == null { USER LEAVING !!! }
});
, 2000);
});