Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_components thread: calculate the duration of a user remained on my site.


Message #1 by "kashif nazar khan" <kashif_nazar@h...> on Thu, 4 Jan 2001 10:54:44 -0000
Hi.



I want to calculate the total time a user remain on my site.

what should i do.

can anyone tell me, how i can achieve in using asp.



thanx



---

http://www.asptoday.com - the leading site for timely,

in-depth information for ASP developers everywhere.

---

You are currently subscribed to asp_components as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_components-$subst('Recip.MemberIDChar')@p2p.wrox.com

Message #2 by Robert Chartier <rchartierh@a...> on Thu, 04 Jan 2001 09:29:50 -0500
This will be somewhat of a difficult task.  You could assign them a unique 

id, log that id in the database, to get the session started.  This will 

allow  you to track when the first hit the site pretty reliably.  The only 

problem will come when they leave the site, or close the browser...or heck 

when they just shut their monitor off and walk away.



Response.IsClientConnected



Could be a start for your IE clients.  Or just timing the ID's out 

periodically.



Since the web is stateless, and the client & server are never really 

totally connected up to each other in a persistent connection, there is 

really no way of knowing when the user is not available and/or has left the 

site.  Thus your task can never really be 100% reliable in its data that it 

provides.



good luck.









At 05:54 AM 1/4/01, you wrote:

>Hi.

>

>I want to calculate the total time a user remain on my site.

>what should i do.

>can anyone tell me, how i can achieve in using asp.

>

>thanx

>







---

http://www.asptoday.com - the leading site for timely,

in-depth information for ASP developers everywhere.

---

You are currently subscribed to asp_components as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_components-$subst('Recip.MemberIDChar')@p2p.wrox.com

Message #3 by "Peter Lanoie" <planoie@f...> on Thu, 4 Jan 2001 11:16:21 -0500
Kashif-



I have done a form or session tracking that calculates session times. Here's

a watered down version of the concept:



When the user first hits your site, you could log a session start entry into

a database. Maybe use the ASP session ID, that way you have a unique ID for

each session, and you don't have to worry about writing cookies, or time

outs, the ASP session object can handle all that.



The database table could contain 3 fields:

	SessionID

	StartTime

	LastEncounter



Then each page that gets hit can check the DB for an existing record

matching the ID you use (in this example, the ASP session ID), and update

the LastEncounter field with the current date/time (Now).

This would at least provide you with a lapse time from the first page hit to

the last, but there really is no sure way of determining when they leave.



This will add a small bit of overhead to the site, as you are making those

DB hits all the time, for each page.  In my case, I'm making a lot of DB

hits already tracking sessions in much more detail.  I insert a row with

tracking details including the page hit datetime. Then later on, I aggregate

the tracking data together and just do some math between the first and last

record for each session to calculate session times. This seems to work

pretty well. And all of this is achieved without any components. It's all

just in the site's include files with plain VBScript.



Hope this helps, Good luck!



Peter Lanoie



-----Original Message-----

From: kashif nazar khan [mailto:kashif_nazar@h...]

Sent: Thursday, January 04, 2001 5:55 AM

To: ASP components

Subject: [asp_components] calculate the duration of a user remained on

my site.





Hi.



I want to calculate the total time a user remain on my site.

what should i do.

can anyone tell me, how i can achieve in using asp.



thanx



---







---

http://www.asptoday.com - the leading site for timely,

in-depth information for ASP developers everywhere.

---

You are currently subscribed to asp_components as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_components-$subst('Recip.MemberIDChar')@p2p.wrox.com

Message #4 by "Umair" <umair_devil@h...> on Fri, 5 Jan 2001 14:01:34 -0000
Well!



For this we should create two event handlers.



"Session_OnStart" which Runs the first time a user runs any page in your

application

&

"Session_OnEnd" which  Runs when a user's session times out or quits your

application



So what you have to do is to maintain a database.

In which u will save its starting time on "Session_Onstart" against its

sessionID and again save the time when the session ends when

"Session_OnEnd" event is occured.



You can make it more specific according to ur need by thinking more onto

it.



Hope it worx Cause i never tried calculating user time.

Plz give comments.



Umair



---

http://www.asptoday.com - the leading site for timely,

in-depth information for ASP developers everywhere.

---

You are currently subscribed to asp_components as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_components-$subst('Recip.MemberIDChar')@p2p.wrox.com

Message #5 by "David Hemingway" <david_hemingway@l...> on Sat, 6 Jan 2001 10:58:03 -0000
On 4GuysFromRolla_com theres an article about timing page(asp) load times

using a compoment called profiler. You could call the Session_OnStart method

in the application onstart in the global.asa and the stop method in the

Session_OnEnd.



the article is here http://www.4guysfromrolla.com/webtech/122700-1.shtml



Regards



David



It's crazy enough it might work.



-----Original Message-----

From: Umair [mailto:umair_devil@h...]

Sent: 05 January 2001 14:02

To: ASP components

Subject: [asp_components] Re:calculate the duration of a user remained

on my site.





Well!



For this we should create two event handlers.



"Session_OnStart" which Runs the first time a user runs any page in your

application

&

"Session_OnEnd" which  Runs when a user's session times out or quits your

application



So what you have to do is to maintain a database.

In which u will save its starting time on "Session_Onstart" against its

sessionID and again save the time when the session ends when

"Session_OnEnd" event is occured.



You can make it more specific according to ur need by thinking more onto

it.



Hope it worx Cause i never tried calculating user time.

Plz give comments.



Umair





---

http://www.asptoday.com - the leading site for timely,

in-depth information for ASP developers everywhere.

---

You are currently subscribed to asp_components as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_components-$subst('Recip.MemberIDChar')@p2p.wrox.com


  Return to Index