I am trying to check the online activity of a logged in user on my website. For now, I am checking (in every 5 minutes) if a user is online if she scrolls upto certain part of the webpage. Or, if she switch from page A to page B or vice versa.
But still these two methods are not working well.
Can somebody assist me the best way to check the online activity and mark a user online. I am looking for an easy way.
Please help.
It doesn't interfere with performance much (we scaled it to millions of users). Though the other trick was to use it as a way to bundle cache information.
We also sent it to notify the server whenever it quit the tool. But there are cases where it doesn't (device failure), so the server assumes the person is off when it misses 3 heartbeats.
But if you don't want to code anything, try using sites like Google Analytics. Simply embed small javascript code and your done. After that login to your account and use Google dashboard.
If a user doesn't do anything for lets say, 5 minutes, you can mark it as offline.