Is there a way to log how long a visitor stays on my website?
+1
A:
Write some JavaScript ping function to send heartbeat requests every few seconds.
That is, if you wish to do it manually. Otherwise, use some statistics software. Many hosters put something for you to use. Or just add Google Analytics to your site.
Developer Art
2009-12-07 21:02:03
+1
A:
Following Developer Art's suggestion, there is a very good implementation of this heartbeat method at ajaxpatterns.org.
Daniel Vassallo
2009-12-07 22:06:15
A:
Google Analytics will record the time between pageviews on your site. This means that single pageview sessions (bounces) are not factored into time on site, nor is the time spent a user spends on their final pageview for multi-page visits. It'll give you a decent ballpark figure though.
martynj
2009-12-08 14:16:34