Hit counters on Wake Forest University web pages

Note: this page is retained for archival purposes only. It is no longer valid for installing hit counters on your WFU web pages.

WFU Information Systems provides a convenient utility for tracking visits to your web pages.

Installing hit counters using Dreamweaver

Dreamweaver is the best web authoring tool around, and Wake Forest has a site license. If you are not using it, get it.

To place a hit counter on your web page in Dreamweaver, choose from the menu strip

Insert > Comment

then in the comment box type

#exec cmd="/pub/gopher-data/cgi-bin/access_count userid-countername"


Here is what I inserted for this web pages counter. My user ID is "matthews", and I call this page "HowToCounters-00-10-29".

You can see this in use at the end of this line, which is where I inserted the above comment: [an error occurred while processing this directive] hits.

Installing hit counters in plain HTML

In your web page where you want the number of hits displayed, insert the following html:

<!--#exec cmd="/pub/gopher-data/cgi-bin/access_count userid-countername" -->


<!--#exec cmd="/pub/gopher-data/cgi-bin/access_count matthews-home-99-10-28" -->

Creating a web page showing a summary of all your hit counters

I generally make my page counters invisible on the pages where they reside; all that is necessary is to set the font color around the counter HTML to the background color. I prefer to see all my counters in one place, as shown here.

How to do it

  1. Create a directory under your www-home directory called cgi-bin.

  2. Create a file in this directory called grepcounters in this directory, and be sure it has read and execute permissions. The file grepcounters contains the following text:
#!/usr/bin/ksh -f
echo 'Content-type: text/html\n\n' 
echo "<html><head>"
echo "<Title>Page Counter Summary</title>"
echo "</head>" echo "<body>" echo "<h1>My Page Counters</h1>"
echo "<pre>" date grep userid /pub/gopher-data/.counts echo "</pre>" echo "</body></html>"

Change userid above to your Wake Forest login. This creates a web page that displays all hit counters containing the character string userid, which should just be a list of all your hit counters.

The URL of this web page is not obvious:


How it works

You only need to read this if you want to play around with your own version of grepcounters.

Grepcounters is an example of a cgi program. This can be any program that can execute on ac, including shell scripts. The program needs to generate an output that looks like the HTML of a standard web page.

In the above example, nearly the whole ksh script is just echoing commands writing standard HTML. The most important part consists of two UNIX commands:

The only subtleties involved are getting the "Content" line right, including new line characters, and running this under ksh. There is a bug in the AIX csh echo command that fails to properly produce end of line characters.


Thanks to C.W. Yip for teaching me everything on this page.

Getting started in Dreamweaver

Miscellaneous tips and info

Rick Matthews' home page