Forum Moderators: coopster

Message Too Old, No Replies

Timestamp

         

itwebxpert

9:45 am on Jan 25, 2005 (gmt 0)

10+ Year Member



Hi all,

I would like to dispay the duration of a visitor viewing a web page. I know the start time of hitting a page, which is:

start = time();

In order to calculate the duration the visitor has spent on a page, i need to know the time (timestamp) when a visitor leaves a page, or move on to another page?

I would appreciate advice from all experienced developers.

Thanks

mincklerstraat

9:54 am on Jan 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You'd want to use sessions, either the PHP built-in session machine with the session functions (go see the nice explanation of sessions in the PHP manual), or write your own session machine - and just record this time as a session variable. This will work well for timing the intervals between page views that an individual visitor visits while paging through your site. It won't give you any information about when a page closes - so if it's a visitor that only looks at one page, you won't have any information. For that someone's provided an answer here [webmasterworld.com].