![]() | |||||||
How to get the timespan a visitor stays on site before bouncing away? Trying to build a cute little php site statistics script, now I'm stuck with getting the average visiting time on site. How to do that? I'm using JS badge. HTTP is stateless, if that is the case how the server knows when the visitor navigates away? JS onunload? |
A script that marks the start-time for that IP#, then an "onunload" posting to it to mark the "leaving-time" is probably your only real viable option. While others may think of another way (if so, please educate me ;) ), that (an onunload event) is the only solution outside Ajax that I can think of. With Ajax, you could continually call a timer from a PHP script. The problem with doing that is that you would want (to get a good "average") to have it call the time atleast every second, and the bandwidth will end up killing you if you used this Ajax method :eek: Possibly a combo of the two: calling the PHP script on "onload", then again on "onunload", both via Ajax, might do the trick for you :blink: |
| All times are GMT -7. The time now is 02:10 AM. |
Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0