Count the seconds a user is on a page

Posted on 2003-03-07
Medium Priority
Last Modified: 2012-06-27
I have looked on the Internet with no avail.

What I need is a counter which counts the number of seconds a user is on a specific asp page.  The counter should begin once they enter the page and end when they click the submit button.  Once they click submit this value needs to be written to my SQL database.

Any ideas?

Question by:usuhd
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Expert Comment

ID: 8090084
I think an easy way to do that is by dropping a cookie on the client's computer and storing the actual server time in it. Once he hits submit, you can read that value and count the difference between that and now in seconds.

You can do that in both JavaScript and ASP easily.

If you do it in ASP, drop the cookie before you send header data, and retrieve it on the page where you process the form data.

If you do it in JavaScript, drop the cookie when the page has loaded (onLoad event for the body HTML tag) and retrieve it when the user clicks the submit button (onClick event for the submit form element)

Accepted Solution

kacalapy earned 500 total points
ID: 8090532
i do it all the time, set a counter in your asp page. use the timer object. andthen write it out as a value in a hidden text box, also keep a timer on the client, then when u ready to save add the 2 values

Expert Comment

ID: 8091754
yep, thats even easier to do
LVL 58

Expert Comment

ID: 9352871
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept Answer by kacalapy

Please leave any comments here within the next seven days.
EE Cleanup Volunteer

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question