Presuming I've a wide open source web server or proxy I'm able to enhance, let us say apache or squid.

It is possible to way to look for the time each client stays on the web site?

HTTP is obviously stateless, therefore it is not trivial, but maybe someone comes with an idea regarding how to approach this issue?

Thanks.

Not without getting some javascript constantly hit your server around the client side after which checking if this stops (however that assumes the consumer has javascript enabled). You will find also various (ugly) methods to identify home windows being closed with javascript, however these will not always trigger. eg. browser crash.

I kind of question the reason why you want this anyway. What if an individual compares the web site for 3 seconds, will get distracted by another tab/window but leaves your page open for just two hrs? The solution you receive is 2 hrs, the solution you (most likely) want is 3 seconds.

With Apache or Squid you hardly can identify time a person stays in your page.

However with some additional sugar in your web page you are able to:

It's free and it has a lot of functions.

But you will also invite Google to look at the stats of the site ... (but maybe that can help these to determine if you wanna buy you :-))

You can count time between once the page was asked for to once the next page is asked for, however this could simply be correct when the user remained on that page the entire time til he asked for the following page. Even so he might be around the original page (e.g. he opened up the brand new one out of a tab), and can only work when they do browse to a different page.

The only method to know without a doubt is always to use Javascript to ping the server in the open page every 10-seconds approximately, simply to say "I am still being read!"

I have really seen javascript statistics packages where they not just monitored how lengthy you had been around the page, by pinging the server once in awhile, but additionally stored tabs on precisely what was on screen. by calculating how big your browser window, together with the scroll positions from the document, they could determine just how lengthy each element was on screen. By monitoring the position of the mouse, can most likely obtain a good guess at what they're searching at too. I can not discover the link at this time, but here's the short story. If you're really thinking about what individuals are searching at, as well as for how lengthy, it can be done. There isn't a limit to what you can track.

Also, only a thought, If you won't want to ping the server an excessive amount of, you can keep stuff buffered in memory, and just send towards the server whenever you got an adequate amount of data, or before the page closed.