1.
You can use Session_OnStart and Session_OnEnd in the Global.asa file:
Session_OnStart will be executed when the user first arrives at the site
Session_OnEnd will be executed when the user leaves the site
In the global.asa file add the following:
<SCRIPT LANGUAGE='VBScript' RUNAT='Server'>
Sub Session_OnStart
**Put your code here that records the time the user enters the site to a database**
End Sub
Sub Session_OnEnd**Put your code here that records the time the user leaves the site to a database**
End Sub
</SCRIPT>
2.
A lot less elegant way is when users log in and out to record the times. I will not advise this, as there are a lot of issues using this method, and users have to log in and out which is maybe not your case.
How about if you use some javascript on your pages, to open a popunder window "onUnload", the popunder window, can update the time that this user left, then close itself. If you do it on every page, then the last page he/she visits of yours would be recorded.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.