So, I decided I wanted to be able to track Clickbank sales for campaigns run through MobAffTracker or other systems that used postback URL tracking. Obviously not as simple as just adding a pixel with Clickbank. Luckily, 3dolla (parthenon), a member here, made CB-Trax which makes it easy to get Clickbank firing off conversions to Prosper202.
Here
Sweet! So I decided to try and get it working with MobAff.
Disclaimer: I haven't tested this as I'm not running traffic to any CB offers thus can't get conversions to test it with. If someone can test it that would be great (I'm pretty sure it should work fine).
Step 1: Buy CB-Trax. The author deserves full credit for making this and thus your money. That and I don't condone editing/disseminating someone's code that they put money into making. The link on their forum post is dead but you can still get it as a WSO via here http://www.warriorforum.com/warrior-...-campaign.html (well, at least I assume you can).
Step 2: Follow the install instructions CB-Trax provides for getting the Clickbank side of things up and running. Hehehe yep gotta buy it to get easy mode instructions.
Step 3: Set your secret key, set notification URL to http://mydomain.com/cbtracking.php.
Step 4: Here is what you want inside cbtracking.php:
<?php
$myKey = 'YOUR_KEY'; //refer to the manual if you don't know what this is
$testmode = 'OFF'; //Options OFF or ON
function ipnVerify() {
global $myKey;
global $_EXPECTED;
global $_RESULTS;
$FORCEonTEST = true;
$secretKey = $myKey;
$pop = "";
$ipnFields = array();
foreach ($_POST as $key => $value)
{
if ($key == "cverify") {
$_EXPECTED = $value;
continue;
}
$ipnFields[] = $key;
}
sort($ipnFields);
foreach ($ipnFields as $field)
{
$pop = $pop . $_POST[$field] . "|";
}
$pop = $pop . $secretKey;
$calcedVerify = sha1(mb_convert_encoding($pop, "UTF-8"));
$calcedVerify = strtoupper(substr($calcedVerify,0,8));
$_RESULTS = $calcedVerify;
if ($_POST['ctransreceipt'] == '********' && $_POST['ctransaction'] == 'TEST' && $FORCEonTEST){
return true;
}
elseif ($_POST['ctransreceipt'] == '********' && $_POST['ctransaction'] == 'TESTx' && $FORCEonTEST){
return true;
}
return $calcedVerify == $_POST["cverify"];
}
if($_POST['ctransaction'] == 'SALE' or $_POST['ctransaction'] == 'BILL' or $_POST['ctransaction'] == 'TEST') {
$transid = $_POST['ctid'];
$amount = $_POST['corderamount'];
if($_POST['ctransaction'] == 'BILL') { $amount = $_POST['crebillamnt']; }
else { $amount = $_POST['corderamount']; }
$amount = $amount / 100; // Clickbank sends the amount in cents
$convurl = 'http://api.mobaff.com/conversion/'.$transid.'?payout='.$amount;
$convresp = file_get_contents($convurl);
}
?>
Does anything special have to be done for cpvlabs?
I see in the documentation this:
Setup Clickbank as an Affiliate Network…
Clickbank is setup in CPV Lab by default, but in the event it’s been removed and you need to
add it again…follow the quick instructions below:
Setting Up Clickbank Offers in your Campaign…
You’ll setup your campaign as you normally would…but when entering your Clickbank offers…
Clickbank must be selected or the SubIDs will not work correctly. CPV Lab generally uses
spacing characters “ _ “ in SubIDs, but these types of characters are not allowed in Clickbank
Tracking IDs. So when Clickbank (exactly as show) is selected CPV Lab will automatically
change the spacing character in the SubIDs to “z” in order to pass correctly to Clickbank.
Sorry this is mad ugly let me try a screenshot:
I don't use CPV Lab so unfortunately I'm not sure of any particular changes you need to make, but the stuff above does sound sensible.
Contact the CPV Lab helpdesk if you need assistance configuring your campaign for Clickbank so that it uses 'z' spacers.
Then, in the script above you will just need to modify the postback URL to that of CPV Lab, i.e. modify this line:
$convurl = 'http://api.mobaff.com/conversion/'.$transid.'?payout='.$amount;
Zeno, it looks like the CB-trax website is down. Would you be able to fill in the missing steps to set this up properly?
Also, will this work if I direct link to the checkout page? I want to promote a product with a crappy sales page, by using my own sales page and direct linking to the checkout (Yes, I know I will lose some delayed sales due to the cookie not setting)