I need to get an idea of the average "time on page" or "page view duration" for each page on my websites without client-side scripting (such as using onunload
event handler).
Is any of the free log analyzers capable of doing this? I looked at Webalizer, AWStats and Analog, but they don't seem to have such a function. The closest thing is "visits duration" in AWStats, but I'd like to see "page view duration" instead.
I know that visitor tracking is inaccurate without client-side scripting, but I can bear with it. Google Analytics seems to provide a "time on page" metric without hooking the onunload
event (but correct me if I'm wrong), so I believe this is possible.
I do commend to you the analog documentation on what is and is not knowable from your web logs, especially the part where the author writes:
Stephen Turner, the author of analog, is a bright guy - ex-Cambridge statistician - and I'm inclined to agree with him on this. He justifies his arguments in the link I sent above.
Analog will tell you what is definitely knowable from your web stats, and it will tell you very quickly. Trying to get more is guesswork, and if you want a guess, why pay someone else to make it? Random number generators are five a penny, so use one of them instead.
As Madhatter has written, relying on the logs for this information will not give an accurate picture. Also, as with most statistics, you have to spend a lot of time thinking about what you are actually measuring - are people spending time on the page because its interesting or because its hard to understand? Capturing the data in javascript will give quite different behaviour from looking at the logs (consider what happens when the user has multiple windows open).
AFAIK, there are no tools available, commercial or free which do this kind of analysis - including Google Analytics (malfy: can you provide a reference?). However writing your own is not overly taxing - but you'll certainly need to use mod_usertrack or require sessions throughout to differentiate between users - and log the relevant cookie along with the mimetype for a request - which means you're no longer using the standard log formats.
On the upside, the same machinery also allows you to start looking at caching effectiveness and clickstream analysis (also areas that most of the current generation of analysers are poor at).
So use Google Analytics then? I've used it - works great.
Warning: This method may or may not summon unspeakable horrors to your webserver's performance.
If you're running PHP or a similar scripting language, you could do something really, really ugly - like this:
In the footer of pages you want to track:
In "script.php" or whatever you choose to name your timer script:
... and then you can get a rough idea of how long people are viewing things by looking at the relative popularity of different
minute
values in your server logs.Nihuo Web Log Analyzer support this function. It's not free, but there is 30 days free evaluation version with full function in their website.