Script help if possible

I have a script that i need a little tweak to.
If you are able to write script then it should be very easy for you.
I obviously dont and asking for your help.
The script below is for a click counter which the hypertext link then opens up another web page.
I am using this script to find out how many people look at this other page.
My problem is that it does not keep a record of the hits etc.
Once you close the browser the next time you look at the results which a box is shown next to the link it reads 0 again.
Below is the script in question.

<TITLE> Clicker Counter Thingamajig </TITLE>
<script type=“text/javascript”>
var clicks = 0;
function linkClick(){
document.getElementById(‘clicked’).value = ++clicks;


<a onclick=“linkClick()” href=“”>CLICK HERE</a>

clicked <input id=“clicked” size=“3” onfocus=“this.blur();” value=“0” > times.

<meta http-equiv=“Content-Type” content=“text/html; charset=windows-1252”>
<meta http-equiv=“Content-Language” content=“en-gb”>
<title>About Me</title>

<body bgcolor=“#FFFFFF”>
<p align=“center”>

<div align=“center”>




I also have a hit counter for the page but that obviously shows how many time that home page has been viewed,what you are saying is with Google Analytics it will tell me that x amount of people have clicked on the link i wish to moniutor and also my other pages,is that correct,thanks for the help by the way.

This one would probably do the job for you

Should come with instructions on how to install and use.

If not, then I would seriously suggest using Google Analytics. Then you could use any old hit counter code on your page to track the # of visits and use analytics to track where they came from.

Hope this helps.

Hi can you advise on one that you think is suitable so i can just get it going and tell it what link to monitor,i have had a look but dont realy know what i am reading to be honest.

No worries.

You’ll probably need some ASP code as well as JS. JS won’t execute on the server, it’s client based and you’re needing to store that data on the server.

I’m not an ASP coder so can’t quickly write a script for you.

You’re really looking for a page counter that can store referrers. Referres are the URLs a web page has been visited from.

I did a quick google search for:
web page counter referrer asp code

and got a heap of good results from that.

Of course you could always install some Google Analytics code to all your pages. That way you’d be able to see where the web page visits came from, even internal ones.


Not being rude but i do not know scripts at all.
I downloaded this from the web and thought it was just a matter of adding a couple of extra lines extra.

Can you advise anything else that would give me a number visit then ?


You’ll have to store the clicks for the page somewhere persistent like a file or MySQL DB on the web server.

What you’ve got just now updates a JavaScript variable but that get destroyed when you navigate away from the page.

You could try this approach.

  1. read the file/DB and get the current hits for the current page
  2. increment by 1
  3. store new counter value
  4. display

Very very crude approach but should set you on the right tracks.

If you’re writing it from scratch then you may as well grab the HTTP_ headers and store the users IP address and other info.

If you’re using a file rather than a DB then you’ll have to watch out for file locks and multiple writes, so build in some error detection.

Hope this gives you a starter-for-ten.



If people are viewing the page you’re wanting to monitor then in Google Analytics when you view the stats for that page it will tell you all the referrers (URLs).

i.e. where they came from, so if people are viewing the page from the launching link, that link should be shows as a referrer.