A graphical hit counter that creates counter images in-lined into your page without Server Side Includes. One of the most iconic scripts from the early web era.
Counter creates a graphical hit counter in-lined into your page without Server Side Includes. Unlike text-based counters, this script generates actual images showing your page hit count using customizable digit graphics.
counter.pl | Main counter program |
count.txt | Counter data file |
access_log | Visitor access log |
error_log | Error log file |
html_log.pl | HTML log formatter |
bad_referer.gif | Error image |
"Hit counters were the universal status symbol of the early web. Every webmaster proudly displayed their visitor count, often with elaborate animated digit designs."
Counter was part of a popular script collection from the mid-1990s. These free Perl CGI scripts powered millions of websites in the late 1990s, becoming popular tools for webmasters who wanted dynamic features without programming knowledge.
Hit counters fell out of favor in the early 2000s due to:
Some websites in the 1990s displayed counters starting at arbitrary high numbers (like 100,000) to appear more popular. This practice was so common it became a running joke in web design circles.
Today's visitor tracking has evolved far beyond simple hit counters. Modern analytics provide detailed insights while respecting user privacy.
Lightweight, privacy-friendly analytics. Script is 75x smaller than Google Analytics. GDPR compliant, no cookies required.
Open source, easy-to-use Google Analytics alternative. Free tier available, easy self-hosting with Docker.
Simple, privacy-first analytics. No cookies, GDPR compliant. Canadian company with strong privacy focus.
Industry standard with powerful features. Free for most sites. Requires cookie consent in EU.
Powerful open source analytics platform. Full Google Analytics feature parity. Self-hosted or cloud.
Simple, privacy-aware counter. Free for non-commercial use. Shows a visible counter if desired!
| Feature | 1996 Counter | Modern Analytics |
|---|---|---|
| Data collected | Page views only | Views, sessions, paths, events |
| User identification | IP only | Cookies or cookieless hashing |
| Real-time data | No | Yes |
| Geographic data | No | Country, city, region |
| Device info | No | Browser, OS, screen size |
| Referrer tracking | Basic | Full attribution |
| Server requirements | Perl + GD/FLY | JavaScript snippet |
| Privacy compliance | N/A | GDPR, CCPA options |
| Cost | Free (self-hosted) | Free to $50+/mo |
The FLY program provides an interface to the GD graphics library. It compiles on SunOS, OSF 3.2, and most Unix systems.
counter.pl → CGI-bin directorycount.txt → Data directory (writable)chmod 755 counter.pl
chmod 666 count.txt
chmod 666 access_log
Edit counter.pl and set paths, referer validation, and display options.
<!-- Basic usage -->
<img src="/cgi-bin/counter.pl" alt="Visitor Counter">
<!-- As background (creative use!) -->
<body background="/cgi-bin/counter.pl">
| Variable | Description | Example |
|---|---|---|
$basedir |
Base directory for counter files | /home/user/counter/ |
$count_file |
File storing the count | count.txt |
$digit_dir |
Directory with digit images | /images/digits/ |
$fly_path |
Path to FLY executable | /usr/local/bin/fly |
@referers |
Allowed referer domains | ('yourdomain.com') |
$log_access |
Enable access logging | 1 (on) or 0 (off) |
Download the Counter script package:
Common issues include:
In the 1990s, sites like GifWorks offered thousands of animated digit sets. Today you can:
Visible counters persist for several reasons:
We recommend modern alternatives for production use because:
This script is preserved for historical interest and learning purposes.
| Feature | Counter | TextCounter |
|---|---|---|
| Output | GIF image | Plain text/SSI |
| Requirements | FLY + GD | Perl only |
| Customization | Digit images | CSS styling |
| Server load | Higher | Lower |
Simple text-based counter using SSI. No graphics library required.
Visitor logging without visible counter. Tracks detailed access info.
Let visitors leave comments on your site.
See modern analytics alternatives and implementation guides.