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)
Ocean10000
2:33 pm on Feb 8, 2012 (gmt 0)
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.
dukelips
10:01 am on Feb 9, 2012 (gmt 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.
Ocean10000
2:44 pm on Feb 9, 2012 (gmt 0)
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.