Script required for hit counter

Discussion in 'Scripts' started by ipbr21054, Jul 28, 2010.

  1. #1
    Hello,
    I have added a click counter to my web page so i can track how many times people have clicked on the hyperlink text and viewed the site that the hyperlink takes you to.
    Below is the script for the click counter that i am using.
    Would it be possible for somebody to edit the script as i have a small problem with it.
    The problem is that once the button has been clicked on the result box then shows 1 but does not store the result.
    I mean you click on the link to view the page and the result in the box is now 1,if you close your browser and then go back to the your web page again the box then reads 0.
    I would like to have it remember the clicks.
    Basically the result is allways shown as 1 "as you have just clicked on it" or 0 "because you have closed the browser & the opened up the web page again"
    I am pretty sure it will be easy for somebody but a bit out of my depth here im afraid.


    Thanks.

    <HTML>
    <HEAD>
    <TITLE> Clicker Counter Thingamajig </TITLE>
    <script type="text/javascript">
    var clicks = 0;
    function linkClick(){
    document.getElementById('clicked').value = ++clicks;
    }
    </script>
    </head>

    <body>


    <a onclick="linkClick()" href="http://www.connells.co.uk/detail.asp?type=0&src=property&cs=88&bs=WOT&br=-1&prop=100003&min=150000&max=-1&bed=3&page=6&id=WOT302735">CLICK HERE</a>

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



    </BODY>
    </HTML>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta http-equiv="Content-Language" content="en-gb">
    <title>About Me</title>
    </head>

    <body bgcolor="#FFFFFF">
    <p align="center">
    &nbsp;</p>


    <div align="center">


    &nbsp;</div>

    </body>

    </html
     
    Last edited: Jul 28, 2010
    ipbr21054, Jul 28, 2010 IP
  2. floaremail

    floaremail Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Nobody can help the boy?! I'm interested, too.
     
    floaremail, Aug 28, 2010 IP
  3. TheWiseGuy

    TheWiseGuy Member

    Messages:
    113
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    28
    #3
    you need more than just a simple js counter, you need a database where to store the visit counters for every property
    this means you need to create a table where you have "property id" and "visits", every time someone clicks the link you increase that by 1
    this requires an SQL query to run, something like
    
    UPDATE propertiestable SET visits = visitis + 1 WHERE propertyID = xxx;
    
    Code (markup):
     
    TheWiseGuy, Sep 5, 2010 IP
  4. metaxom

    metaxom Active Member

    Messages:
    881
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    78
    #4
    Try the free script from Piwik.org
     
    metaxom, Sep 23, 2010 IP