Setting up a hits counter



Q I have tried to set up a hits counter on my Web page but am unable to get it working. Can you tell me how to achieve this? I have tried to get this information through the Net but the directions appear to be incomplete.
- Tim Roberts

AIf you are curious about the number of hits your Web page receives and want a simple tool to record them, then a counter is the way to go. Most of the counters you see on the Web are small programs consisting of an image file and a Common Gateway Interface (CGI) script that counts the number of times your page is loaded. By nature, counters are complex beasts and there are many different ways to install and configure them, so it's almost impossible to find user friendly instructions for using them. Due to the variety of counters available I can't provide a complete set of instructions for setting up a counter on your page, but I can give you some ideas to get you started. Here are some of the different types of counters you could try.
ISP-based counter. Chances are your ISP already provides a counter script or program for their users, and all you have to do is insert a tag in your Web page to link to it. The tag will be a similar format to <IMG SRC=cgi-bin/counter/width=5/height=2/username>. If your ISP does provide a counter, they should supply full instructions for linking to it, but you could also check out other pages on the server which access the counter and use them as a guide. ISP-based counters are fairly accurate because the counter program lives on the same server as your Web page. This is a good option because linking to the counter should be straightforward, and technical support is only a phone call or e-mail away.
Web-based counter. There are a number of advertiser-driven, free Web-based counters available, (eg www.pagecount.com), and you can find others using a search engine. Upon signing up you receive an HTML tag to insert in your Web page. This is usually an image tag containing a URL which points to the counter program on the counter provider's site, eg:
<IMG SRC="http://www.pretendsite.com/cgi-bin/counter?width=8&link={http://www.examplesite.com.au/}{counter.html}">. Every time your page is "hit", the counter is activated and returns a number which displays on your page. Detailed instructions can be obtained from the counter provider.
CGI-based counter. If you have permission to install CGI scripts on your server you can grab one of the many CGI counters available on the Web. A good place to start is www.digitmania.com. It's important that you choose a script that is compatible with the server it will run on because not all scripts will work on all servers. CGI-based counters are usually installed into the server's cgi-bin directory and should come with installation instructions, but they can still be difficult to set up. If you're struggling with a CGI counter, have limited knowledge of CGI, and don't have any CGI-savvy friends, I recommend using a different type of counter and saving yourself the hassle.
Java-based counter. This type of counter is a great alternative to a CGI-based one and is easier to install. The Dynamic Counter Applet by Cameron Gregory -- available from http://counter.bloke.com -- is a free Java counter which updates itself in real time as your page is visited. You add this counter to your page by inserting a few extra lines of HTML, and you can configure it to suit your taste. Once installed, the counter works by first loading the Java code from a remote server, then contacting that server again to consult a database which contains the number of hits for your page, and then finally displaying the result on your page. The only major disadvantage of java-based counters is that they won't work with browsers that aren't Java-enabled.
- Belinda Taylor


Category: Internet
Issue: Apr 1998

These Web pages are produced by Australian PC World © 1997 IDG Communications