Tracking with Commission Junction

I like to know certain information about the people who buy the products that I promote. The following are handy to know:

1. What keyword did they use to visit my site?
2. Did they come from the search network or the content network?
3. When did they visit my site? (Useful to know, so that you know how long after they clicked on your link before they actually made the purchase.)
4. What was their IP address? (You may then be able to find out exactly what they did on your site, by rummaging through your logs.)

Using Commission Junction’s Shopper ID tracking, here’s how it’s done!

  1. Design your page using your normal page design techniques, ensuring that the SID in each link is set to TRACKMEHERE.
  2. When you have saved your page with a .html extension, change the extension to .php.
  3. Add the following at the top of the file, before anything else:
    <?php
      $source = $_SERVER['REMOTE_ADDR'] . ' ';
      $source .= gmdate('mdHis') . ' ';
      if (isset($_GET['keyword'])) {
        $source .= $_GET['keyword'];
      }
      $source = trim($source);
      $source = strtr($source, ' ', '+');
    ?>
  4. Wherever TRACKMEHERE appears in your document, replace it with the following:
    <?php echo $source; ?>
  5. Add the following query parameter to your destination URLs in AdWords:
    ?keyword={ifcontent:CN+}{KeyWord}
    A sample URL might be:
    http://myurl.com/index.php?
    keyword={ifcontent:CN+}{KeyWord}

That’s it. You’re done.

When somebody causes an action that appears in your CJ logs, such as makes a purchase, the SID will be set to the following:

  1. The IP address of the user.
  2. Exactly when the page was served. This consists of five pairs of digits, with the first pair of numbers being the month, the second pair the date, the third pair the hour (24-hour clock), the fourth pair the minute, and the last pair the second. I chose not to include the year, as it’s very unlikely that cookies on CJ are ever set to run for longer than 365 days. Note: As your server may be located in a different time zone than your own, the time shown is given in UTC, or GMT. If you prefer to use local time, remove the “gm” in front of “gmdate” in the PHP code at the start of the web page.
  3. The letters ‘CN’ if the click came from the content network.
  4. The search keyword used when the ad appeared. (This is probably only meaningful for the search network. I’m not sure what it displays when somebody clicks through from the content network.)

You can test it by going to your URL and entering a query parameter straight away, and looking at the CJ affiliate links generated. They should all contain something like the following:

sid=123.234.123.234+1217123840+Test+Keyword

(The above would mean customer IP address of 123.234.123.234; date and time of 17th Dec, 12:38:40; not the content network (no CN after the date and time); and keyword of Test Keyword caused the ad impression.)

With this information, you can start building up a picture of which keywords convert to sales; how long it takes for the average customer to buy; what customers do on your site; and whether it’s worth paying for content network clicks.

David Thomas, The Affiliate Marketer

One Response to “Tracking with Commission Junction”

  1. What if they navigate to another page of my site and then click an affiliate link on another page, will the tracking keyword still show up the in CJ sid report?

Leave a Reply

Spam Protection by WP-SpamFree


Register Login