View Full Version : Timing Visits

11-02-2006, 06:18 PM
I am trying to time the length of time each person views my website. I found a javascript script that will do this but I can't enter that into mysql database. Is there a way to do this with php?

11-02-2006, 09:24 PM
Well you can do it with sessions. You store the time when the session was created and store the time the user performed an action (requested a webpage). You then subtract one from another and that's it.

11-02-2006, 11:39 PM
you could also.. if your feeling like a bit more coding..

set up a bit of ajax which querys the server every x seconds to say the user is still on the page

the server side then subtracts the current time from the last time and adds this to a running total

or something

didnt put much thought into that so its probably quite badly thought out:thumbsup: