1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Introduction to Affiliate Offer Completion Tracking

Discussion in 'Affiliate Programs' started by oldenstylehats, Jul 8, 2008.

  1. oldenstylehats

    oldenstylehats Elite Member Premium Member

    Joined:
    Apr 10, 2008
    Messages:
    1,893
    Likes Received:
    1,196
    Hello BHWers,
    After reading another thread on the forum where a question regarding tracking IP addresses after offer completion was posed, I decided to make a post to help explain the basic idea behind affiliate tracking. While we realize that most seasoned affiliates are very aware of the technique we're going to outline in this post, we hope that our less experienced readers learn something. What you are about to read is one of the most basic ways to really begin analyzing traffic and creating metrics to streamline and optimize your affiliate sales efforts.

    Disclaimer
    This is not an efficient or elegant way to go about tracking the people who complete your offers. However, if you're not already currently tracking the leads you're generating, it is a very simple way to start a process that will help refine your abilities as an affiliate marketer. We're not going to offer that many code or SQL snippets because we firmly believe that some parts of the game are to be sold, not told. That said, nothing in this article is too complicated for a beginner to figure out.

    What You'll Need
    Here are a list of things which you hopefully already have access to, but which are necessary to go forward with the procedure we're about to discuss

    * Shared Hosting (or better)
    * PHP4 (or greater)
    * MySQL 4 (or better) and the ability to create new DBs
    * Text Editor
    * FTP client

    Getting Started
    First off, you'll want to create a MySQL DB to store and handle the information you'll begin tracking from here on out. To do that, you'll probably want to access phpMyAdmin. If you're unfamiliar with how to use this web application, you should read the manual. You'll want to create a table and a series of appropriate fields. The number of fields is dependent upon what you want to track. So, for very, very basic tracking you'll want to create a field to track the user's subid, the offer ID of the offer the user filled out, the date they filled it out, and their IP address. This is list of fields is very flexible.

    Once you've created the DB, you'll want to create a unique ID to begin to track the users that click on your offers. We've done this by simply creating a unique identifier with PHP that gets sent by path argument to each URL referrer page like so:

    PHP:
    <?php
    function genKey ($length 10)
    {
      
    $key "";
      
    $possible "0123456789bcdfghjkmnpqrstvwxyz"
      
    $i 0
     
      while (
    $i $length) { 
        
    $char substr($possiblemt_rand(0strlen($possible)-1), 1);
        if (!
    strstr($key$char)) { 
          
    $key .= $char;
          
    $i++;
        }
     
      }
    return 
    $key;
    }
    ?>
    You can either put this code into a separate page, include it on your main page, and call the function or just run the entire process on your main page. The output will be a string similar to this: 8g2kbcz0qr

    You'll want to pass this unique identifier onto your referrer pages. You'll then want to link to your affiliate page with something similar to this:

    HTML:
    <a href="http://www.yoursite.com/offer.php?id=<?php echo $key ?>" target="_blank">Click here to fill out your offer.</a>
    Now you'll want to figure out how your affiliate network handles subids. Subids are independently assigned path arguments that you can create to send very specific information to your affiliate networks which may then be sent back to you via a universal pingback upon offer completion. There is a fantastic list and small primer on subids located at Subids.com.

    Once you've figured out how to process subids on your respective network, you'll want to make sure that the unique ID you created earlier gets passed to the affiliate network. In this example, I'll use Azoogle's subid system. So, if you've setup a link like I specified earlier, this is the code you'd need to have on http://www.yoursite.com/offer.php:

    PHP:
    <?php
    $sid 
    trim($_GET['id']);
    header"Location: http://x.azjmp.com/%OFFERID%sub=".$sid) ;
    ?>
    %OFFERID% is where you'll want to place the unique offer ID provided for you by affiliate, which, in this example, is Azoogle.

    If you want, you can also begin to track how many users that click your offer links actually complete your offers. To do this, you'll want to create a record and leave the IP address or offer ID fields blank on the referrer page. This way, you can easily discern between records that have and have not completed offers.

    Just like most affiliate networks, Azoogle's universal pingback tool is very easy to setup. How these tools works is that they send a very basic hit with some path argument attached every time someone completes one of your offers. For this example, a very easy pingback URL to use would be:

    Code:
    http://www.yoursite.com/pingback.php?subid=%%SUB_ID%%&offerid=%%OFFER_ID%%
    The %%SUB_ID%% indicates where your SubID will be. Your %%OFFER_ID%% indicates where the unique ID of your offer will be. When a user has completed an offer, http://yoursite.com/pingback.php will receive a "ping" from the affiliate network with all of the information you've requested attached via path argument, so you'll want to be able to read these, right?

    The code is very simple:

    PHP:
    <?php
    $subid 
    trim($_GET['subid']);
    $oid trim($_GET['offerid']);
     
    list(
    $affid$sid) = explode("-"$subid);
    ?>
    This will grab each respective argument and store it into a variable. The reason for the explode() is that Azoogle returns each subid with your affiliate ID separated by a dash and then whatever subid you define. So, if you defined 8g2kbcz0qr as the subid and your affiliate ID is 12345 then the resultant argument would be: ?subid=12345-8g2kbcz0qr

    Now, since you know that any ping to this page is the result of either a test of yours or an actual completion, you can easily begin to add information like the time and IP address to your database. This can be done by simply assigning the IP address to a variable with the following command:

    PHP:
    $ip=$_SERVER['REMOTE_ADDR'];
    Once you have the IP address assigned to a variable, adding it to your DB is very simple.

    Hopefully everyone who has read this article and was previously unfamiliar with the basics of affiliate tracking now has a better idea of how to go about doing it. As I stated in the beginning, this is by no means the most elegant or efficient way to go about tracking, it's just a very basic method that works in a pinch.

    I've also posted this article on my blog here.
     
    • Thanks Thanks x 15
  2. ximscreamingx

    ximscreamingx Power Member

    Joined:
    Jan 16, 2008
    Messages:
    617
    Likes Received:
    325
    Location:
    Next to Missy Elliot
    Fantastic post Olden
     
  3. Whisker

    Whisker Moderator Staff Member Moderator Premium Member

    Joined:
    Dec 26, 2007
    Messages:
    994
    Likes Received:
    1,322
    Indeed, very useful information here for a wide range of applications.
     
  4. oldenstylehats

    oldenstylehats Elite Member Premium Member

    Joined:
    Apr 10, 2008
    Messages:
    1,893
    Likes Received:
    1,196
    Indeed.

    If anyone has any questions, post them here and we will try and help you figure them out. The idea is to help you understand how the underlying process works just as much as it is to get the results the process provides.
     
  5. unknown_zero

    unknown_zero Jr. VIP Jr. VIP Premium Member

    Joined:
    May 15, 2008
    Messages:
    1,969
    Likes Received:
    574
  6. MrNoob

    MrNoob Registered Member

    Joined:
    Mar 16, 2008
    Messages:
    93
    Likes Received:
    145
    Location:
    Southern California
    Thanks olden for the post but I am afraid Genjutsu is correct in his statement that
    it is a little above a lot of people. For us noobs that just recently realized that PHP doesn't
    stand for "Pee Here People" might there be a software for purchase that would be recommended?
    Because it'll a long time for this noob to figure out how to do what you just
    wrote. I understand I need to work at understanding these things but I would like to be making the cash while I'm working to understand. But I really appreciate the sharing of knowledge and hope to be worthy of it some day.
     
  7. Loak

    Loak Jr. VIP Jr. VIP

    Joined:
    Apr 21, 2008
    Messages:
    314
    Likes Received:
    109
    brilliant stuff. thanks, this forums got some good chit.
     
  8. grafx77

    grafx77 BANNED BANNED

    Joined:
    Mar 6, 2007
    Messages:
    445
    Likes Received:
    211
    Yes Mr Noob....there is. It's called Xtreme Conversions. Google it and you will find that this program is very complex and will solve all your tracking issues. :)