Is there a way to detect when someone leaves your site? So far I know about using ignore_user_abort() but thats about as far as I’ve gotten.
The reason I need to know this is because I need a script to execute upon someone leaving the site.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Record a timestamp in a database for each user and update this upon each page load (or through AJAX).
When the last updated timestamp is older than a cetain amount of time (30 mins?) you can consider they’ve left the site and do your code, deleting the entry afterwards.