Stupid Web Tricks: Count your visitors

Show the world how popular you are. Learn how to add a hit counter to your site.

Click here for our complete list of Stupid Web Tricks.

Humans are social creatures; we like to go along with what's popular. So it's important to show your readers how many other people have found your site compelling enough to visit.

Hit counters are also useful for evaluating your own efforts. Was an online guide to steakhouses of the Southwest a practical use of your time? Or do you need a larger marketing budget? It's easier to justify these decisions—to your boss, to your spouse—when you have some hard data. A visitor counter isn't exactly the Rolls-Royce of traffic-tracking tools, but at least it's cheap and easy to do.

There are several ways to add a visitor counter to your site. Some are trickier than others, and some may be flaky. Which approach you choose depends on how much effort you want to put into it and how much you want to get out of it.

Rely on Your ISP
Before you go looking for a complicated solution to track your page hits, check with the Internet service provider (ISP) that hosts your site to see if it offers a solution. Many ISPs provide simple instructions for either checking your own totals or putting the number in your HTML so visitors can see it. This is probably your easiest and most reliable option. Check your ISP's Web site or customer information for instructions on how to add a counter to your page.

Use Someone Else's Counter
The Web is crawling with free or very cheap counters that are ready for you to plug into your page. These sites usually ask you to register and then offer a piece of code to paste into your HTML page. Every time a visitor loads your page, the code calls the information from the counter provider's server, which tracks how many times it's been contacted and sends over a new GIF or text number to display the correct information.

The advantage to this method is that everything is done for you. The disadvantage is that it relies on an outside server to pass your page the information each time the page loads. That may take a while or even fail, depending on the reliability of the external server. Some counters are Java applets and may slow or crash your visitors' browsers. And these problems may affect the accuracy of the numbers you get.

If you need only general numbers, there are a few counters you might want to check out:

FastCounter from Microsoft's bCentral is free, and yes, it's fast. Although the counter sports a small logo, the quick setup process lets you choose from a number of colors. As a registered user of FastCounter, you can also visit the FastCounter site to get your weekly traffic numbers.

LE FastCounter

For reviews of counters both free and almost free, visit

Use Your Own Script
If the ISP that hosts your site doesn't provide traffic data, and you don't trust an outside service to count your visitors, consider setting up your own Perl script to track the information. It ain't exactly easy, but it puts you in complete control.

Before creating your own counter script, be sure to check with your ISP to see that you are allowed to run CGI scripts on the host server. Some ISPs have policies that prohibit users' CGI scripts, because poorly written scripts can crash the server or open security holes. On the other hand, many ISPs provide a library of prewritten, preapproved Perl scripts for use on members' sites.

Note:'s usage data is proprietary. The above numbers do not accurately reflect usage of this page.

Editor's Picks