Welcome to WebmasterWorld Guest from 3.234.210.89

Forum Moderators: ocean10000

Message Too Old, No Replies

calculating time

     
6:54 am on Feb 7, 2012 (gmt 0)

Preferred Member

10+ Year Member

joined:Mar 30, 2006
posts: 399
votes: 0


We need a module that calculates the number of hours browsed in our website. Is it possible to do so. What will happen if a visitor closes the browser through task scheduler(abrupt ending)
2:33 pm on Feb 8, 2012 (gmt 0)

Administrator

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month

joined:Jan 14, 2004
posts:864
votes: 3


Are you looking to use this in a report for Admins? Or to display it to the users?

If it is an admin only report you can probably get a decent idea from processing your web server logs, without doing any extra coding.

Other way is to track it by a cookie, and every time the user hits a page, update the time browsed based on that cookie which has a start date/time saved in it. This would be a session cookie which expires after not being used for a set period of time which would cover the person leaving the site.
10:01 am on Feb 9, 2012 (gmt 0)

Preferred Member

10+ Year Member

joined:Mar 30, 2006
posts: 399
votes: 0


Thankx ocean. Its the other way. Calculating the time a user spends on the site. How could the issue on closing the browser can be sorted.

I got a timer control for webforms from another site.
2:44 pm on Feb 9, 2012 (gmt 0)

Administrator

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month

joined:Jan 14, 2004
posts:864
votes: 3


I used a session cookie because it normally has a short expiration time. But you could use the same method with a cookie which does not expire for a longer period. But you would have to update the code to handle when they go inactive for a long period. (aka the close the browser and go to bed, and open it again in the morning) You would have to code in what you think is a safe delay, which you can add to the login time before counting it as a new login time.