hit counters : Java Glossary

home page H words local find full screen, hide local find menu Google search web for more information on this topic jump to foot of page translate this page with Babelfish punctuation 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z (all) ©1996-2010 Roedy Green, Canadian Mind Products
The CurrCon Java Applet displays prices on this web page converted with today’s exchange rates into your local international currency, e.g. Euros, US dollars, Canadian dollars, British Pounds, Indian Rupees… CurrCon requires Java 1.1 or later, preferably 1.6.0_18. If you can’t see the prices in your local currency, troubleshoot CurrCon.
hit counters
One of the most commonly requested Applets is one that will display the number of visitors to a page like this:
You are visitor number 79,175.
The hit counter above is done with SSI (Server Side Includes). The problem with it in Novell is the hit counter is incremented every time the hit counter is displayed, not every time the corresponding file is downloaded. If you display the counter in more than one place, or other than in the file being monitored, you will get inaccurate results.

Unfortunately, it is not possible to write such a program in Java without the co-operation of a server, somewhere to centrally record the current value of the counter.

Happily there are people who will provide you with free hit counters and free use of their server, usually in exchange for some advertising on the counter.

A source of free counters is TheCounter.com. They require 24 lines! of Javascript that confounds the Vslick beautifier. The odd thing is, to me, it looks as if the JavaScript is unnecessary. By default, the counters look like this:

TC

Another source of free counters is Vendio.com née honesty.com, née andale.com

Try the WebCounter people. They also issue free counters that by default look like this:

counter

Commercial hit counters generally give faster response than free ones. Before you sign up see if you can find some of that vendor’s hit counters on other people’s sites and see how responsive they are. A sluggish hit counter can be very annoying to your visitors.

Some hit counters let you substitute your own set of ten gifs for the digits 0 to 9 to create the counter. With search engines, you can find hundreds of sets of free gifs to use.

There is not much point combing the web for hit counter software to run on your server. Most ISPs won’t let you run it. They may have some software they have tested they will let you run, usually for a fee. The hit counters on my pages are handled by Novell’s SSI and are sent as ASCII text. Every ISP will have his own preferred way of doing them, usually with CGI.

In theory, you could create a Java Applet to display a hit counter. The central site could send the value of the count over in compact binary. However, this would be slower than using CGI since tche browser would need to download the Java Applet containing contain code and a complete set of *.gifs for all the digits. Further the browser user would need to load the Java interpreter. This would take considerably more time than just sending the count or the gifs needed to display the current count. The other problem is the count would not work for people who did not have Java installed or if their Java did not work, or if the Java Plug-In 1.2 had sabotaged the 1.1 version. If there were some way of caching Applets, this technique could be very fast. Perhaps we will see them in future, using smoooth animations or other gimickry.

There are several possible ways of computing hits.

Perl Counters

The counters on this website are implemented with a Perl script invoked with SSI (Server Side Include). At the bottom of each page is the following code
<!--#exec cgi="/perl/count.pl" -->

When the page is served to the client, the script invoked. It adds one to the number stored in a file called xxxx.cnt where xxxx is the name of the current file. It then inserts the incremented value in place of the SSI.

You can display the value of the count for a file with with:

<!--#INCLUDE VIRTUAL="index.html.cnt" -->
CGI
echo server
gostats.com: free hit counters using JavaScript
SSI
Webring: offers free hit counters

CMP homejump to top You can get the freshest copy of this page from: or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror)
http://mindprod.com/jgloss/hitcounter.html J:\mindprod\jgloss\hitcounter.html
CMP logofeedback Please email your feedback for publication, errors, omissions, typos, formatting errors, ambiguities, unclear wording, broken/redirected link reports, suggestions to improve this page or comments to Roedy Green : feedback email
mindprod.com IP:[65.110.21.43]
view BlogYour face IP:[38.107.191.113]
You are visitor number 79,176.