Horace's Java
Page View Timer Demo Entry

Demo Version 2: My preferred Version

This little demo illustrates how one might use a little (invisible) java applet to gather information about how long a visitor actually views a particular page ... well - how long the page is opened in a browser window anyway.

In this version of the demo (this one's my preferred version BTW), individual thread executions simply increment a local counter. Only when the applet stops (due to the visitor having left the page) is the server cgi called to update info on the visitor's viewing time.


  • This form of the applet places substantially less burden on the server - thus
  • it can use much finer timing granularity.


  • Because this form of the applet only records the visitor's viewing time AFTER the visitor leaves the page, it will not show good values for the current page of a current visitor. You can see the effect of this when viewing the report for this form of the demo - this should be clear to those who are familiar with java's thread mechanism.
  • Because this version doesn't update the server-based records until the visitor leaves a page, it will lose information for the current page if the visitor shuts down his browser rather than leaving. Also, if the visitor is disconnected and subseqently reconnects without restarting his browser, the disconnect time will be recorded as viewing time - which is still true really ... assuming the page was in the browser window {;-)

Anyway - the following pages comprise the demo. Just visit a few of these dummy pages to simulate traversing a site and then visit the REPORT page to see a list of the times you spent on each of the dummy pages (and this page). Also, you can see the applet tag by viewing the source of any of the pages.

N.B. - This demo uses some of my previous stuff to establish unique identifiers for each visitor. If you're interested in the supporting stuff, drop by the Stats Demos page for more on the supporting stuff.

sources for:
the Applet
this HTML page
this demo's timer incrementation mechanism

NOTE: if you're not running on a NeoWebScript/Apache server, you'll need to write your own cgi or whatever to perform/store timer values.

NOTE for folks behind a firewall

This demo and applet are designed to work for folks located behind a firewal. I know this won't work for all platforms and browsers so, if you could take a moment to drop me a line to let me know if it does work for you, I'd really really appreciate it. Please let me know which OS, Firewall and Browser you're using so that I can better define when this solution will work.

If you have any difficulty getting this demo to work and you suspect it is because you are behind a firewall, try CLICKING HERE in order to enter the demo using al alternate form of it's URL.

Search the Site
Find Any or All of

Feel free to drop by and chat if you have any questions - one of us is usually around during normal CST/CDT business hours.


Copyright © -1995-2018 by hav.Software. All Rights Reserved.

https://www.hav.com/ havBpNet:J, havFmNet:J, havBpNet++, havFmNet++, havBpETT, havCNet, WebSnarfer, havIndex and havChat are all trademarks of hav.Software.

Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.

There may be other trademarks or tradenames listed in this document to refer to the entities claiming the marks and names or products. hav.Software disclaims any proprietary interest in any trademark, tradename or products other than its own.

Modified - 03/01/03 - 32018621 - 6807751