Information Technology Division

Add a Counter

FrontPage users follow the instructions for a FrontPage-specific counter.

A counter may be added to your page to record and display the number of people who have viewed your home page.A typical counter display:

You are visitor number: Zero one three five

Before creating the counter, ITD recommends that you understand the following:

To create this counter, you will do the following:

  • Create the counter directory within public_html
  • Create a file to store the number of visits to your page
  • Create a configuration file that sets all of the options for the counter
  • Change the permissions of these files and the directory so that they can be read from the web
  • Insert the appropriate IMG tag in your HTML document

Instructions

Create the Counter Directory within "public_html"

  1. At the frank prompt, change to your "public_html" directory.
    frank $ cd public_html
  2. Create a directory for the counter, naming it "counter."
    frank $ mkdir counter
  3. Change the group for "counter" to that of the web server.
    frank $ chgrp httpd counter
  4. Change the permissions for "counter" to make the directory accessible on the web.
    frank $ chmod 775 counter
  5. Open "counter."
    frank $ cd counter

Create a File to Store the Number of Visits to Your Page

  1. Use Pico (a text editor on frank) to create a file that will store the number of visits to your page.
    Name the file "home.count."
    frank $ pico home.count
  2. Type the number you want the counter to start at (e.g. 1 or 10).
  3. Exit Pico, answering Yes to save the file.
    Ctrl-X (exit)
    Y (Yes to save)
  4. Change the group for "home.count" to that of the web server.
    frank $ chgrp httpd home.count
  5. Change the permissions for "home.count" to make it accessible on the web
    frank $ chmod 775 home.count

Create a Configuration File that Sets All the Options for the Counter

  1. Use Pico to create the configuration file that will set all your options for the counter.
    frank $ pico home.config
  2. Type in the desired options and required directory path names. (Read Configuration optionsand samples.)
  3. The following line is required in "home.config":
    CountFile=/ path to your home directory /public_html/counter/home.count
    frank $ pwd will tell you where you are currently working; the "path to your home directory"
    is from the first slash to your username: /users/your group/username/...
  4. Exit Pico, answering Yes to save the file.
    Ctrl-X
    Y
  5. Change the permissions for home.config.
    frank $ chmod a+r home.config

Add the Text and HTML Tags to Your Web Document

  1. Add the following text and tags to your html document:
You are visitor number:
<img src="/cgi-bin/counter.pl? path to your home directory /counter/home.config">