Forum Moderators: DixonJones

Message Too Old, No Replies

Visitors leaving a page: how can we tell how long the page was open?

Is there a server side way to know that the page is being left by the user?

         

alexis

6:47 pm on Oct 28, 2005 (gmt 0)

10+ Year Member



My goal is to send data to a database, from a Flash movie, at the moment the user closes the window, the tab, or navigates away from the page. I would like to avoid the 'click here to save settings'. It should be automatic.

I read Javascript onunload is unreliable because the inconsistencies between browsers.

I know AWstats offers Sesion duration information. I looked in their PERL script to find the variable $endtime = Time::Local::timelocal($6,$5,$4,$3,$2-1,$1);

But I don't know what that means. Do they simply calculate the visit duration based on the time different between the first page request and the last page request? Or is there another hint the broswer is sending the server when it quits a page?

cgrantski

7:51 pm on Oct 31, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes that's how they calculate it.

You can get what you want by putting markers into your flash movie that send a beacon to your traffic collection server, whatever it is, every x seconds. From this, you can get a good idea of how long the movie displayed.