www.webdeveloper.com
Results 1 to 9 of 9

Thread: Links Counter

  1. #1
    Join Date
    Mar 2004
    Posts
    6

    Links Counter

    Hello, I dont know is this is a scrpit or what.

    When some one clicks on your link, is there a way to see how many people have cliked on that link in that day.

    www.clan-rel.tk My website

  2. #2
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    First of all, get a new host! Those popup adds will drive everyone away from your site..


    Theres two ways..

    1) You could write a javaScript which writes to a text file. The file could simply contain an integer which is incremented. You could run the script everytime a link is clicked using the onclick event.

    2) you could use a server-side language which logs the data to a database each time a page loads.

    Regards,
    Andrew Buntine.

  3. #3
    Join Date
    Jun 2003
    Location
    The United States Site: http://kellyj.t35.com
    Posts
    2,561
    but since javascript can't directly, nor was meant to, write to text files, this will require the use of an activeX object.

  4. #4
    Join Date
    Mar 2004
    Posts
    6
    Thanks for your adivce guys.


    Do you know where I could get this javascript from, beacuse I am rubbish at this stuff.

    "You could write a javaScript which writes to a text file. The file could simply contain an integer which is incremented. You could run the script everytime a link is clicked using the onclick event"

  5. #5
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    I think it would be best to do it from the server. So each time a page loads, the database is updated.

    This will also allow for easier viewable and editable data.

    The only drawback -- this will only work for local links. So if you had a link to google.com, the link counter wont record it.

    If you want to use this method, find out which server side languages your server supports and then post your details in the corresponding forum..

    Some languages include; ASP, CGI, PHP, ColdFusion, ASP.NET.

    Regards,
    Andrew Buntine.

  6. #6
    Join Date
    Jun 2003
    Location
    The United States Site: http://kellyj.t35.com
    Posts
    2,561
    the other drawback, if you record the numbe rof times the page unloads, there could also be some discrepencies.

  7. #7
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    What discrepencies would be caused?

  8. #8
    Join Date
    Jun 2003
    Location
    The United States Site: http://kellyj.t35.com
    Posts
    2,561
    well, for example; users who encounter errors with other windows that cause all browsers to shut will not be tracked; users who disconnect fro mthe Internet while browsing would also not be tracked.

  9. #9
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    Fair enough..

    The best way is to have every link directed towards the same page. Have each link use a different queryString variable which selects the correct page URL from a database and increments a table field to show that someone has clicked the link..

    Thats how it is done in the commercial CMS world.

    Regards,
    Andrew Buntine.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles