> I am trying to figure an accurate way to calculate how many users are > viewing a site, at any particular time. This task is very simple except for > one part - How do you determine when a person has left the site...apache > hasn't served anymore requests from a particular ip for xx minutes ??
Hi Mike, There is no surefire way to measure the exact time a user leaves your site. The most accurate way I can think of would be to use a hidden frame on all your pages that refreshes itself every X seconds. When a user has not requested that special tracking page for more than X seconds, you can assume they have 'left' the site. However this solution seems like overkill for most purposes: you'll be wasitng server resources and slowing down your users' experience on your site. In response to your proposed method, most advertising associations (including the US-based Internet Advertising Bureau) and web analytics companies (such as Red Sherrif, Nielsens and Hitwise) define the end of a user session on a website when there is 30 minutes without a further request for a page from the site. And while you may be tempted to track only IP numbers, remember that many users are behind shared IP numbers (e.g. firewalls) which may skew your stats. You would be better off using cookies on user's machines to identify them and log their accesses to a DB. Hope that helps, Al -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php