View Full Version : Question about date and time

09-21-2005, 10:31 PM
Hi all. i'm new so bare with me. I visit many forums and I always get off to
a slow start.
My question is this: Is it possible to collect the date and time from a user
visiting my website, store it, then get the amount of time the user has spent
on my site using javascript? Thanks in advance. If this is in the wrong place
please let me know. :)

09-21-2005, 11:29 PM
Kinda sorta.
But not with pure javascript (it has to store it somewhere on your site, such as DB or sessions to be of any use, so you need server-side scripting, too) and not 100% accurate. Users can disable script.

Your best bet, if you're looking for site stats, are the ones provided by your host. Many hosts have more than decent stats. One of mine tells me what page they came in on, what page they left on, and how long they stayed (if it can guess based on the previos data) on each page. Reports on most used pages, how many times served in a given timeframe, and more.

As always nothing is 100%, but they're pretty decent for accuracy. The server itself logs IPs, sessions, and such.

You just can't duplicate that stuff with javascript. If you really care, go host hunting. :D

09-22-2005, 07:34 PM
Thanks for the reply. Ya, I kinda thought that I'd have to use something like asp or aspx to get the job done. Thanks.