propellerads adcombo
Dismiss Notice
Welcome to Our Community
Wanting to join the rest of our members? Feel free to sign up today.

TUTORIAL: Clickbank postback to ANY tracker

Discussion in 'Tracking' started by Vita Vee, Aug 27, 2015.

  1. Vita Vee

    Vita Vee Service Manager Service Manager affiliate

    55
    137
    33
    There are quite a lot of affiliates promoting Clickbank offers and using trackers that are not fully integrated with CB's IPN. Usually it means that every so often they need to export the converted tids from CB and update the conversions manually in their tracker.

    My 1st advice for these affiliates would of course be to switch to Funnel Flux, as it's fully integrated with Clickbank and working with all the other affiliate networks. Plus it's the best funnel builder and affiliate tracker anyway - but that's another story :)

    But for the stubborn ones (haha) there's still a solution. Very few CB affiliates are aware of this (maybe no one???) but you can actually have Clickbank call your postback everytime a sale occurs!

    There's a catch though - the postback parameters cannot be configured, so it's pretty much incompatible with all the trackers. But you can make it compatible with a tiny little script that I'm going to share with you.

    You will need 4 things to get this working:

    1/ A Clickbank account
    2/ The postback URL from your tracker
    3/ The script I'm sharing with you below
    4/ An SSL certificate - Clickbank will not call your postback if it's not reachable via https (you can get an SSL certificate for free at startssl.com - so no excuse for this point)

    So, go to your CB account and click on "My Site" in the top navigation:

    [​IMG]
    Then scroll down until you reach the section titled "Integrated Sales Reporting"

    [​IMG]
    Click the "Add Tracking Code" button.

    In the "Type" combobox, select "Tracking Pixel: Order Confirmation (Receipt)"

    Then for "Track Sale As", select the "Affiliate" option.

    For the Tracking Pixel URL, enter the URL where you will upload the script that I'm sharing with you below. Let's say the URL you will use is https://yourdomain.com/vitavee-cb.php

    For the tracking parameters, you can just click the box that says "Select All Parameters"

    It should look like this:

    [​IMG]
    Click save.

    You will then be redirected to the previous page, and your settings will be displayed like this:

    [​IMG]

    Note that your tracking pixel will be inactive. We will activate it later. We first need to edit a few things.

    First create a file called vitavee-cb.php and paste the following code in that file:

    Code:
    <?php
    
    // Script written by Vita Vee for affiliates who are
    // NOT using the best funnel builder and tracker out there (ie Funnel Flux)
    // and want a way to have Clickbank report conversions to their tracker.
    // This script only reports initial sales and upsells.
    // If you were using Funnel Flux instead, then rebills and refunds
    // would also be tracked automatically as Funnel Flux is fully integrated with Clickbank.
    //
    // Instructions: You will edit the 4 parameters defined
    // in the "SETTINGS TO EDIT" section below.
    //
    // 1/ Replace the value of $postbackURL by the postback URL given to you by
    //    your tracker BUT in that URL keep only the part that is before the ?
    //
    // 2/ Replace the value of $cidParameterName by the name of the click-id
    //    parameter (example: "cid" for Voluum)
    //
    // 3/ Replace the value of $payoutParameterName by the name of the parameter
    //    that allows you to track your commissions for a conversion (example: "payout" for Voluum)
    //
    // 4/ Replace the value of $transactionParameterName by the name of the parameter
    //    that allows you to track upsells (example: "txid" for Voluum)
    //
    // Only $postbackURL and $cidParameterName are mandatory.
    // If you do not want or can't fill in the other two, then make them empty like this:
    // $payoutParameterName = ""
    // $transactionParameterName = ""
    
    //-----------------------------------------------------
    // SETTINGS TO EDIT
    //-----------------------------------------------------
    $postbackURL = "http://xxxxx.trackvoluum.com/postback?cid=REPLACE&payout=OPTIONAL&txid=OPTIONAL";
    $cidParameterName = "cid";
    $payoutParameterName = "payout";
    $transactionParameterName = "txid";
    //-----------------------------------------------------
    
    //-----------------------------------------------------
    // DO NOT TOUCH ANYTHING BELOW
    //-----------------------------------------------------
    $tid    = filter_input(INPUT_GET, "trackingCodes");
    $payout = filter_input(INPUT_GET, "affiliateCommission");
    $txid   = filter_input(INPUT_GET, "receipt");
    
    $aParams = array();
    
    if( $tid !== null && !empty($cidParameterName) )
        $aParams[$cidParameterName] = $tid;
    
    if( $payout !== null && !empty($payoutParameterName) )
        $aParams[$payoutParameterName] = $payout;
    
    if( $txid !== null && !empty($transactionParameterName) )
        $aParams[$transactionParameterName] = $txid;
    
    $aParts = explode("?", trim($postbackURL));
    $finalPostbackURL = $aParts[0]."?".http_build_query($aParams);
    
    if( $finalPostbackURL )
    {
        $ch = curl_init($finalPostbackURL);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HEADER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        curl_exec($ch);
        curl_close($ch);
    }
    Then you'll have to change a few settings in that file, in the section called "SETTINGS TO EDIT"

    The first thing you need to change is the value of $postbackURL.
    Take the postback URL from your tracker and paste it there, between quotes.

    If your tracker is Voluum - then you're done on the editing part!

    If you're using another tracker, you'll also have to change the 3 other parameters.

    On the line:
    $cidParameterName = "cid";
    Replace "cid" with the name of your postback click id parameter (put it between quotes). Check the documentation of your tracker for this.

    On the line:
    $payoutParameterName = "payout";
    Replace "payout" with the name of your postback commissions parameter - that way the commission amount for this transaction will be sent back to your tracker. If you don't want to send the commission amount, you can set this value to "". Check the documentation of your tracker to find the name of the commission amount parameter.

    On the line:
    $transactionParameterName = "txid";
    Replace "txid" with the name of your postback transaction id parameter - that way you will be able to track upsells. Check the documentation of your tracker to find the name of the transaction id parameter. If none, enter the empty value ""

    Then upload that file on your server, in a way that you can access it via the URL mentioned in Clickbank at a previous step. In our example it was https://yourdomain.com/vitavee-cb.php

    Go back to Clickbank, and activate your tracking pixel:

    [​IMG]

    That's all!

    Now everytime a sale or an upsell occurs, your tracker's postback URL will instantly be called.

    If you want to know more about Funnel Flux, check out our resource page here on AffiliateFix.
     
  2. T J Tutor

    T J Tutor Administrator Administrator moderator affiliate

    7,409
    3,125
    113
    Well done, always great info from you @Vita Vee !
     
    Alex_O99 and Vita Vee like this.
  3. Vita Vee

    Vita Vee Service Manager Service Manager affiliate

    55
    137
    33
  4. gnr5

    gnr5 Affiliate affiliate

    13
    8
    3
    Hi @Vita Vee !

    I'm trying to set this up using AdsBridge, is this correct???

    Code:
    <?php
    
    // Script written by Vita Vee for affiliates who are
    // NOT using the best funnel builder and tracker out there (ie Funnel Flux)
    // and want a way to have Clickbank report conversions to their tracker.
    // This script only reports initial sales and upsells.
    // If you were using Funnel Flux instead, then rebills and refunds
    // would also be tracked automatically as Funnel Flux is fully integrated with Clickbank.
    //
    // Instructions: You will edit the 4 parameters defined
    // in the "SETTINGS TO EDIT" section below.
    //
    // 1/ Replace the value of $postbackURL by the postback URL given to you by
    //    your tracker BUT in that URL keep only the part that is before the ?
    //
    // 2/ Replace the value of $cidParameterName by the name of the click-id
    //    parameter (example: "cid" for Voluum)
    //
    // 3/ Replace the value of $payoutParameterName by the name of the parameter
    //    that allows you to track your commissions for a conversion (example: "payout" for Voluum)
    //
    // 4/ Replace the value of $transactionParameterName by the name of the parameter
    //    that allows you to track upsells (example: "txid" for Voluum)
    //
    // Only $postbackURL and $cidParameterName are mandatory.
    // If you do not want or can't fill in the other two, then make them empty like this:
    // $payoutParameterName = ""
    // $transactionParameterName = ""
    
    //-----------------------------------------------------
    // SETTINGS TO EDIT
    //-----------------------------------------------------
    $postbackURL = "http://ppxyy.adsb4track.com/trackpixel/track";
    $cidParameterName = "tid";
    $payoutParameterName = "amt";
    $transactionParameterName = "txid";
    //-----------------------------------------------------
    
    //-----------------------------------------------------
    // DO NOT TOUCH ANYTHING BELOW
    //-----------------------------------------------------
    $tid    = filter_input(INPUT_GET, "trackingCodes");
    $payout = filter_input(INPUT_GET, "affiliateCommission");
    $txid   = filter_input(INPUT_GET, "receipt");
    
    $aParams = array();
    
    if( $tid !== null && !empty($cidParameterName) )
        $aParams[$cidParameterName] = $tid;
    
    if( $payout !== null && !empty($payoutParameterName) )
        $aParams[$payoutParameterName] = $payout;
    
    if( $txid !== null && !empty($transactionParameterName) )
        $aParams[$transactionParameterName] = $txid;
    
    $aParts = explode("?", trim($postbackURL));
    $finalPostbackURL = $aParts[0]."?".http_build_query($aParams);
    
    if( $finalPostbackURL )
    {
        $ch = curl_init($finalPostbackURL);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HEADER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        curl_exec($ch);
        curl_close($ch);
    }
    In your example you include the voluum postback URL but it includes everything after the ?, however the instructions says not to.

    Thanks
     
    Alex_O99 likes this.
  5. Vita Vee

    Vita Vee Service Manager Service Manager affiliate

    55
    137
    33
    Hi @gnr5 - yes you have set it up correctly.

    If you add the query after the ? it will just be stripped - The URL will be built back from the 3 other settings you have entered (cidParameterName, payoutParameterName and transactionParameterName)
     
    Alex_O99 likes this.
  6. gnr5

    gnr5 Affiliate affiliate

    13
    8
    3
    Hey @Vita Vee

    Thanks for the post, I just hit another conversion but it didn't get to AdsBridge. Are my parameters correct? Also this is the hoplink I'm using, this might be wrong: myinfo.offerinfo.hop.clickbank.net/?tid=<tid>"

    Thanks!

     
    Alex_O99 likes this.
  7. Vita Vee

    Vita Vee Service Manager Service Manager affiliate

    55
    137
    33
    It looks correct. But check with Adsbridge's support, as I'm not sure about their tokens.

    The token you use in your offer's url and your postback tokens must match.
     
    Alex_O99 likes this.
  8. Alex_O99

    Alex_O99 Service Manager Service Manager affiliate

    320
    127
    43
  9. gnr5

    gnr5 Affiliate affiliate

    13
    8
    3
    ABSOLUTELY AMAZING! THANK YOU GUYS!
     
    Zach AdsBridge and Alex_O99 like this.
  10. Martin

    Martin Affiliate affiliate

    1
    0
    1
    So this will work with Vouum also?
     
  11. nekrozon

    nekrozon Affiliate affiliate

    1
    0
    1
    Script works perfectly.

    I'm perplexed with one thing ... voluum is only receiving payout data for upsells. Makes no sense. affiliateCommission is the parameter that holds the commision $ amount for front end and upsells (according to CB documentation). It's literally the same line of code for ANY sale to report the payout. Unless a FE sale has a different commission parameter for FE sales .. I'm LOST!

    Any ideas?
     
  12. 007dutchy

    007dutchy Affiliate affiliate

    11
    11
    3
    I am using Adsbridge and my initial sales are registered but my upsells and rebills not... I am no techie, what should I do?
     
  13. dconstrukt

    dconstrukt Affiliate affiliate

    45
    27
    18
    awesome post. question.... how does this work/change if you it's YOUR offer? I sell via clickbank and use voluum.

    i heard you can't track upsells with it. Thats what I'd like to track... all the purchases so you get accurate data.

    appreciate any insights.
     
  14. azgold

    azgold Moderator moderator affiliate

    6,274
    2,297
    113
    @Vita Vee , are you around to help out @dconstrukt?

    S/he does not come to the forum every day but hopefully very soon. Meanwhile, maybe someone else will know.
     
    Vita Vee and dconstrukt like this.
  15. tyoussef

    tyoussef Moderator moderator Service Manager affiliate

    1,440
    591
    113
  16. dconstrukt

    dconstrukt Affiliate affiliate

    45
    27
    18
    @azgold - thank you so much. very nice of you. much respect :)
     
    azgold likes this.
  17. Vita Vee

    Vita Vee Service Manager Service Manager affiliate

    55
    137
    33
    This script won't work for your own offer. As a vendor, you cannot use the tid parameter for tracking purposes. However, you can use another parameter called vtid, that does pretty much the same thing (but is displayed in another section inside Clickbank's stats)

    As a vendor, you don't really need this script though. All you need to do is place the conversion pixel your tracker gives you on your thank you page.
     
  18. TonyB

    TonyB Affiliate affiliate

    113
    70
    28
    Thats some freaky s@#t...

    Literally looking at this issue right now and how to integrate Has Offers and come here to ask the question and bang!

    @Vita Vee - I am being lazy here, but how does funnel flux perform as just an affiliate network platform? I know it has lots of wonderful other features for buying that I would use later on, but right now I am sourcing campaigns for networks.
    I get given a list of campaigns from one network, so need to integrate an awful lot of CB campaigns, then be able to integrate a networks tracking (like Cake for example)

    I have hasoffers to host offers that I then run on our email and broker to other publishers, and was about to start using adsbridge for my own media buying... but would funnel flux cover all of this in a slick, sexy, way?
     
  19. dconstrukt

    dconstrukt Affiliate affiliate

    45
    27
    18

    thanks Vita. :)

    so from what you said before... funnelFlux can track my OWN funnel (plus the upsells)?

    just trying to make things easy to understand... all this tech stuff gets a bit complicated and overwhelming LOL :)
     
  20. Vita Vee

    Vita Vee Service Manager Service Manager affiliate

    55
    137
    33
    Hey Tony, I'm not sure, it depends on what you're trying to achieve exactly.

    Best would be to list the exact features you need, and I'll tell you if we have that or not :)


    Yeah definitely, I'm using it myself both as a vendor and as an affiliate. FunnelFlux sales are tracked by FunnelFlux itself :)
     

Featured Resources (View All)

adsxposed