1 person found this helpful
I don't think that would be a very good measure at all. The timeout value which is where the system waits a specified amount of time (twenty minutes by default) for any new requests would be a huge factor in this average.
This is not really something you can measure acurately without having control over the client. The best you can really do is record each request made by a given user. Presume that the time spent on the site is the amount of time spent between the first request and the last request.
You will want to do your best to filter out robots which allmost always make every request as an unique user, because they do not pass back the cfid and cftoken cookies that allow the system to know this is a returning 'user'.
You may also have to account of other users who block or do not allow cookies, and users who only make a single request of your site and move on.
All of this depends greatly on what type of site we are talking about and what type of users are you traking.
You could start out trying Google Analytics, it's free and you just drop a tag in your site. I've used it and although I like to code things myself, this was a quick fix to get the "Avg time on site" data.
You will get the most accurate tracking system if your users have to log in.
A realistic approach would be to send the 'time this page was generated' as a hidden-field in the forms. When the data comes back, examine the
value and, if it is reasonable, use it to calculate your elapsed-time.
For an inward-facing (intranet) application, this strategy is pretty reasonable and robust. It's not the only way (you could use Session variables, for instance), but it ought to work pretty well. It certainly has the compelling advantage of being quite easy to do . . .