The SIPB Counter Scripts

SIPB provides two counter scripts. One is the traditional, ever increasing counter script. The other is averages the number of hits you receive over time and reports number of hits per day.

This document explains how to use the counters in your own web pages. The SIPB counter is a script that can report how many requests (some people call them hits) have been made to a particular home page. It can be useful to determine which pages are more popular and to give you that nice rush when it jumps to two digits.

How to use the counters:

1. Write your page.

You should first have an already established home page. Counters are much more useful on completed pages. It's not considered overly useful to place a counter on a page that just says 'under construction'.

2. Choose a unique identifier.

Next, choose an identifier that will uniquely name your counter image. If you have just one counter, we recommend your username as the identifier.

3. Place the inlined counter image in your page.

Finally, place the following code in your HTML document (where username is your username). If you want to use the average-hits-per-day counter instead of the normal counter use /cgi/perday/username in place of /cgi/counter/username, as below.

<!-- Note to anyone copying the HTML for the following counter: 
the counter name ("username" on this page) must be unique.
Otherwise different pages will increment the same counter. See -->

This page has been accessed at least
<a href=""><img 
src="" alt="several"></a>
times since the counter was last reset, 
<!-- shouldn't happen, but include the disclaimer anyway -->
or January 29, 1996, 
<!-- when the counter with this name was first used --> 
whichever is more recent.

This will create an image showing the number of times the image has been retrieved. Note that you can use any key instead of your username in order to have multiple counters on other pages. Howewer, you almost certainly want to make sure your counter's name is unique, so that multiple people don't increment the same counter. (I suggest that you note this in an HTML comment on your page, so other people who copy the section from your page don't use the same name and increment *your* counter every time someone accesses *their* page.) Since any non-special character should be legal in the identifier, one way to help ensure this is to use your lockername and the path from there to your page in the countername.

Questions and Answers:

Q. How do I know my counter identifier is unique?
A. If you try your counter for the first time and see a number greater than you expect (say, more than 1), someone else may be using this identifier. Choose something unique (e.g., not foo or counter).
Q. Can I get the usernames/hostnames of who is accessing my page?
A. No. The script simply reports a bitmap image of the number of requests.
Q. What increments the counter? Magic?
A. Every time a page containing your counter image is requested, the counter is incremented by 1.
Q. Does the counter database get reset?
A. In response to many requests, the SIPB webmasters have stopped resetting our counter. However, please note that the counter will always undercount, since it won't increment when the image for that counter is cached.
Q. Then how do I reset the counter?
A. Choose a new unique identifier. It will start out at 0.
Q. I'm confused. Counter? I thought that's what you place a computer on.
A. You are confused. Mail and we'll try to assist you.
Q. I use a non-default background color. The counter image can't be seen because of my dark background. Can I change the counter color?
A. No. Unfortunately we do not have this functionality. You're welcome to program such a counter for us. We just haven't had the time. You can, however, put it in a little table of its own with a white background, which will work in most browsers.
Q. How does the average-hits-per-day counter do its calculation?
A. The perday counter keeps track of when it was first used, and the total number of hits it has received. If it has been in use for less than a day, it just reports the total number of hits, otherwise it averages over time. That is, if you set it up, and check back in 3 hours and you've received 21 hits, it will report 21 hits per day. If you check back 36 hours after setting it up and you have received 150 hits, it will report 100 hits per day.
This page has been accessed at least several times since the counter was last reset, at an average rate of at least hits per day.
[ home page] [personal home pages] [activities and clubs] [gateways and services] [local content] [help resources]