Nanyang Technological University

Using Live Counter on NTU Sites

  • What is Live Counter?
    Live Counter is a program that allows you to display a counter for the number of hits your web page receives. It is written as a Java applet, but for those browsers that cannot run Java, an alternative CGI counter is used. Some of the advantages of Live Counter are that
    • it is free for users in NTU.
    • the counter will increment 'live', as and when people visits your page, unlike CGI-based counters which will only increment only when one refreshes/reloads the web page.
    • you can use different styles for your counter digits and even select a border for them.

 

  • Codes to use
    To use Live Counter in your web page, add these codes (in blue) to your web page:

    Do not copy and paste the codes from the source code of this document. If you do not want to type in all the codes, just copy from what you see now on the web page. Do not view source.

    For a 6-digits counter without a border

    <!-- Live counter -->
    <applet codebase="http://www3.ntu.edu.sg/" code ="LiveCounter.class" width=90 height=20>
    <param name="digitscount" value="6">
    <param name="urlimage" value="http://www3.ntu.edu.sg/lc/count3g.gif">
    <param name="urlscript1" value="http://www3.ntu.edu.sg/cgi-bin/livecnt1.pl">
    <param name="urlscript2" value="http://www3.ntu.edu.sg/cgi-bin/livecnt2.pl">
    <param name="data" value="IdentityTag">
    <!-- CGI backup counter -->
    <IMG SRC="http://www3.ntu.edu.sg/cgi-bin/livecntr.pl?0+6+IdentityTag" WIDTH=15 HEIGHT=20>
    <IMG SRC="http://www3.ntu.edu.sg/cgi-bin/livecntr.pl?1+6+IdentityTag" WIDTH=15 HEIGHT=20>
    <IMG SRC="http://www3.ntu.edu.sg/cgi-bin/livecntr.pl?2+6+IdentityTag" WIDTH=15 HEIGHT=20>
    <IMG SRC="http://www3.ntu.edu.sg/cgi-bin/livecntr.pl?3+6+IdentityTag" WIDTH=15 HEIGHT=20>
    <IMG SRC="http://www3.ntu.edu.sg/cgi-bin/livecntr.pl?4+6+IdentityTag" WIDTH=15 HEIGHT=20>
    <IMG SRC="http://www3.ntu.edu.sg/cgi-bin/livecntr.pl?5+6+IdentityTag" WIDTH=15 HEIGHT=20>
    </applet>

    Important customisation you need to make
    • Substitute count3g.gif with the name of the graphic for the digits you like to use. See the sample graphic page for a list of the graphic files NTU has in its server.
    • Substitute the name IdentityTag with any name you like to give your counter. You have to make it as unique as possible or the counting will be messed up if other people also have the same name for their counter. If this is the FIRST time you are using the name you have chosen for your IdentityTag, and it does not start from zero, then it means someone else has used the same name too. So choose another name. Names like test, or testing will most likely be used by others for testing purposes too. So if your codes are finalised, remember to change the name to something unique

    For a 6-digit counter with a border
    <!-- Live counter -->
    <applet codebase="http://www3.ntu.edu.sg/" code ="LiveCounter.class" width=100 height=30>
    <param name="digitscount" value="6">
    <param name="urlimagebk" value="http://www3.ntu.edu.sg/lc/border12.gif">
    <param name="offsetx" value="5">
    <param name="offsety" value="5">
    <param name="urlimage" value="http://www3.ntu.edu.sg/lc/count3g.gif">
    <param name="urlscript1" value="http://www3.ntu.edu.sg/cgi-bin/livecnt1.pl">
    <param name="urlscript2" value="http://www3.ntu.edu.sg/cgi-bin/livecnt2.pl">
    <param name="data" value="IdentityTag">
    <!-- CGI backup counter -->
    <IMG SRC="http://www3.ntu.edu.sg/cgi-bin/livecntr.pl?0+6+IdentityTag" WIDTH=15 HEIGHT=20>
    <IMG SRC="http://www3.ntu.edu.sg/cgi-bin/livecntr.pl?1+6+IdentityTag" WIDTH=15 HEIGHT=20>
    <IMG SRC="http://www3.ntu.edu.sg/cgi-bin/livecntr.pl?2+6+IdentityTag" WIDTH=15 HEIGHT=20>
    <IMG SRC="http://www3.ntu.edu.sg/cgi-bin/livecntr.pl?3+6+IdentityTag" WIDTH=15 HEIGHT=20>
    <IMG SRC="http://www3.ntu.edu.sg/cgi-bin/livecntr.pl?4+6+IdentityTag" WIDTH=15 HEIGHT=20>
    <IMG SRC="http://www3.ntu.edu.sg/cgi-bin/livecntr.pl?5+6+IdentityTag" WIDTH=15 HEIGHT=20>
    </applet>

    Additional customisation for counter with border
    In addition to the change you need to make for the graphic name of the digits used and the name of your counter identification,
    • you need to specify a graphic to use for you border. Substitue border12.gif with the name of the border you want to use. Refer to the sample graphics page for a list of the borders NTU carries.

    Notice too that
    • the size of the counter image has also been increased from a width 90 by height 20 to a width 100 by height 30. The increase in size is to offset the space the border graphic would occupy.
    • offsets for the x and y values are needed to shift the digits to accommodate the border.
    • for an idea of the values to set for different styles of borders, refer the the sample graphics page sample graphics page

    Using 8 digits instead of 6
    If your page has a lot of hits, you may consider using 8 digits instead. To do so, just substitute 6 for 8 in the original statement below:
    Change from <param name="digitscount" value="6">
    to <param name="digitscount" value="8">

    If you use a border, you will also need to use a border that can accommodate 8 digits.

    In a similar vein, you can in fact substitute any number of digits you desire to display. It is just that there are no ready-made borders for other numbers of digits. You are free to use any other border backgrounds you may get from other sources though. Just provide the correct URL to the image file for the border.

    Actually there is no need for this statement <param name="digitscount" value="6"> if you are using 6 digits, because the default is 6. But it will also work with the statement present. It just makes it easier for those who would like to change it, as they know that there is a variable to modify.

                         

  • Sample file showing counter in action
    Here is an example showing the counter in use. The example uses a counter with a border. You may save it and use its source code for a base for your own counter codes on your pages.    

  

  • Links to the official Live Counter pages
    Official Live Counter Classic website: The counter NTU uses is called Live Counter Classic. You may like to check out the company's website for more information on Live Counter Classic.

Share Article