Forum Moderators: open

Message Too Old, No Replies

on.blur on.focus timer

is it possible?

         

mdharrold

4:20 am on Mar 9, 2002 (gmt 0)

10+ Year Member



Would it be possible to have an (on.focus) (on.blur) timer to get actual visitor time on site?

IanKelley

9:07 am on Mar 9, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yes that could be done but you would have to put the code in every page on your site.

Problem is that it's hard on resources... if you end up with a perpetual javascript/DHTML process running in the background, mixed with a couple other memory/cpu intensive browser apps like flash and java (especially java) either on your site or in another browser window you'll get major slow down and hangs on older systems.

By older systems I mean PII's and earlier PIII's.

Kinda kills the professional feel of a site :-)

Most good server log interpreting stat programs can give you a very good idea of how long visitors are spending on your site.

mdharrold

2:32 pm on Mar 9, 2002 (gmt 0)

10+ Year Member



The logs give you time based on how long between clicks. The java timer would give you actual time viewing pages. I had a use for this last night, but this morning is fuzzy.

IanKelley

9:38 am on Mar 12, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If you want to play with it... here's the general idea:

<script language="Javascript">
<!--
hi = new Date();
function visitTime() {
bye = new Date();
minutes = (bye.getMinutes() - hi.getMinutes());
seconds = (bye.getSeconds() - hi.getSeconds());
time = (seconds + (minutes * 60));
if (time == 1) {
time = (time + " second");
}
else {
time = (time + " seconds");
}
alert('You visited this page for ' + time );
}
//-->
</script>

<body OnUnload="visitTime()">