Counting the Number of Clicks to External Links (outgoing links counter)

Discussion in 'Programming' started by JohnS0N, Mar 6, 2008.

  1. #1
    What's the best way (or preferably script) to count the number of clicks on a link that goes to another site?

    I would need it to refresh every 24 hours (or an other timeframe) and start all over again.

    Maybe analytics has this function but I am unaware of it?
     
    JohnS0N, Mar 6, 2008 IP
  2. lephron

    lephron Active Member

    Messages:
    204
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #2
    Create a simple script that does the redirect, and counts the requests. Then redirect all your links through a script, so http://www.google.com would become link.php&link=http://www.google.com

    In link.php you can increment the counter for $_GET['link'] (stored in a database), and then redirect with header('Location: ' + $_GET['link']);
     
    lephron, Mar 7, 2008 IP
  3. Finney

    Finney Peon

    Messages:
    458
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes, simply put a MySQL query on the link out page updated the database to add +1 onto the current amount of outgoing links. Then have a cron using another simple to refresh the database to '0'.
     
    Finney, Mar 28, 2008 IP
  4. JohnS0N

    JohnS0N Notable Member

    Messages:
    1,581
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    210
    #4
    Thanks Finney and lephron. I've found a helpful script called ccount. It does all I need to and its free. Hope it helps somebody!
     
    JohnS0N, Mar 30, 2008 IP
  5. Finney

    Finney Peon

    Messages:
    458
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #5
    No problem. :)
     
    Finney, Mar 30, 2008 IP
  6. uooser

    uooser Peon

    Messages:
    71
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thats interesting
     
    uooser, Mar 30, 2008 IP