A number of readers have asked about creating page counters, so I thought I’d dump a few ideas as to how to create counters. Older style counters relied on a graphic being loaded on each page being counted, and this is still possible. Simply create an IMG tag like this:
<img src=”mycounter.asp” height=1 width=1>
The mycounter.asp page is responsible for counting the page hit and redirects the output to an invisible, 1x1 pixel graphic, for instance.
A more elegant and efficient way is to call a function in the page to record a hit to a permanent storage system, like a database. The database can record the page name (from Request(“SCRIPT_NAME”)) and increment the number of pages through a quick stored procedure. A timestamp can be added on automatically, if necessary, or you can simply update the total if you’re not tracking the actual hits.
In short, there are lots of ways to count your visitors…it just depends on what you’re going to do with the information eventually.