The SIPB Counter Script

This document explains how to use the counter 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 counter:

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):

	
<!-- 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
http://www.mit.edu/doc/counter-howto.html. -->

This page has been accessed at least
<a href="http://www.mit.edu/doc/counter-howto.html"><img 
src="http://www.mit.edu/cgi/counter/username" 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 webmaster@mit.edu 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.
This page has been accessed at least several times since the counter was last reset.
[www.mit.edu home page] [personal home pages] [activities and clubs] [gateways and services] [local content] [help resources]
webmaster@mit.edu