Results 1 to 2 of 2

Thread: Affilate tracker?

  1. #1
    Join Date
    Jun 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Affilate tracker?

    I am looking for a way to track the number of people sent from my site to another site via a link. Another words, how many people who were at my site clicked on the link that then took them to a different site.

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Well, you could make a PHP script that stores the info in a MySQL database. Just make your links something like this:

    Code:
    <a href="http://example.com/affiliate.php?url=http://blah.org/">blah.org</a>
    and use this as a basis for the php script:

    affiliate.php
    Code:
    <?php
    $url = $_POST['url'];
    
    $conn = mysql_connect('localhost', 'username', 'password');
    mysql_select_db('database', $conn);
    
    $info = mysql_query("SELECT * FROM `table` WHERE `url`='$url'");
    $q = mysql_fetch_array($info);
    
    $count = $q['count'];
    
    $count = $count+1;
    
    mysql_query("UPDATE `table` SET `count`='$count' WHERE `url`='$url'");
    
    header('Location: '.$url);
    ?>
    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

Bookmarks

Posting Permissions

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