Maintained by ic@ucsc.edu |
Adding a hit counter to a webpage on the IC serverInstructional Computing has a piece of software called a CGI script that you can access in order to place an image on your web site that will keep track of every visit to your site. Such a device is called a counter. In order to use the counter, you will need to edit your HTML page. Locate the place in your web page where you want the counter to be displayed. You will use the "IMG" tag to insert the counter into your page. In order to keep track of visits to your site, the counter has to create a small data file. This file has to have a unique name, so you should name it using the abbreviated name of your course + your initials. In the following line of code, you must use a unique file name instead of the name "sample.dat."
<img src="/cgi-bin/Count.cgi?df=sample.dat">
For example, if your web page is for the ASTR 101 course and your initials are KMS, you could name the data file astr101kms.dat and use the following line of code:
<img src="/cgi-bin/Count.cgi?df=astr101kms.dat">
That code would generate the image on the right. By adding options to the end of the string, you can change the way the counter looks. For example, adding "|ft=1" at the end removes the frame around the counter, as shown below.
<img src="/cgi-bin/Count.cgi?df=sample.dat|ft=1">
Adding "|dd=B" at the end changes the counter to use the "B" style of digits.
<img src="/cgi-bin/Count.cgi?df=sample.dat|dd=B">
Adding "|dd=C" at the end changes to the "C" style of digits.
<img src="/cgi-bin/Count.cgi?df=sample.dat|dd=C">
Adding "|dd=D" at the end changes the digits to "D" style.
<img src="/cgi-bin/Count.cgi?df=sample.dat|dd=D">
Adding "|dd=E" at the end changes the digits to the "E" style.
<img src="/cgi-bin/Count.cgi?df=sample.dat|dd=E">
Multiple options can be chosen by listing one after the other. For example, "|ft=1|dd=C" causes the counter to be displayed with "C" style digits without a frame.
<img src="/cgi-bin/Count.cgi?df=sample.dat|ft=1|dd=C">
A full list of options is available at the counter's author's webpage. Please use the form below to tell us what you think of this page. USCS Faculty Instructional Technology Center |