Web Page Counter User Guide
Portions by Muhammad A MuquitPortions by Bob Eckert / UITS
Table of Contents
-
What is a page counter?
Is there a special format for the name of the datafile that is created to hold my counter data?
What are some features of the counter service?
How do I use a page counter in my document?
How many distinct counters can I have?
Can web pages on servers other than Webserve use this counter service?
Counter Styles Table
Counter Options Table
Examples of Counters
Can I change the style of the digits used in the counter?
Can I use the names of colors when I specify the colors of my counter?
What is a page counter?
A web page counter is a server program that receives a request as an HTML IMG reference in a document, increments a counter for that document in its database and sends back a graphic image of a counter showing the total 'hits' for the document containing the counter image.For example, take a look at the two HTML fragments below...
Example 1: <img src="http://www.indiana.edu/~counter/Count.cgi?df=mgrwww-cntinfo.dat &comma=T&chcolor=T" alt="***" align=absmiddle> Example 2: <img src="http://www.indiana.edu/~counter/Count.cgi?display=clock&chcolor=T" alt="0:0" align=absmiddle>
...displays the counter for the page you are reading now and a
clock showing the current time.
The parameter 'df=' is very important. Please read the
documentation about it.
The two examples look like this:
In example 1 above, this portion of the IMG SRC...
?df=mgrwww-cntinfo.dat&comma=T&chcolor=Tis called the counter options string. The counter options in the string determine what the counter (or time/date display) will look like. Additionally, a set of counter styles is provided which may be expanded from time to time. The counter option fields in the counter URL should be separated by an ampersand ("&") character.
Is there a special format for the name of the datafile that is created to hold my counter data?
Yes, and perhaps the most important of the counter options is the 'df' (datafile) option. The data file option specifies which counter is being referred to by the name of its associated data file.It is also important to remember that if you use the same counter data file name in a non-secure counter URL (http://...) then use the same name in a secure counter URL (https://...), the same data file is updated. If you must keep these counters separate, we suggest that you name your data files differently.
The format of the name of the data file where the counter information for the referring page of a non-secure server looks like this:
df=<ip account name>-<counter-name>.dat
The format of the name of the data file where the counter information for the referring page of a secure server looks like this:
df=<ip account name>-secure-<counter-name>.datwhere: <ip account name> is your web account name, and <counter name> is a 1-16 character unique name for the counter. This name may contain only letters (all lowercase is strongly suggested), the digits 0-9, and the underscore ('_') character. Note that a dash ('-') separates the <ip account name> and the <counter-name>.
So complete examples of counter data file name are:
- myacct-myfirstpage.dat for HTTP (non-secure server page).
- myacct-secure-myfirstpage.dat for HTTPS (secure server page).
What are some features of the counter service?
|
How do I use a page counter in my document?
It is easy to embed a counter in a document. A very simple counter could be inserted with the IMG URL examples shown below. In these examples, the web account name is iubip and the counter name chosen is home_count.dat.For non-secure server pages (HTTP):
<img src="http://www.indiana.edu/~counter/Count.cgi?df=iubip-home_count.dat">
For secure server pages (HTTPS):
<img src="https://www.indiana.edu/~counter/Count.cgi?df=iubip-home_count.dat">
How many distinct counters can I have?
A 10 counter limit per IP account name should be more than adequate for the vast majority of web site owners.
Can web pages on servers other than Webserve use this counter service?
No, this service is only available to account owners that have an account on IU's central web servers.
Counter Styles Table
| Style A | |
designed by Kevin J. Walsh (digits/A/strip.gif) |
|---|---|---|
| Style B | ![]() |
Borrowed from HTML-access counter. (digits/B/strip.gif) |
| Style C | ![]() |
designed by benjamin@pop3.oro.net (digits/C/strip.gif) |
| Style D | ![]() |
designed by the author (digits/D/strip.gif) |
| Style E | ![]() |
designed by the author (digits/E/strip.gif) |
Counter Options Table
| Parameter | Name | Description | Default |
|---|---|---|---|
| display=X | Specifies what to display. | A valid string can be specified with display= parameter to display counter, clock or date. The valid value for the string parameter X is counter,clock or date For counter, this parameter is not need as counter is the default display type. | display=counter |
| timezone=X | Display time/date of the specified timezone. | The parameter timezone= is only significant with display=clock
or display=date. Use this parameter if you want to display time or
date of another timezone. The timezone must be specified with a negative
or positive four digit offset from GMT, for example: timezone=GMT-0500
or timezone=GMT+0000 or timezone=GMT+0530. The routine to
display time of various timezones are written in a generic way. Therefore,
the unix machines will not be aware of daylight saving time because of the
way the routine is written. For example, if daylight saving time is on,
to display time of NY, the timezone will be timezone=GMT-0500 instead
of timezone=GMT-0400.
If the clock displays your local time wrong, specify your timezone with that parameter in order to display the correct time. |
None. |
| tformat=X
|
Time format in 12 or 24 hour. | This parameter can be used to display time in 12 or 24 hour format. The valid values for the parameter X is 12 or 24. | tformat=12 |
| dformat=X | Specifies date format. | This parameter is only significant with display=date. The valid value for the string parameter X is any combination of MMDDYY (Month-Day-Year). For example, dformat=ddmmyy, dformat=YYMMDD. | dformat=MMDDYY |
| istrip=B
|
Use of image strip On/Off | The boolean value of istrip specifies whether to use image strip or not. If you specify istrip=F, the program will look for the individual digit image files in the digits/style directory. The valid values for the Boolean parameter istrip are Y, N, T, F, 1 or 0. | istrip=T |
| ft=X | Frame Thickness | You can wrap the counter in an ornamental frame of X pixels thick. Use 0 for no frame. Values over 5 make a nice 3-D effect. | ft=6 |
| frgb=color | Frame Color | Specifies the color of the hit-counter's frame. If you specify a frgb= without a ft=, then the frame thickness defaults to 5. All the examples show ft=5. The color can be specified as hex string or a name. Do not use a # before the hex string as Netscape. For example, if you want to specify white in hex, use frgb=ffffff. You also can use a color name (e.g. frgb=blue) if the counter is configured to do so (look at the cfg file). | frgb=648bd8 or frgb=CornflowerBlue |
| tr=B | Transparency On/Off | You can specify if your counter image will have a transparent color with the Boolean B. So tr=Y means there will be a transparent color. It does not matter if the GIF files used for the digits are "transparent"; you must specify explicitly which color to make transparent. If you specify a trgb=, then you do not need to specify tr=Y. If you specify tr=Y and do not specify trgb=, then the default color black will be transparent. The valid values for B are Y, N, T, F, 1, or 0. | tr=F No Transparency |
| md=X | Max Digits | Defines maximum number of digits to display. Any value between 5 and 10 inclusive are permitted. Padding with leading zeros is automatically done for you; longer counts are truncated to the given X. | md=6 Without padding |
| pad=B | Padding with 0's | Turn padding on/off in conjunction with md= setting. Valid values for the Boolean parameter B are Y, N, T, F, 1, or 0. | pad=N Without specification of a md=value pad=Y |
| dd=A | Digit Directory | Denotes directory of a specific styles of digits. Five styles of digits are supplied. They are kept in the digits directories A, B, C, D, and E, respectively. | dd=A Green LED digits |
| image=gif_file
|
Display this GIF file | You can display any GIF image specified with this parameter. The location of this file is determined by the dd= parameter. All attributes of the counter apply to the image. | None |
| comma=B
|
Display comma after every 3rd digit from right. | The boolean value of parameter comma specifies whether to display comma after every 3rd digit from right. If you use this parameter as true, the left padding with zeros will be turned off. | comma=F |
| srgb=color prgb=color
|
Change a color of the image to a target color on the fly. | Any one color of the image can be changed to a different color on the fly. srgb stands for source color, that is the color to change. prgb stands for pen color, that is the target color. The values for srgb and prgb can be a hex value (e.g. srgb=ff0000) or a color name (e.g. srgb=red). The color name can be used if you configured the counter to do so (look at the cfg file). | srgb=00ff00 (green) prgb=00ffff With chcolor=T |
| chcolor=B | Change a color of the image. | This parameter is usually used to change the default green color to cyan. That is if you specify chcolor=T, and you want to change green to cyan, then you do not need to specify srgb and prgb parameters. 1x1 GIF is displayed. The valid values for the Boolean parameter B are Y, N, T, F, 1, or 0 | chcolor=F |
| st=X | Start Count | This parameter is used to set the initial value of the counter to some number X. This is only valid if you decided to allow automatic datafile creation. It is a bad practice to allow automatic datafile creation, however it makes site maintaining easier. The automatic datafile creation option is specified in configuration file and can be changed at run time. The minimum value for st is 1. Note that this parameter has no effect if the datafile already exists. If you want to change the counter value in a existing datafile, contact IU Webmaster who will edit the file. Please include your web account name and the counter filename in your message. | st=1 Count starts at 1 |
| sh=B | Show digits | Used to turn display of digits on or off according to the Boolean B.
When sh=T, counter will be displayed and incremented, this is the default
behavior.
If sh=F no digits will show, but the counter will still increment; instead of digits a transparent 1x1 GIF is displayed. The valid values for the Boolean parameter B are Y, N, T, F, 1, or 0 |
sh=Y |
| df=data_file | Datafile to store count | Specifies the name of the file for storing the count in. The file must
be allocated to you as was mentioned in the "Authorizations" section above.
You can use df=random to display a random number.
One special use of the parameter is df=RANDOM. This returns a random number using the fractional portion of the host's time of day clock as a seed for the generator. Unlike all other WWWcounter parameters, the file name provided is case-sensitive, except for the value random. Or Random, or rANDOM, etc. |
df=random if no datafile is specified |
| incr=B | Increment Count | Makes it possible to display the current count without incrementing the
count. This can be used to examine the count for reporting or other purposes
without adding to the count. Valid values for the Boolean parameter B are
Y, N, T, F, 1, or 0.
|
incr=T Increment the counter on each invocation |
| lit=X | Display literal | Makes it possible to display a given, predetermined string. The valid values for the string X are digits, a,p,: and - | None |
| negate=B | Negate the color | Makes it possible to negate the color of the counter digits. Note that the Frame is exempted from negating. Valid values for the Boolean parameter B are Y, N, T, F, 1, or 0. | negate=F Do not negate |
| degrees=X | Rotate X degrees | Makes it possible to rotate the counter image X degree. The possible values of X is 90, 180, 270 and 360. Note 360 is meaningless as the counter will come back to the original 0 degree. | degrees=270 With rotate=Y and without degrees=X rotate 270 degrees clockwise |
| rotate=B | Rotate On/Off | The Boolean value B turns on or off rotating. If you use degrees= setting, rotate is not needed. Valid values for the Boolean parameter B are Y, N, T, F, 1, or 0. | rotate=F Do not rotate |
Examples of Counters
These examples were written for counters in non-secure server pages. You can replace http://www.indiana.edu/~counter/Count.cgi with https://www.indiana.edu/~counter/Count.cgi in the <img> tag commands below so they will work for secure server pages.The counter images below were made with the described URL tags and were not generated when this page was loaded.
The counter option fields in the query strings must be separated by an ampersand ("&").
Frame color and Thickness
A frame with a bluish color is wrapped by default. You have to use ft=0 to disable this behavior.<img src="http://www.indiana.edu/~counter/Count.cgi">
This may not work with all browsers. You should use at least one keyword in the query string (for example, df=data_file ). Random counter is displayed as no data file is specified. The default frame thickness, color and digit style is used.
<img src="http://www.indiana.edu/~counter/Count.cgi?ft=1">
No df= option, therefore random digits are displayed. Because of ft=1 no frame was wrapped.
<img src="http://www.indiana.edu/~counter/Count.cgi?ft=6">
Random digits. Wrapped frame is with default color and thickness.
<img src="http://www.indiana.edu/~counter/Count.cgi?ft=10&df=x.dat">
Random digits. Wrapped frame is with default color and specified thickness.
<img src="http://www.indiana.edu/~counter/Count.cgi?frgb=ffd700&df=x.dat">

The wrapped frame is of the specified color and default thickness. The color is used as hex string. Note: DO NOT add # before the string as you do when writing HTML code. In a query string, everything after # is ignored, so be careful.
Or you can even use the color name. You have to add this support while you configure the counter using the Count-config script.
<img src="http://www.indiana.edu/~counter/Count.cgi?frgb=gold&df=x.dat">
Comma can be displayed
<img src="http://www.indiana.edu/~counter/Count.cgi?ft=0&df=x.dat&comma=T">
Rotation
<img src="http://www.indiana.edu/~counter/Count.cgi?ft=0&rotate=Y&df=x.dat"> <img src="http://www.indiana.edu/~counter/Count.cgi?ft=0°rees=180&df=x.dat"> <img src="http://www.indiana.edu/~counter/Count.cgi?ft=0°rees=90&df=x.dat">
The first counter is rotated by default 270 degrees toward right; no angle is specified as rotate keyword is used.
Digit Styles
<img src="http://www.indiana.edu/~counter/Count.cgi?dd=A&df=x.dat"> <img src="http://www.indiana.edu/~counter/Count.cgi?dd=B&df=x.dat"> <img src="http://www.indiana.edu/~counter/Count.cgi?dd=B&frgb=458B74&df=x.dat"> <img src="http://www.indiana.edu/~counter/Count.cgi?dd=C&df=x.dat"> <img src="http://www.indiana.edu/~counter/Count.cgi?dd=D&ft=3&df=x.dat"> <img src="http://www.indiana.edu/~counter/Count.cgi?ft=2&frgb=000000 &dd=E&df=x.dat">
These are the supplied digit styles.
Change any color
Change green color to red<img src="http://www.indiana.edu/~counter/Count.cgi?df=x.dat &srgb=00ff00&prgb=ff0000">
Negate the colors
<img src="http://www.indiana.edu/~counter/Count.cgi?negate=T&dd=A&df=x.dat">
Note that the digit color is negated but the frame is not.
Transparency
A specific color of the digits can be made transparent on the fly. Note that the counter program does not care if your gif images are transparent or not. You have to tell it explicitly which color to make transparent. Here we will make the white color of the digit style E transparent. In order to simplify the counter's appearance, we will not use a frame either.
<img src="http://www.indiana.edu/~counter/Count.cgi?dd=E &ft=0&tr=T&trgb=ffffff">
Make the black color of the digit style A transparent:
<img src="http://www.indiana.edu/~counter/Count.cgi?dd=A&tr=T&trgb=000000 &df=x.dat"> or <img src="http://www.indiana.edu/~counter/Count.cgi?dd=A&tr=T&trgb=black &df=x.dat">
Make the green color of the digit style A transparent:
<img src="http://www.indiana.edu/~counter/Count.cgi?dd=A&tr=T &trgb=00ff00&df=x.dat"> or <img src="http://www.indiana.edu/~counter/Count.cgi?dd=A&tr=T &trgb=green&df=x.dat">

Hide the counter
You can keep the counter hidden if you like. You can do this by using the Show Digits parameter sh=0. The hit will be recorded but the counter will not be displayed. A 1x1 transparent GIF image is written which gives the illusion of an "invisible counter." You can use the no-increment feature for monitoring those hits to a secret page (described later).
<img src="http://www.indiana.edu/~counter/Count.cgi?sh=0&df=x.dat">
Monitor counter hits
You might have kept your counter hidden (or not). You can monitor the hits from another page just specifying the datafile and the keyword incr=F<img src="http://www.indiana.edu/~counter/Count.cgi?incr=F&df=page1.dat"> <img src="http://www.indiana.edu/~counter/Count.cgi?incr=F&df=page2.dat"> <img src="http://www.indiana.edu/~counter/Count.cgi?incr=F&df=page3.dat">
Number of digits
Say you want to display the counter in 5 digits only.<img src="http://www.indiana.edu/~counter/Count.cgi?md=5&df=x.dat">
or you do not want to left pad with zero, you want to display exact digits.
<img src="http://www.indiana.edu/~counter/Count.cgi?pad=0&df=x.dat">
Literal
You can display a string literally. The valid characters in a string are 0123456789,:-ap<img src="http://www.indiana.edu/~counter/Count.cgi?lit=0123456789"> <img src="http://www.indiana.edu/~counter/Count.cgi?dd=B&lit=0123456789"> <img src="http://www.indiana.edu/~counter/Count.cgi?dd=C&lit=0123456789"> <img src="http://www.indiana.edu/~counter/Count.cgi?dd=D&lit=0123456789"> <img src="http://www.indiana.edu/~counter/Count.cgi?ft=0&tr=1&trgb=ffffff&dd=E &lit=0123456789"> <img src="http://www.indiana.edu/~counter/Count.cgi?lit=a1,456-:p">
Counter as clock
Display time in 12 hour format.<img src="http://www.indiana.edu/~counter/Count.cgi?display=clock">
Display time in 24 hour format.
<img src="http://www.indiana.edu/~counter/Count.cgi?display=clock&tformat=24">
Display date
<img src="http://www.indiana.edu/~counter/Count.cgi?display=date">
Use timezone parameter to display time or date of any place in the
world.
Display an image
Display a GIF image kept at digits/D directory.<img src="http://www.indiana.edu/~counter/Count.cgi?ft=20&dd=D&image=lenna.gif &frgb=powderblue">
Can I change the style of the digits used in my counter?
Unfortunately, no. You must use one of the digit styles provided.Can I use the names of colors when I specify the colors of my counter?
Yes. For more information, see: Counter Color Name Table.







