Web Services - Counter
Monday May 20, 2024 - 17:43:59
Orpheus Internet Services Ltd

Adding a web counter to your web pages

It's often nice to set up a counter on your website to tell you how many people have visited a certain page.

This script can be accessed by using the following bit of HTML:
<img src="/cgi-bin/counter.bm">

However, without passing it any data it won't be of much use to you - you need to give it a name so that it can keep track of your page. If you don't give it a name, or give it the same name as someone else's page, it won't count accurately. Also, you should only have one counter on one page - if you want to keep track of more than one page, add a different counter - perhaps by adding a number to the end of the name - so that the counter only goes up when a new person visits a page, not the same person just visting different pages.

If you are using a RISC OS machine, you can use a program called CounterMaker to create your counter - it will even read your Voyager options file to choose a name for you. CounterMaker is available from Richard Goodwin's website.

The following are parameters which you can pass to the program - the name is always required, but the other fields are optional.

code
A name or ID that is unique to your counter - a fool-proof method is to use the first part of your Orpheus email address, for instance if you have the email address of supporttest@orpheusmail.co.uk you can use supporttest as the name for your counter. If you want to add more than one counter, you could use supporttest1, supporttest2 and so on.

example: <img src="/cgi-bin/
counter.bm
?code=supporttest">
returns:  large

colours
Additionally there are a number of additional codes which can be added to alter the appearance of the counter - by default the counter will be large with white numbers on a black background and a red border. If you leave out any of the follow codes (or don't put any at all) then the default values will be used.

Code......and what it changes
&fore=foreground (digits) colour
&back=background colour
&brdr=border colour

The following colours are valid for use with the above codes:

0 1 2 3 4 5 6 7
8 9 10 11 12 13 14 15
16 17 18 19 20 21 22 23
example: <img src="/cgi-bin/counter.bm?code=supporttest&fore=9&back=19&brdr=12">
returns:  colour

size
The default font is quite thin, but if you have quite a strong background colour this might not show up very well. In this case you could try adding the bold attribute - available in two versions, as well as off:

size=MeaningImage size
0large - this is the default,
so you don't actually have to use this
131x23
1small83x16
example: <img src="/cgi-bin/counter.bm?code=supporttest
&size=1">

returns:  small

owner
By using the parameter owner=true you can stop the counter incrementing. This is only useful if you have hidden counters on your site, and you want a secret page where you can view where the counters have got to. The only valid value is true, written in lower case.

To put hidden counters on your site, set all the colours to the same colour value - one that matches the background colour of the page you want to put it on - and/or make the size of the image very small - height="1" width="1" should do the trick.

Final example
If you put all that together you might get...

example: <img src="/cgi-bin/
counter.bm

?code=supporttest
&fore=12
&back=20
&brdr=7
&size=1
">

returns:  final

Final notes

Of course you can still use the standard <img...> extensions such as alt="many" which will substitute the word many if the image doesn't load, so you could have the page saying This page has had many hits since 15th July).

Don't panic!
Don't panic if you add the necessary code only to find it the image doesn't appear - you will not be able to see the web counter unless you are actually connected to the Internet, as the program necessary to run it is located on our server.

Valid HTML 4.01! Valid CSS!