1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP link tracking script

Discussion in 'PHP' started by mark1, Apr 25, 2005.

  1. #1
    I'm aware of php.. im a newbie...

    I noticed that some sites have code for some links that go like:

    site.com/out.php?x=2123

    i'm guessing its a tracking script.

    Has anyone got any experience with them?

    Any good (free) ones out there that I could use?

    Cheers
     
    mark1, Apr 25, 2005 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #2
    It's easily done and with just a few lines of code. Just be very sure why you are doing it as the links won't pass PR or "credit" to the site. If you use it with a link exchange the complaints will be loud and vociferous!

    This example uses a file called link.php and links that look like this: http://www.mysite.com/link.php?id=nzpif
    <?php
    //the hitcounter stuff
    $path = '/www/virtual/mysite/htdocs/';
    require "{$path}stats/include/stats_main.inc";
    $stats = new init(true, "{$path}stats/"); 
     
    switch($id)
    {
    case 'nzpif':
    	$url = 'http://www.nzpif.org.nz/';
    break;
    case 'petition':
    	$url = 'http://www.apia.org.nz/img/ARCPetition.pdf';
    break;
    case 'aking':
    	$url = 'http://www.propertyinvestor.info/arc.php';
    break;
    case 'nzpifconf':
    	$url = 'http://nz01.terabyte.co.nz/nzpif/NZartlist.asp?Website=2&Category=669725414';
    break;
    }
    if (isset($url)) header("Location: $url"); 
    exit;
    ?>
    Code (markup):
    Now this would be a pig to maintain as every link is hand coded. If you were dedicated to this approach you would store the id and link info in a table or flat text file and query that.

    In response to another post here on the same subject I have started an onclick javascript experiment from my blog. It's early days but it may be worth watching.

    Sarah
     
    sarahk, Apr 26, 2005 IP
  3. sadcox66

    sadcox66 Spirit Walker

    Messages:
    496
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #3
    sadcox66, Apr 27, 2005 IP
  4. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #4
    How does phpee help?
    When you go to their site the solution to this particular question isn't obvious.

    Sarah
     
    sarahk, Apr 27, 2005 IP
  5. sadcox66

    sadcox66 Spirit Walker

    Messages:
    496
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Sorry, did not provide enough information the first time.
    You can install a tracking script such as this one on your server from
    here.
    http://www.phpee.com/index.php?node=3

    Forums are located here.
    http://forum.phpee.com

    If you do not want to install many many sites offer this software
    for free for you to use.
    http://www.google.com/search?q=free+PPhlogger

    Note, the software is no way the best etc...
    I use it and find it convenient like many others

    Hoping they will improve the software in future
    it works great for my needs and may work for you.

    Join any of the free services and it will give you a
    tracking code like you described
     
    sadcox66, Apr 27, 2005 IP
  6. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #6
    If you do something like this it's a lot easier to maintain. :)
     
    exam, Apr 28, 2005 IP
  7. mark1

    mark1 Peon

    Messages:
    372
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Cheers! thanks for the help
     
    mark1, Apr 28, 2005 IP