3

Is there a library or solution for quick apache/nginx log parsing and finding out how much time a user has spent on each page?

UPDATE: spent on every 3rd level domain.

For example AWStat can do that ( A full log analysis enables AWStats to show you the following information: Visits duration and last visits)

HelloWorld
  • 697
  • 10
  • 16
John
  • 454
  • 2
  • 5
  • 18

3 Answers3

2

You cannot do this with log files... The log files don't log when a user leaves the page. Youll need to use javascript for this using onload() and onunload()

Galen
  • 29,976
  • 9
  • 71
  • 89
  • 1
    You can extract a reasonably reliable time-of-departure by figuring out when the 'next' page was loaded. it fails for users who hold open multiple windows/tabs on the site, but works fairly well in general. – Marc B Mar 24 '11 at 15:48
  • what happens if they go to one page then leave – Galen Mar 24 '11 at 19:08
  • I can not use javascript, and onload()/onunload() as i know doesn't work in Opera ("pinging" server is workaround for opera) – John Mar 24 '11 at 19:11
2

Google analytics can help. It cannot determine how long a user was on the "last" page because it keeps track of when the user entered the next page to determine when they left the previous page.

Diodeus - James MacFarlane
  • 112,730
  • 33
  • 157
  • 176
1

Apache cannot do this. You can use jquery but it might not be accurate unless you perform long-polling on the page. Your question has been answered here in full on StackOverflow:

How to measure a time spent on a page?

Community
  • 1
  • 1
Cogicero
  • 1,514
  • 2
  • 17
  • 36
  • I can not modify site to add client side scripts (and as I know unload event doesn't work in Opera). Apache can not do that. But it is possible to calculate this. e.g. AWStats do that – John Mar 24 '11 at 19:19