[Javascript] Tracking Visit-Time
Tom Churm
thomas.churm at pixelpark.com
Sat May 19 09:11:16 CDT 2001
hi,
i found the following example in Stefan Muenz's "SelfHTML". it's a
JavaScript that delivers the amount of time that a user has stayed on a
webpage. could someone please provide me with some hints in converting
and/or modifying this script for PHP & MySQL? specifically, I'd like to
find out the length of time a user stays on a webpage and then save this in
a MySQL db.
or if someone has seen an example of a php script that does this or
something similar, i'd be very interested in seeing a link.
thanks for the help!,
tom
/* JavaScript example follows: */
<script language="JavaScript">
Start = new Date();
Startzeit = Start.getTime();
function Aufenthalt()
{
Ende = new Date();
Endzeit = Ende.getTime();
Aufenthalt = Math.floor((Endzeit - Startzeit) / 1000);
alert("Sie waren " + Aufenthalt + " Sekunden auf dieser Seite");
}
</script>
</head>
<body onUnload="Aufenthalt()">
More information about the Javascript
mailing list