Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 231
  • Last Modified:

Count the seconds a user is on a page

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?


0
usuhd
Asked:
usuhd
  • 2
1 Solution
 
brizzkidCommented:
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)
0
 
kacalapyCommented:
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
0
 
brizzkidCommented:
yep, thats even easier to do
0
 
GaryCommented:
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.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
GaryC123
EE Cleanup Volunteer
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now