Keyword Analysis for Affiliate Marketers

I previously showed how to do link cloaking using PHP.

I’ve been modifying it to help me tune my campaigns a little better, so I thought I’d share the latest version.

This is the PHP file that you’d call for your jumps…

<?php
// Edit this key for the secret part of your keyword encryption
$encryptkey = '123';
// Edit this array for your offer jumplinks
$path = array(
'azoogle' => 'http://x.azjmp.com/XXXXX?sub=',
'copeac' => 'http://www.cpaclicks.com/redirect.asp?a=xxxx&b=xxxxx&d=0&l=0&p=0&o=',
);
// Use the 'key' variable (set at the destination URL of your ad) so you know which ad-network or ad-group the user is coming from
$key = htmlspecialchars($_GET['key']);
$ovkey = htmlspecialchars($_GET['OVKEY']);
$ovraw = htmlspecialchars($_GET['OVRAW']);
$mdkey = md5($encryptkey . $ovkey);
$filename = './logs/' . $key . '.txt';
$content = 'JUMP, ' . $_SERVER["REMOTE_ADDR"] . ', ' . date(”h:iA”) . ', ' . date(”Y-m-d”) . ', ' . $mdkey . ', ' . $ovkey . ', ' . $ovraw;
$handle = fopen($filename, 'a');
fwrite($handle, “$content\r\n”);
fclose($handle);
if (array_key_exists($_GET['id'],$path))
header('Location:'.$path[$_GET['id']].$key.'-'.$mdkey);
?>

The code is rather complex, so I’d recommend you learn PHP if you want to modify it to your liking. But as it is, the code works fine if you just want to cut-and-paste it onto your site (you’ll of course need to replace the jumplinks with your affiliate links :D ).

To summarize what this code does:

  • It encrypts the keyword using an MD5 hash (which is one-way encyrption, so people can’t reverse-calculate your keyword) and sends it as a SubID. [I]Note the way I’ve provided the Azoogle and Copeac jumplinks. Azoogle requires the “subid” key, and Copeac uses the “o” key to input the SubIDs.[/I]
  • Write to $key.txt, a line that tracks IP, time/date, the OVKEY (keyword), OVRAW (what the user actually typed) _and_ the actual MD5 hash.

The log file will end up with a line like this:
JUMP, 70.170.13.79, 04:42PM, 2007-07-20, 202cb962ac59075b964b07152d234b70, test-ovkey, test-ovraw

Some simple analysis you can run on the logs:

  • Look at your conversions at your affiliate company. From their stats, you’ll see which MD5 key converted. So you can easily do a search against the log file to find out the real keyword which lead to the sale.
  • Compare your log against your affiliate company stats. If you’re getting click-throughs but no conversion, you might want to remove that keyword from your campaign.

NOTE: in the code, modify $encryptkey to your own secret password. The MD5 hash is calculated using the $encryptkey pre-pended to your keyword (so in the example above, the MD5 is calculated against “123test-ovkey”). This is just another layer of secrecy for you to sleep better at night ;)

Comments
4 comments have been left so far »
  1. MyAvatars 0.2 Jonathan
    July 21, 2007

    What would be the purpose of encrypting the ovkey?

    Just trying to figure that bit out.

    Thanks,
    Jonathan

    Leave a reply
  2. MyAvatars 0.2 artarmon42
    July 22, 2007

    You can’t really tell which keyword actually converts, unless you look at the SubID from the affiliate company’s stats. You’ll need some kind of unique identifier. A traditional method is to just send the keyword as a SubID, but people might not want to tell their affiliate company which keywords convert best.

    So the simplest way to achieve this correlation between keyword and conversion, is to substitute a unique identifier. Thus, the MD5 hash, creates a unique identifier, based off the keyword, without actually revealing the keyword. Thus, you’ve got the keyword/conversion correlation, while maintaining secrecy of your keyword list.

    Note, knowing the correlations is also useful in identifying keywords that click-through to the offer page, but never convert (thus wasted PPC costs).

    Leave a reply
  3. MyAvatars 0.2 Keyword Analysis for Affiliate Marketers (Part 2) at Note to Self…
    July 22, 2007

    [...] Keyword Analysis for Affiliate MarketersWhy isn’t my keyword isn’t getting any impressions?Yahoo Search Marketing techniqueLink CloakingBroad Match problems with Google Adwords [...]

    Leave a reply
  4. MyAvatars 0.2 Nicole
    April 25, 2008

    Good tips here. Better improve my PHP noob skills : ) Thanks.

    Leave a reply
Leave a Comment
Add your picture!
Join MyBlogLog and upload your avatar. C'mon, it's free!