For a web application I'm writing it's going to be key to measure at a frequent interval (every minute or so) how many visitors are in a specific part of my application right now. Say my application has 10 subsections that are switched between using JavaScript and made persistent using #!/page8 style hash tags. What would be the best way of doing this accurately?
My current plan is to just save the amount in a database, adding and subtracting every time an user clicks on the page or leaves the page. This doesn't really seem like a very good solution to me though. Events to track page leaves could be cancelled due to closing browsers, people could be screwing with the data by running the API calls for visiting/leaving etc. It would be a lot of work to get reliable.
Any thoughts?
I'm tagging this with a lot of common web development tags since it's a very open question and any of these tags could contain the answer
Originally asked by: Codemonkey on Stack Overflow


Answers