Unicounter : Examples

Page-hit counters

In the examples below, the blue text is present in the source code at the point where the counter value is displayed

Example 1

<script
 type="text/javascript"
 src="/cgi-bin/counters/unicounter.pl?name=test1&amp;cache=1&amp;trackip=0">
</script>
Page hits :

Example 2

<script
 type="text/javascript"
 src="/cgi-bin/counters/unicounter.pl?name=test2&amp;cache=0&amp;trackip=0">
</script>
Page hits :

Example 3

<script
 type="text/javascript"
 src="/cgi-bin/counters/unicounter.pl?name=test3&amp;trackip=4">
</script>
Page hits :

Example 4

<!--#include virtual="/cgi-bin/counters/unicounter.pl?name=test4&write=ssi&trackip=0" -->
Page hits : 1929

 

Download Counters

Download counters come in two parts being the delivery and the display.

1: Delivery

You must set the target of the download link to an url that calls the counter and specifies the file to be downloaded.

The current value of the counter is displayed below. If after downloading, you refresh the display, the counter should have incremented.
Click here to test the download counter.

/cgi-bin/counters/unicounter.pl?name=test5&amp;trackip=0&amp;deliver=/software/unicounter/unicount.zip

2: Display

This is very much the same as for page-hit counters, however, the parameter inc=0 is required to prevent the value of the counter being incremented.

<!--#include virtual="/cgi-bin/counters/unicounter.pl?name=test5&write=ssi&inc=0&trackip=0" -->
Downloads = 48

Pictorial page-hit counters

Provided that you don't wish to display the counter value on a page, you may avoid both server-side includes and javascript. In this case, you must use an <img> tag.

<img src="/cgi-bin/counters/unicounter.pl?name=main_ph&amp;deliver=http://www.yourdomain.com/images/counter.gif" alt="counter">