Is it possible to do conversion tracking inside/with a PHP redirect?

by 3 replies
4
I usually use the following type of url:

Code:
http://mysite.com/link/product/
...which points to a folder with a simple PHP redirect like this:

Code:
<?php
header( 'Location: http://cb_nick.cb_product.hop.clickbank.net/?tid=source1' ) ;
?>
Is it possible to do any type of stat counting within this type of redirect? I'm playing with a split test idea, and this would be very helpful.
#programming #conversion #inside or with #php #redirect #tracking
  • Yeah, you can track how many times the site has been visited (how many who have clicked the link)

    <?php
    $filename = "stats.txt";
    $clicks = file_get_contents($filename);
    $clicks++;
    $fp = fopen($filename, "w");
    fwrite($fp, $clicks);
    fclose($fp);

    header("Location: put-your-url-here");
    ?>

    Create a file named stats.txt and upload it to the same folder as this script, then CHMOD it to 777, and then your set!

    Hope this was helpful!

    EDIT: I forgot to mention that the number of times the link has been clicked is recorded in stats.txt
    • [ 1 ] Thanks
  • I've got the same question, and I use the exact same technique as you, Kelly.

    Given clickbank already tells us how many hops we get & we can use tids to work out where they came from, I think we need to use 301 or 302 redirects, which I'm trying to work out right now in cpanel!

    I'll let you know how I go... but at the moment I think i'm gonna do this:

    1. Create a new page to replace the direct .php link. I'll call it /recommends/product1.html
    2. Put the google website optimizer code in that html file.
    3. Set a redirect from /recommends/product1.html (not sure which type?) to /recommends/product1.php, which sends them along to the aff sales page.

    Anyone actually know what they're talking about? I sure don't... :-)
  • I'm not sure if they brought it back yet but Firefox left out the header Location in one of their releases a few years back. I have avoided using that since and went with boring HTML redirects.

    Just wanted to bring that up in case it's still a problem and you are losing sales because of this silly mistake.

Next Topics on Trending Feed