Time spent per page???

A

Anonymous

Guest
How can I make a script that for each page in a site writes in a database the time spent by a user per page? :evil:
 
You could enter the time in the database when the page was requested and again when the next page is requested in the same session.

However, that would leave you with the problem that a user can use 2 browser-windows for the same session.
Also, a user could be doing something completely different while the page is open, like having a cup of coffee in the next room, hmmm, good idea :p

the latter problem you will probably have with every solution.

It also comes to my mind how usefull the data would be since the data is very likely not to be accurate!! (see above reasons).

Greetz Daan
 
At the bottom of every page insert a script that'll insert the info into a database: time (obviously), page and the sessionID so you can identify individual users
 
Yes, I understand the general ideea but I dont know how to code that Jay. How can I find out the time spent from opening to closing that page? 8O And also, if the user signs out, how can i keep the session to log the time?Isn't it destroied?? 8O :?: :?:
 
You can never track how long a person spends on a page, but you can take pretty good guesses (using masses of code and javascript which I won't go into). The only thing you can do is log at what time each page was requested, and work out how long was spent on that page by calculating the difference in time between that page being requested, and the next one!
 
Back
Top