CIRR.COM Herald

CIRR.COM

Web Hosting Support:CGI

Counters


Counters

Using the Counters
How to configure your pages and site to use CIRR's Counters
Counter Registration
Register sites and pages with the Counter software
Counter Administration
Administer the counters for your site
Counter Statistics
Display Counter usage for your site


Using the Counter CGI

The page counter CGI available for general use is different from most counters in that it requires you to register your page in order to activate the counter.

Checklist for Setting up a Counter

  1. Register your site
  2. Register each page
  3. Add the Page ID to each countable page
  4. Add a server side include to each countable page

Page Counters and Site Counters

Every page has 2 counters: a Page Counter and a Site Counter. The page counter is just that, the counter for the individual page. Each page is also "owned" by a site. Every time the counter for a page on a site is incremented, the associated site counter is also incremented. This way you can keep track of visits to both individual pages and visits to a site consisting of multiple pages.

The Site ID

Each site is assigned a unique Site ID that is created by appending an index number to the first few characters of the site name. The site name is extracted from the site URL. Site IDs are case insensitive.

A site URL may only be registered once.

The Page ID

The Page ID identifies the site that owns the page as well as the individual page. It is created by appending an index number to the Site ID. For example, if the Site ID is "ren002", the first page to be registered to that site would have a Page ID of "ren002-001".

An index of "000" identifies a site counter. For example, "ren002-000" identifies the site counter for "ren002".

A page URL may only be registered once.

Identifying a Countable Page

After your page is registered, you must include the page ID in every page that will be counted. The Page ID is included as a comment in the HTML. <!--PAGEID="Page ID" --> You can use a Page ID on more than one web page. The same counter will be incremented each time. This is useful if you have several versions of the same page, for example, a frames version and a non-frames version, and you don't want (or need) to make a distinction between accessing one page or the other. If you are going to use a Page ID on more than one page, remember that the Counter database only associates a single URL with the Page ID. So choose your URL wisely.

Note:
Eventually the server itself will increment the counters. The Page ID will tell it which page counter and associated site counter to increment. The Counter CGI will only be used to display the page and site counters.

Using Counter.pl

You must add a server side include to each countable page in order to increment and display the counters.

<!--#include virtual="/cgi-bin/Counter.pl?opts=options&pageid=PageID" -->

The options available are
s Display the site counter associated with the page.
p Display the page counter. This is the default action.
o Display ordinal numbers. The appropriate suffix is appended to the counter.
c Display cardinal numbers. This is the default.
n Do not increment the page and site counters.
d Increment, but do not display the counters.
i Increment the page and site counters. This is the default.

The Page ID must be included.

These 2 examples both do the same thing: increment the page and site counters and display the page counter as a cardinal number.

<!--#include virtual="/common-cgi/Counter.pl?opts=pci&pageid=ren002-001" -->
<!--#include virtual="/common-cgi/Counter.pl?pageid=ren002-001" -->

Counter Errors

All errors are logged to /logs/counter-errors.

If a page is not registered, Page ID not registered will be returned to the invoking page.

If the page ID is missing, Page ID missing will be returned to the invoking page.

If the Counter database could not be locked (which is required in order to update the counters), ???? will be returned to the invoking page.

Examples

This page has several examples of using Counter.pl in various ways to increment and display both page and site counters. It even has some example error message. The example page takes a while to load (there are quite a few invocations of Counter.pl), so please be patient.

If you have any questions about our site, please send us mail.
Copyright 2000,2001 CIRR.COM Contact Us Referral
Program
Support
$Id: Counter.html,v 1.4 2002/04/29 22:47:32 cirr Stable $ Terms of Service Privacy Information