Baez Posted April 17, 2010 Share Posted April 17, 2010 I'm not sure if this can be done in PHP (maybe JS?) but I wanted to see anyway. I want to check if a visitor has closed the current window or page they were viewing. Can anyone point me in the right direction? Thanks Quote Link to comment Share on other sites More sharing options...
leehanken Posted April 17, 2010 Share Posted April 17, 2010 In theory, you would need repeated polls from the page in question (Javascript) to a script on the server which would record in a database/file when the page is open (PHP), and a third script (PHP) run very frequently (by the cron daemon) to check the database to notice when a page has stopped polling, and then take the appropriate action. I think this is how the Google Analytics ajax figures out how long a user stays on each page. Quote Link to comment Share on other sites More sharing options...
Baez Posted April 17, 2010 Author Share Posted April 17, 2010 Hmm that does make sense thanks a lot . I only need this to run on one page. And I'm assuming the best DB engine to use for this table would be MEMORY instead of MyISAM. I'm just not sure if my VPS would be able to handle it! Any tutorials or guides you know of to help me design this? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.