Page Hit Counter

From SWCP Support Wiki
Jump to navigationJump to search

Web-page Access Counter

To put a counter on your page, just include an IMG tag which references the /cgi-bin/nph-count program with the appropriate arguments. The two arguments which you will always want to use are link and width.

link tells the program which page you want it to increment the counter for. This should always be the relative URL for the page which the counter is on. This way you can have counters on different pages and they won't interfere with each other.

width tells the program how many digits there should be in the image which it generates. Most pages use 5 digits, which will work well until your page has 100,000 visitors.

Here is the snippet of HTML which I use on my home page to invoke the counter:

    &ltCENTER&gt
    Thanks for dropping by.  You are visitor number
    &ltIMG SRC="/cgi-bin/nph-count?width=5&link=/~cheeks/index.html"&gt
    &lt/CENTER&gt
    

Notice that the arguments to nph-count are separated from the program name by a question mark (?), and the individual arguments are separated from each other by an ampersand (&). In the snippet above, link is set to /~cheeks/index.html (the relative URL for my home page), and width is set to 5.

The visit counting program which Southwest Cyberport has installed was written by Heini Withagen. What follows are the relevant parts of the FAQ which was distributed with the package. It explains the other arguments that the nph-count program can accept, and answers some common questions about usage. If you want to know more about the technical details of implementing such a program, follow the "WWW-page Access Counter" link below.