Here's how to use the CGI hit-counter available here through cPanel.

moongaze

New Member
Messages
9
Reaction score
0
Points
1
After getting no replies to my question posted here on this subject, I did some research on the net about Count.cgi, and after much trial and error experimenting with it here, I finally figured out how it works and what you have to do here to use it.

I've noticed that many other forum members have asked about this previously, some several times, with results similar to my question -- i.e. little or no help provided by site admin on this subject, so I decided to document it here for the benefit of others.

The information below is valid for users on the server "level". I can't be sure whether it also applies to those on other servers. Try it out and see.

HERE'S WHAT YOU CAN AND CAN'T DO WITH IT:

YOU CAN:


  • have multiple counters to keep stats on different web-pages hosted here.
  • Any counter can be hidden or visible on the page you implement it on.
  • It doesn't have to be implemented on the index.htm file (or home page). If you prefer to count visitors who tunnel down further into your site than the home page, you can put it on another page.
  • By default, the counter will count ALL hits, even page reloads by the same visitor (from same IP address) are counted. But you can choose to count only unique visitors by including the option reload=F in the parameter string.
(This is thanks to the fact that the site admin has configured Count.cgi here to count ALL hits, even page reloads. In such a case, the default can be overriden by the option. If site admin had configured Count.cgi NOT to count reloads, you could NOT override that with the option reload=T.)Counter filenames must be of the form username-suffix.dat. The suffix is optional. It is useful if you have multiple counters. It can be as simple as 001, 002, etc, or you can have a filename like username-sitesection-001.dat.​

YOU CAN'T:
  • access the .dat file directly. It does not reside anywhere in your account area (on your domain). The most you can do is create the file using the relevant utility in cPanel (not the file manager), and you can use the same utility to reset a counter to zero (or some other number).
  • Later, there will be instructions on how you can check the values of your counters. This is especially important, if you want the counter to be invisible, so that it does not show up to visitors when they go to the relevant page on your website.
  • You can't even delete a counter .dat file, so be careful what names you choose.
HERE'S WHAT TO DO:
1)
Go to: cPanel => "Software/Services" pane => CGI Center => Counter

Fill in the form there with the options you want, then click on the "html" button to generate the code. Don't worry about getting any options wrong; you can easily edit the code later to tweak it to your satisfaction. There are more options in addition to the basic ones provided for on this form that you can also add later. The crucial thing that this process achieves is that it create the .dat file for you which is needed for the counter to work.

Therefore, be very careful about what goes into the "Counter Name" field. Edit the contents there to reflect your choice of filename. See the last item in both the "YOU CAN" and the "YOU CAN'T" lists above for more information about this.

Copy the generated code into a text file for future use.

Then, for good measure, use the second form there near the foot of the page (below the heading "Edit/Reset a Counter") to set the counter to zero (or whatever initial number you want the counter to have.) This step may not be essential to the creation of the file, but it can't hurt.

Be sure that the filename is exactly the same in both forms. Check the spelling carefully.


2) Paste the code you saved in step 1 into the webpage you want to count hits on. If you intend the counter to be hidden, you can put it anywhere. Otherwise put it where you want the counter to appear.

At this point, you can edit or add options. You will definitely need to if you want to hide the counter or choose to ignore page reloads. More about this below.


3) Finally, paste the text in the code section below into a text-file named MyCounters.htm. Then edit it to replace YourDomain and filename with suitable names. Keep it on your local hard drive and open it in your browser whenever you want to check on the hit scores of your counters. It is especially important if you create multiple counters. It will help you keep track of the filenames you have created for your counters. This webpage will also display syntax help for counter options and some weblinks to further information about counters and about Count.cgi.


Code:
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<TITLE>

My Counters on x10.mx

</TITLE>
</HEAD>

<!--  -----------------------------------------------------------------

Keep this page on your local hard drive. Open it in your browser to display
the current values of your CGI hit-counters for your website hosted on x10.mx.
Refresh the page as many times as you like to update the display.
(This will not increment the counters.)

Alternatively, you can view a specific counter by entering the following in
your web-browser's address bar

http://yourdomain/cgi-sys/Count.cgi?df=filename.dat&incr=F

Of course, you must substitute the correct values for yourdomain and filename.

------------------------------------------------------------------- -->

<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#ffffff">

<center>

<P><HR WIDTH="80%" SIZE=0></P>
<P><B><FONT FACE="Arial" SIZE=5><P ALIGN="CENTER">

My Counters on x10.mx

</B></FONT></A></P>

<P><HR WIDTH="80%" SIZE=0></P>

</CENTER>
<p>&nbsp;<nbsp></p>

<TABLE BORDER CELLSPACING=1 CELLPADDING=7 WIDTH=850>

<!-- ------------------  HEADER ROW  ---------------- -->

<TR>
<TD VALIGN="top">
<b>Counter Filename</b>
</TD>

<TD VALIGN="center">
<b>Counter Display</b>
</TD>

<TD VALIGN="center">
<b>Used For</b>
</TD>
</TR>

<!-- ------------------------------------------------ -->

<TR>
<TD VALIGN="top">
username-xxxxxxxx-001
</TD>

<TD VALIGN="center">
<img src="http://YourDomain/cgi-sys/Count.cgi?df=filename.dat|display=Counter|ft=2|md=9|frgb=100;139;216|dd=A|sh=T|incr=F|" />
</TD>

<TD VALIGN="center">
Used for page x
</TD>
</TR>

<!-- ------------------------------------------------

TO ADD ANOTHER ROW TO THE TABLE COPY THE THREE PARAGRAPHS BELOW
AND ADD IT ABOVE, THEN CHANGE THE FILENAMES AND OTHER INFO.

<TR>
<TD VALIGN="top">
Counter Filename
</TD>

<TD VALIGN="center">
<img src="http://YourDomain/cgi-sys/Count.cgi? df=filename.dat|display=Counter|ft=2|md=9|frgb=100;139;216|dd=A|SH=T|incr=F" />
</TD>

<TD VALIGN="center">
Used for Page x
</TD>
</TR>

------------------------------------------------- -->

</TABLE>
</P>

<P>
&nbsp;<nbsp>
</P>

<P><HR></P>

<P>
You can display a counter value directly in your browser by typing the following
(replacing YourDomain and Filename with suitable names) into its address bar:
</P>

<P>
<pre>
http://YourDomain/cgi-sys/Count.cgi?df=filename.dat&incr=F
</pre>
</P>

<P>
<b>Syntax help for CGI Counter Options:</b>
</P>

<P>
<b>Example-code:</b><br>
(Note that the following code should be enclosed between a pair of left and right angle brackets.)

<PRE>img src="http://YourDomain/cgi-sys/Count.cgi?df=username-xxxxxxxx-
001.dat|display=Counter|ft=2|md=9|frgb=100;139;216|dd=A|SH=T|incr=F"
</PRE>

(Boolean values may be Y, T or 1 for true, N, F or 0 for false.)

<pre>
display= counter clock or date (with various options),
         but using them disables the counter.
ft=      frame thickness (the counter border) (0 to 10, default=5)
md=      max digits (default=6)
frgb=    frame red;green;blue values
dd=      (digit directory) specifies counter style
sh=      show or hide counter (default=show). F=hide (a 1x1 transparent pixel).
reload=  count page reloads (default = T). Only works if site admin configured
         counter to count page reloads. If so, user can ignore page reloads by
         inserting reload=F. If site admin configured counter to ignore page
         reloads, user cannot override that with this option.
incr=    T or F (default=T). incr=F within this page to prevent the counters
         from being incremented when accessed solely for the purpose of reading
         their values. 

</pre>
</P>

<P>
<b>Additional links for information on Count.cgi and its use:</b>

</P>
<P>
<a href="http://www.server101.com/support/counter.php3">
Instructions for Installing a Counter at Server 101</a>

</P>
<P>
<a href="http://help.bol.ucla.edu/app/answers/detail/a_id/851/~/setting-up-a-cgi-counter">
Setting up a CGI Counter at BruinOnLine</a>

</P>
<P>
<a href="http://www.pac.com.au/members/homepage/counter.htm">
Web Counter</a>

</P>
<p>
<a href="http://www.muquit.com/muquit/software/Count/Count.html">  
Home Page for Count.cgi with full syntax documentation</a>.
</P>

</BODY>
</HTML>
 

moongaze

New Member
Messages
9
Reaction score
0
Points
1
Re: Here's how to use the CGI hit-counter available here through cPanel - update

So this is what happened to my post of a few days ago! I didn't know it had been moved here until I came across it just now. I thought it was just awaiting moderator approval. In the meantime, I have posted an updated version of the above tutorial on this webpage, together with a link to a downloadable copy of MyCounters.htm (also updated with some minor corrections). So please use that version of the tutorial and MyCounters.htm instead. I would have edited the above to reflect the changes, but I can't see any way of doing so, so I guess I can't (or can no longer) do that.
 

candox10

New Member
Messages
2
Reaction score
0
Points
1
I really appreciate this! I'm a novice, and working at understanding. I've made one .dat file. Do I need to make a different one for each page on my site? Thanks for your help!
 

chrisrog

Member
Messages
33
Reaction score
0
Points
6
Didn't need to the last time I checked. That reminds me I need to see why mine isn't working now. :confused:
 

Rick White

New Member
Messages
1
Reaction score
0
Points
1
Hi. I am having trouble understanding why clicking the "commit changes" icon doesn't affect
the counter at all, in the counter app that you have given excellent help for.
Everything else works...except that. I wanted to reset the counter (in the Edit/Reset the Counter section)
to a larger number, that I gathered from my web stats files. Is there any other way to test "commit changes",
other than clicking it 10 times with no effect? My hosting service tech cannot seem to answer my question.
Thank you for your help.
Shobuz99
 
Top