The Most Active and Friendliest
Affiliate Marketing Community Online!

“Adavice”/  “1Win

C.J.com Conversions With Prosper202

jims45

Member
trackingcj.png

Tracking C.J.com Conversions With Prosper202


For a long time
I struggled with Prosper202 and it took time to understand the set up procedure. Thanks to the excellent guide on this Forum and the many videos available online I can now set up campaigns easily.

Tracking CJ with Prosper202

For those of you that run Commission Junction campaigns here is a handy script I discovered online that enables you to track conversions on auto, you can find it here:

Tracking CJ Commissions with Prosper202 - Eric Nagel

Code

PHP:
<?php
    $cDevKey = 'your-developer-key';
    $cURL = 'https://commission-detail.api.cj.com/v3/commissions?';
    $cURL .= 'date-type=event&';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $cURL);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                  'Authorization: ' . $cDevKey,
                  'User-Agent: "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 GTB6 (.NET CLR 3.5.30729)"'
                ));
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    $cHTML = curl_exec($ch);
    if (curl_error($ch)) {
        echo "Curl error: " . curl_error($ch);
    } // ends if (curl_error($ch))
    else {
        $cXML = simplexml_load_string($cHTML);
        for ($i = 0; $i < count($cXML->commissions->commission); $i++) {
            $oCJCommission = $cXML->commissions->commission[$i];
            $cPostback = 'http://yourdomain.com/tracking202/static/gpb.php?amount=' . urlencode($oCJCommission->{'commission-amount'}) . '&subid=' . urlencode($oCJCommission->sid);
            $fpPostback = @fopen($cPostback, "r");
            if ($fpPostback !== false) {
                fclose($fpPostback);
            } // ends if ($fpPostback !== false)
        } // ends for ($i = 0; $i < count($cXML->commissions->commission); $i++)
    } // ends else from if (curl_error($ch))
?>

You will also need to know how to add the Prosper [[subid]] token to your CJ link, take a look at the screenshot and you will see it is really quite simple to do.
I use the script with an unmanaged VPS and set up a cronjob to run it at 4am daily, this sounds complicated but the excellent support community at Digital Ocean soon helped me set that up with simple commands.
If you don't feel comfortable with syntax, here is a site that will create the cronjob syntax for you:

Crontab Generator - Generate crontab syntax

Problem solved...happy tracking!
Prosper CJ.png
 
Last edited:
MI
Back