Webguide Home | Search
New York University

Web Site Development

Hit Counter

A counter is a way for you to keep track of how many people have looked at your web page. The counter image is added just like any other; with an <img src> tag.

Basic Web Counter

If your web page is on www.nyu.edu, then use the following tag to add a counter to it:

<img src="http://www.nyu.edu/bin/Count.cgi?df=NetID.dat" />

Be sure to replace NetID with your username on i4.

If your web page is on homepages.nyu.edu, please see the NYUHome Online Help Guide section on Adding A Counter.

Important: If you want to use more than one counter in your web pages, be sure to give each of your .dat files a unique name, such as NetID.1.dat, and NetID.2.dat, etc.

You'll never see the .dat file; it resides in the central /bin directory on the Web Server, and the counter program updates it each time someone views the Web page that you have the counter on.

The counter image can be customized to suit your personal tastes. For instructions on how to do so, please see the Customizing Counter Page.

Note: Customization is not necessary. Your counter will work fine without any changes.

Customizing Your Web Counter

The web counter installed on www.nyu.edu is a powerful program, and can be customized by each user to suit his or her personal preferences. While a default style is provided, you may find that you want to personalize the look of your counter, and this page will serve as an introduction for doing so.

The default counter style looks like this:

It is created by adding the tag:

<img src="http://www.nyu.edu/bin/Count.cgi?df=NetID.dat" />

Remember to replace NetID with YOUR i4 NetID.

Adding options to your counter is easy. All it involves is adding some extra information to the <IMG SRC> tag you use to call your counter. A customized counter tag will generally take the form:

<img src="http://www.nyu.edu/bin/Count.cgi?Option#1&Option#2&Option#3|df=NetID.dat" />

Note that all the options come after the full URL to the Counter program, and are separated by &. After all the options are finished, a | is placed before the name of the data file to be used.

Available Options

  • Digit Styles
  • Frame Color
  • Frame Thickness
  • Display Types
  • Timezone and Time/Date Format
  • Examples

Digit Styles

Five different styles of digits are provided for your use. They are:

Style Name Style ID Example
Style AstyleA
Style BstyleB
Style CstyleC
Style DstyleD
Style EstyleE

In order to use one of the other digit styles, insert the option string dd=X, where X is A, B, C, D, or E, depending on which digit style you want to use.

Changing Frame Color

You can change the color of the frame that surrounds your counter the same way that you change the color of your background: using Hexadecimal codes to represent RGB colors. The option used is frgb=R;G;B, where R, G, and B are the RGB values for the color you want. Note that they are all separated by semicolons. Hexadecimal codes for some of the most common colors follow:

Color R G B
Red25500
Orange2551650
Yellow2552550
Green02550
Blue00255
Violet238130238
White255255255
Black000

A full list of all possible colors is available. Warning! it is quite long.

Changing Frame Thickness

You can also change the thickness of the frame that surrounds your counter. To do so, use the option ft=X, where X is the number of pixels thick you want your frame to be. Values over 5 make a nice, 3-D effect (5 is the default setting). If you want no frame around your counter, use a value of 0 for frame thickness.

Display Types

In addition to displaying the number of times your web page has been accessed, the counter program can also show the current date or the current time in a separate window. To display the time or the date, use the option display=X, where X is either clock, or date, depending on what you want to display. For example, to display the date, you would use the option display=date, and to display the time you would use the option display=clock. You do not need to include a display=X option if you want to display a counter; that is the default.

Note: A counter set to date or time will not also show the number of hits. You need to have a separate <img src="" /> tag calling the counter for each function that you want to use.

Changing the Timezone and Time Format

If you choose of use the counter as a clock, you can specify both the timezone to be used, as well as the format of the time. To change the timezone, use the option timezone=X, where X is the time + or - from Greenwich Mean Time (GMT). For example, to display the time in New York City, you would use the option timezone=GMT-0500.

To change the time format of you clock between 12 and 24-hour, use the option tformat=X, where X is either 12 or 24.

If you use the counter to display the date, you can change the format that it displays the date in with the option dformat=X. Values for X should be any combination of the strings MM, DD, YY. dformat=MMDDYY, dformat=ddmmyy, and dformat=YYDDMM would all be valid values.

Examples

Here are some examples of the different options for you to look at. The <IMG SRC> tags used to create them are listed beneath them.

Digit Style B with no Frame

<img src="http://www.nyu.edu/bin/Count.cgi?dd=B&ft=0|df=ex2.dat" />

Digit Style C with a gold frame

<img src="http://www.nyu.edu/bin/Count.cgi?dd=C&frgb=255;215;0&ft=4|df=ex3.dat" />

A Clock using Digit Style D

<img src="http://www.nyu.edu/bin/Count.cgi?display=clock&dd=D|df=ex4.dat" />

The Date using Digit Style B in MMDDYY format

<img src="http://www.nyu.edu/bin/Count.cgi?display=date&dformat=MMDDYY&dd=B|df=ex5.dat" />

The Date in DDMMYY format using Digit Style A and a Violet frame

<img src="http://www.nyu.edu/bin/Count.cgi?display=date&frgb=238;130;238&ft=4&dformat=ddmmyy|df=ex6.dat" />