ADDING A COUNTER

A counter can provide the creator of a Web site with a rough idea of how many hits a Web page has received. In order for the counters in this tutorial to work on your Web site, CGI (Common Gateway Interface program) must be installed on your Internet Server Provider's server network. Don't panic. Unless you have a very small and obscure ISP, you don't even have to think about this. Just know that CGI is a program on your ISP's server and in this case, it keeps track of the number of hits, updates the number of hits each time a Web page containing the counter is loaded, and creates the image of the counter with the number of hits.

The most important thing to remember is that because your counter relies on CGI to record hits and produce the counter image, when you preview your Web page with the counter off-line, it will ALWAYS appear as a broken graphic. You must upload the HTML page to your server and view it online in order to see your counter.

Totally confused and ready to give up? Okay, then just copy the following code and paste it into your HTML document wherever you want your counter to fall:

<P>
<img src="/cgi-bin/Count.cgi?
ft=2&frgb=0000FF&dd=B&df=mydata.dat">
<P>

Upload the HTML document and view it online. You should have a counter that looks like this:

That's all there is to it. Now, if you want to learn how to change the counter's frame width and color, digit style, etc., READ ON.

Let's look at the source more closely:

<P>
<img src="/cgi-bin/Count.cgi?
ft=2&frgb=0000FF&dd=B&df=mydata.dat">
<P>

Notice that you use the Image Source tag (img src=) just as you do for GIF and JPG graphics. The difference, however, is that you are not designating a path to an existing graphic. Instead, you are querying CGI and telling the application how to create a graphic — in this case a counter. Lets dissect the query string above:

/cgi-bin/Count.cgi? ... queries the CGI app on your ISP server

ft=2 ... the value in pixels for your counter frame thickness (or width)

frgb=0000FF ... the frame color

dd=B ... the number (digit) style

df=mydata.dat ... specifies the name of the file (mydata.dat) for storing the number of hits (the count). You can call your file whatever you want but give it the .dat extension.

The variables are all separated by an &. So, the following string will produce a counter that has a frame thickness of 2 pixels, a blue frame, and the B digit style:

<img src="/cgi-bin/Count.cgi?
ft=2&frgb=0000FF&dd=B&df=mydata.dat">

TO CHANGE THE FRAME THICKNESS:

Increase the pixel value:

ft=0
ft=4
ft=6

TO CHANGE THE FRAME COLOR:

Change the color value (A chart of color values is HERE):

frgb=FF0000
frgb=00FF00
frgb=FFFFFF

TO CHANGE DIGIT STYLE:

There are five different number (digit) styles you can use for your counter:

dd=A
dd=B
dd=C
dd=D
dd=E

TIP: When you include a counter string in HTML pages in Adobe GoLive (CyberStudio), you get the green bug/missing picture error unless you do the following: Open your Preferences. Under the General submenu, click on URL Handling. Click on New and type in cgi-bin.

LINKS:
I found these Web pages helpful as well:
Adding Access Counts
ARCHES Counter

Digit Mania