Unfortunately, you cannot tell when a client leaves your site. This makes it
hard to know when to stop timing. Unless you have them click a logoff
button, of course, but you are not guaranteed that they will do so (we all
know how users are).
Couple of different ways you can try to do this.
1. Hidden Frame
You can have a hidden frame that refreshes itself every minute. Each
refresh, you update the database. Once the user leaves your site, that frame
will (hopefully) stop refreshing itself. Problem with this is Netscape
doesn't like hidden frames.
2. Weird things in application.cfm
In your application.cfm file, you have a client variable - we'll call it
HOLDTIME for lack of something else. Every time application.cfm is loaded,
set a TEMP variable to Now(), calculate the difference between TEMP and
HOLDTIME and update the database, set HOLDTIME to TEMP, finish the page. The
problem here is at the end of the client's visit. Since application.cfm will
not be loaded after they leave, you lose whatever time they spent on the
last page.
3. If you want to use a logoff button, you can just take a timestamp when
they login and compare it to the timestamp when they logoff and update the
database. Again, you are not guaranteed that they will use the logoff
button.
Check the archives. The topic of knowing when a client leaves your site
comes up every so often. I don't remember anything off hand, but you should
be able to find it in the archives.
-----Original Message-----
From: rkern - Prolynx [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 10, 2000 1:55 PM
To: CF-Talk
Subject: CF Talk, calculating elapsed time
To all,
I'm looking for some ideas on how to implement a timer that tracks
customer time on site.
Situation - customer logs in, goes to study pages, at the point of login
I start the timer. After a ten minute increment the 10 minutes are
added to the totaltime in the user database. posting may be automatic
or through submit button. if user leaves during the next 10 minute
increment, nothing is posted to the database.
approaches to date include:
serveral forms of
<cfset Client.ETHours = Abs(DateDiff("h",Client.TimeCreated,
Client.LastVisit)) >
the problem is that 'timecreated' gives a start date but is a static
value that will allow for total time from when the account is
generated. 'lastvisit' appears to be updated everytime the user comes
back to the page rather than just at login.
Have also considered client session variable storage. The variables
appear in the database but are all in one field separated by # signs. I
am looking for something cleaner.
Need - idea that allows a timer function to kick off at login and then
continue to run as long as they are on site in ten minute increments.
The timer is not the issue (I can use a simple loop ), where to
establish it is and how to use it accross the entire session and site
is.
any comments would be appreciated
Thanks
Richard
--
The Prince - Niccollo Machiavelli (1532)
Has some advice to his prince on engaging mercenaries.
Mercenaries are into it for the money and will run at the first sign of
trouble. Hire men who will die for you.
----------------------------------------------------------------------------
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.