Page 1 of 1

calculate how long user stay in a page using javascript?

Posted: Wed Sep 22, 2010 5:07 am
by bhanu
Hi to all

can we calculate how long user stay in a page using javascript?

I write a page as a questionary

when you finish page 1 and click the button it will transfer to page 2 to continue question on page 2

I would like to know the time user spend on every page... and then show the record on last page

how to calculate and record ?

Need javascriptt code.

thank you
regards
bhanu

Re: calculate how long user stay in a page using javascript?

Posted: Wed Sep 22, 2010 6:03 am
by requinix
No need for JavaScript that I can see.

I'm guessing you're imposing a time limit on the whole process? When the first page loads, record the current time somewhere in the session. On each page load after, compare the current time against the recorded time.