How do I create a hit counter for my Web page?
We provide a hit counter script that you can add to your Web page. The counter script is preinstalled for all our Web hosting customers. You don’t need to download, install or configure anything extra to use it.
If you use the script, your visitor will see a picture that might look like this, for example:
To put the hit counter on a Web page, you need to add a tiny bit of HTML code to that page. You can do this with a text editor, or by using the “insert image link” feature of your Web design software.
On this page:
- Adding the HTML code
- Using the counter with WordPress
- Using your own counter images
- Using more than one counter
- Resetting the counter
- What if I don’t see a “counter.cgi” file on my site?
- What if the standard counter doesn’t meet my needs?
Adding the HTML code
In its simplest form, you use the counter by placing this snippet into the HTML source code of your Web page:
(In place of , use your own domain name.)
You can specify the frame thickness by adding ft=, like this:
That creates a 17 pixel wide frame. You can hide the frame completely by setting it to zero:
You can eliminate the leading zeros by adding pad=0, like this:
You can combine both of these commands to create a counter with no frame or leading zeros:
One final useful command is the ability to make any color transparent using trgb=:
The color to make transparent (FF0000 above) is specified as an RGB hexadecimal color value; FF0000 means red, 00FF00 means green, 000000FF means blue, FFFFFF means white, and 000000 means black. In this example, any part of the original image that was red will be transparent in the final counter. If you’d like to make another color transparent, any GIF editing program should be able to show you the color value of any color in your image file.
Using the counter with WordPress
If you’re using the WordPress software to run your site, you can add the HTML code above in its own widget so that it is displayed properly with the rest of your widgets. To do this:
- Login to your WordPress Dashboard.
- Choose Appearance > Widgets from the left menu.
- Select Text from the widgets menu and drag it to the location of your choice.
- Paste the HTML code shown above into the widget (leave the widget title blank).
Using your own counter images
Because the digits that make up your counter are just pictures, you can use other images as digits. This gives you the ability to make your counter look exactly as you want it to.
Here’s an example of how different your counter might look using simple image files:
You can use counter image files in two ways:
- If you have a single GIF image file that contains all the digits from 0 to 9, name that file counterdigits.gif and upload it to the top level of your website, just as you would upload any other image file.
- If you have ten separate image files (one for each digit), name them 0.gif, 1.gif, and so forth to 9.gif, then place them in a directory (folder) named counterdigits and upload that directory (folder) to your website. Either way, your custom images will be automatically used if they are present in your website’s directory.
Not the artistic type? No problem; there are a number of sites that provide counter digit pictures for free. One popular site is Digit Mania. You can download a directory of GIF files from them, then rename the files 0.gif, 1.gif, etc. Place all ten of these files in a directory named counterdigits on your site.
If you’re having trouble, make sure that any letters in your file names are entirely in lowercase, as shown above. They should look like counterdigits.gif, 2.gif and counterdigits; names like “CounterDigits.Gif”, “2.GIF” or “COUNTERDIGITS” won’t work.
Using more than one counter
Although most customers need only one counter, you can use up to 99 additional counters if you want different counter numbers for different pages.
To do that, just add a dot and a number to end of the df= value in the HTML code you use. For example, you might put this counter on one page:
... and put this separate counter on a different page:
Each counter will store a separate number.
By the way, the numbers are stored in your home directory in text files named “tigertech-counter.data”, “tigertech-counter.data.1”, “tigertech-counter.data.2”, and so forth. Don’t delete those files unless you want to reset your counter numbers to zero.
Resetting the counter
You can reset the main counter number to any value. To do this:
- Login to the “My Account” control panel (having trouble?)
- Click Counter
You’ll see a screen that allows you to reset the value.
Note that the control panel only changes the “main” counter; it won’t change the number stored for any extra counters you create using df=.1, etc. Those can be changed by editing the text files in your home directory (you can ask us to do so if you don’t know how).
What if I don’t see a “counter.cgi” file on my site?
It’s normal to not see an actual file named “counter.cgi” if you use an FTP program to browse your files. These instructions will work anyway.
What if the standard counter doesn’t meet my needs?
Our preinstalled counter script works without needing any special installation or configuration, which is ideal for most people. However, that ease-of-use does make it a little less flexible than some other counter scripts. For example, we’ve been asked if it’s possible to have different sets of custom digit images on different Web pages, which our script can’t do.
If you need a more flexible counter script and you feel comfortable installing it yourself, we recommend the nms Image Counter script. It works well and can easily be modified for almost any use, especially if you have programming skills.
Copyright © 2000-2020 Tiger Technologies LLC