Services
Support
Contact Us
Payments
Home

Support :: FAQs and Tutorials :: Answer

Adding a hit counter to your Web site

All customers who host a Web site with c4.net, regardless of whether or not they have their own domain or take advantage of c4.net's free Web space, may use the c4.net hit counter. The hit counter counts the number of times a specific page was viewed. The following is an example:

This page has been viewed Hit Counter times.

The following code displays the hit counter above:

<div align="center">
This page has been viewed
<img
    src="http://www.c4.net/scripts/Counter.cfm?"
    align="absmiddle"
    border="0"
    alt="Hit Counter"
/>
times.
</div>

The following is a list of the optional attributes which you can pass to the hit counter to control various aspects of the way it is displayed:

Digits
This is the number of digits (including leading zeros) that you want to use when display the hits. The following is a the same hit counter as above except it specifies that the hit counter should contain a minimum of 6 digits.

This page has been viewed Hit Counter times.

The following code displays the hit counter above:

<div align="center">
This page has been viewed
<img
    src="http://www.c4.net/scripts/Counter.cfm?Digits=6"
    align="absmiddle"
    border="0"
    alt="Hit Counter"
/>
times.
</div>

Height
This is the height (in pixels) of the hit counter. Only numbers between 10 and 30 may be used. The default is 20. The following is a the same hit counter as above except it specifies that the hit counter should be 30 pixels in height.

This page has been viewed Hit Counter times.

The following code displays the hit counter above:

<div align="center">
This page has been viewed
<img
    src="http://www.c4.net/scripts/Counter.cfm?Height=30"
    align="absmiddle"
    border="0"
    alt="Hit Counter"
/>
times.
</div>

Font
This is the font style which should be used when displaying the hit counter. Only the following styles may be used:

  • Arial - This is the default font. It is a sans-serif typeface.
  • Braga - Braggadocio, a graphic typeface.
  • Comic - Comic Sans Serif. This is sort of light hearted sans-serif typeface.
  • Keno - As in the game.
  • LED - A techie, digital watch look.
  • Script - A script typeface.

The following is an example of our hit counter using the script font:

This page has been viewed Hit Counter times.

The following code displays the hit counter above:

<div align="center">
This page has been viewed
<img
    src="http://www.c4.net/scripts/Counter.cfm?Font=Script"
    align="absmiddle"
    border="0"
    alt="Hit Counter"
/>
times.
</div>

Page
If you rename your pages or would like to count multiple pages as the same, you can do so using the page attributes.

This page has been viewed Hit Counter times.

The following code displays the hit counter above:

<div align="center">
This page has been viewed
<img
    src="http://www.c4.net/scripts/Counter.cfm?Page=http://www.c4.net"
    align="absmiddle"
    border="0"
    alt="Hit Counter"
/>
times.
</div>

HitCount
The HitCount attribute can be used to set the hit count to a starting value. To do this, include the HitCount attribute as is done below, and request the page. This will set the value. Then, remove the HitCount attribute. Each successive request will increase the number from the position at which you set it.

This page has been viewed Hit Counter times.

The following code displays the hit counter above:

<div align="center">
This page has been viewed
<img
    src="http://www.c4.net/scripts/Counter.cfm?HitCount=998"
    align="absmiddle"
    border="0"
    alt="Hit Counter"
/>
times.
</div>


c4.net :: 721 Main Street :: Harwich, MA 02645 :: surf@c4.net
c4.net is a division of Cape Cod Computer, Inc.
© 2013 Cape Cod Computer, Inc.