I\'m looking to track users average time on a website (in the same way that Google analytics does) for internal administration.
What\'s the easiest way to do this?
There really isn't an effective way to do this with PHP, as PHP is server-side and provides no way of determining when the page was closed. You need to use javascript to determine this.
What I would do is use javascript to start a timer on window.onload
and then end the timer on window.onunload
. Then you can store the data and do what you want with it.