===========================================================================
Today on The World Vol. 4 #168 Monday, June 29, 1998
===========================================================================
Continuing the "random advanced topics that didn't quite fit in anywhere
else" section of our HTML tutorial, today I'll talk about CGI access
counters and automatic redirection.
Next installment: Frames. (I've been saving them 'til last so you
won't get in trouble with them yet.)
Remember that you can find the other chapters on
http://world.std.com/help/web/tutorial
for now.
(kibo)
---------------------------------------------------------------------------
HTML TUTORIAL -- CHAPTER 14 -- COUNTERS & REDIRECTION
14.1 Counting accesses to your page
(This section is specific to The World's web servers. Details will
vary at other Internet service providers.)
There are all sorts of ways to count the number of "hits" on your page.
A hit is any sort of access. Depending on which hits you're counting,
you may be recording every single image loading on every one of your
pages (a page with four images can generate five hits if all are
counted), or you might just count the number of accesses to a particular
page or image. (If you were to count just the number of accesses to
your index.html file, that would give you a number more closely approximating
the number of visitors than counting every single hit would.)
There is no reliable way of counting the number of human beings that
have visited your site. You can only count hits. If one person views
the same page twice (on different days, or just by using the "Back" button
in their browser on the same day) that can generate two hits if that
page is being counted.
Some of the counting methods available on The World include:
1.) wwwacct (for HPA or Kiosk customers)
On The World, we provide a program named "wwwacct" (or, for Kiosk customers,
"kioskacct") which will print a list of every hit on any of your pages
for the past 24 hours. (This list can be VERY long -- for instance, one
of my sites gets 5,000 hits a day.) Web servers log every single hit
(again, that's every .html, .gif, .jpg or other file that gets transferred)
and "wwwacct" or "kioskacct" simply extracts all the lines that refer
to your files (sorry, we don't let you see hits on other people's pages.)
This log file also lists the status codes the Web server records for
every hit -- "200" means the page or image was okay, "404" means it was
not found, "403" means it was not permitted (you may need to use "chmod".)
Output of "wwwacct" or "kioskacct" looks something like this:
200 STD_DOCUMENT GET 255 "/usr/WWW/kiosk/Newbury/kibo/i/k_8.gif" "kibo" "" ""
"dialup-pkr-11-41.network.umr.edu" 06/29/98 01:05:11 194
200 REDIRECT_URL GET 255 "/usr/WWW/kiosk/Newbury/kibo/" "kibo" "" ""
"ns.links2go.com" 06/29/98 01:28:11 4096
200 STD_DOCUMENT GET 255 "/usr/WWW/kiosk/images/world_at_faint_832x832_3.gif"
"kibo" "" "" "oak-port226.jps.net" 06/29/98 01:31:19 7420
For more information about "wwwacct" and "kioskacct",
* type "man wwwacct" or "man kioskacct" from the UNIX shell
(that is, in a "telnet" window)
* A summary of wwwacct's features is at:
http://world.std.com/help/cmd/wwwacct
* A Home Page Alone (HPA) tutorial, which touches on "wwwacct"
and all sorts of other useful issues for customers of The World, is:
http://world.std.com/help/web/hpa-tutorial.shtml
2.) .kstats (for Kiosk customers only)
Customers of The World's Kiosk Web Site or Kiosk Bundle services can
have a statistical breakdown of their site's hits E-mailed to them
automatically every week. (No fuss, no muss!) Simply create an empty
file named ".kstats" in your Kiosk directory and you'll get the
first report mailed within a week. These reports include a summary
of the number of hits for each of your pages or images, and a summary
of the number of hits from the top 200 domains (so that you can see what
parts of the world are flocking to see your site.) Daily breakdowns
are included as well as weekly, although the reports are only mailed
once a week (on Sunday mornings.)
The reports look like this:
WEEK TOTAL
Total Hits Total Bytes
31428 182265639
WEEK DETAIL
Domain Total Hits Total Bytes
UNKNOWN_HOST 1695 38581591
aol.com 367 3214212
uu.net 291 3618188
std.com 233 2701280
home.com 231 9860503
mindspring.com 230 6716437
[...]
WEEK DETAIL
Page Accessed Total Hits Total Bytes
kibo/ 385 1576960
kibo/main.html 323 3959334
kibo/webtv/lookit_me_1.wav 103 8308352
kibo/webtv/lookit_me_2.wav 89 6479364
kibo/kibofaq.html 89 1785696
More information on .kstats and its many uses can be found at:
* Our Web page with notes on .kstats:
http://www.std.com/Newbury/TheWorld/help/kstats.shtml
* The information was also in "Today on The World", March 10, 1998:
http://world.std.com/eye-on-world/today/yesterday/4.064-10mar98
3.) A graphical counter made Count.cgi. (HPA or Kiosk)
This is the trickiest method to implement, and relatively less reliable
(because it can only count hits to the particular page you put it on,
and because it does not take into account people who do not successfully
load all the graphics -- compared to the two methods above you will
probably find that it reports fewer hits. Of course, none of these
methods is perfect.) However, this is the route to use if you want
other people to see the counter on your page. (Why do people like to
show those things which says "My page has been accessed [00000037] times"
on their home page? Beats me.)
We have installed a program named count.cgi in our library of CGIs
available to HPA and Kiosk customers. An example you can try on one
of your practice pages is:
Try viewing that in your browser (after changing "yourname"!) and
then hit the "Reload" (or "Refresh") button a few times and see if
the number goes up. Note that when using Count.cgi it is very important
to specify "?df=yourname.dat" because all data files are stored in
the same directory. In other words, if you do not specify a unique
name for the log, your hits will get mixed up with someone else's
and you may suddenly find you have 100,000 more than you had expected.
So please put your own name in "?df=yourname.dat", don't use
"count.dat" or "data.dat" or one of the other filenames anyone else
would think of.
There are a zillion options (yes, I counted them) for Count.cgi.
You can change the number of digits, the colors, the typeface,
make it transparent, turn it sideways, use it as a clock, make
random numbers, etc. (Note: you can't add your own graphics to
its library of digits on The World, because you can't change our
cgi-bin directory. Kiosk Web Site and Kiosk Bundle customers can
maintain their own cgi-bin directories and thus can install any
other counters or other CGIs that they may want.)
For more information:
* Our notes on Count.cgi are at:
http://world.std.com/~wexample/counter.html
* Official examples of all the counter's options:
http://www.fccc.edu/users/muquit/Count2ex.html
* More examples:
http://www.alternex.com.br/~stelling/CounterExamples.html
* Official documentation (in detail):
http://www.fccc.edu/users/muquit/Count.html
14.2 Redirection -- telling people your page has moved
You've probably seen those pages that say "We've moved to a new
URL -- your browser will go there automatically in 10 seconds."
How does this work? If you remember a few chapters back, I showed
a few examples of being used to add information about
your Web page to the
Your browser will be redirected there in 10 seconds.
Of course, you don't need to redirect people's browsers automatically at all if you assume they know how to follow a link. But some programs that check lists of bookmarks for changes will be able to understand the redirection and display the appropriate "This page has moved" message, so the is sometimes useful. Next chapter: Frames! And then after that, just one more installment with some final words and more references to other documentation. Then I'll go back and fix the typos I made in the earlier parts and post everything on the Web. (kibo) ========================================================================== [] Send suggestions for tips & URLs to today@world.std.com. We're also collecting links for our Web pages at eyeguy@world.std.com. [] To contact CUSTOMER SUPPORT, send mail to support@world.std.com or call 617-739-0202. [] To subscribe to the "Today" mailing list, send a note saying 'subscribe announcements' to majordomo@world.std.com. Subscriptions to this mailing list are open to World customers only. [] I wish I had some green soda right now. [] Today on The World is (C) Copyright 1998 by Software Tool & Die. Its contents may freely be redistributed as long as credit is given.