Knowledge Base      


How do I track affiliate sales using Postback URLs?


If you don’t have the ability to add the tracking pixels or the Conversion Tracking Code to the “Thank You” page users land on after making a purchase, then you’ll need to use Postback URLs to track your sales.

A “Postback” is simply an automated notification that your affiliate network (such as ClickBank or MaxBounty) sends to ClickMagick whenever someone clicks on your affiliate link and makes a purchase. This allows ClickMagick to record the sale, as well as record any upsells, downsells, and refunds. It’s a more accurate way of tracking conversions if you’re willing to put in the work to set it up.
 

The process to set up a Postback URL with Campaigns is really simple if you just follow these steps provided. 
 
 
Note: Setting up a Postback URL with ClickBank is a bit different than for other networks. If you want to learn how to set up a Postback URL with ClickBank, take a look at this article and select the “ClickBank” tab:

How do I track sales with my affiliate network?


Step 1 – Include the cmc.js Code on Any Page That Uses Affiliate Links

If you already have the Click Tracking Code or the Conversion Tracking Code on all the pages where you use affiliate links, there’s nothing else to do.

Otherwise, add the line below to any pages where you need to use the [cmc_vid] token that don’t already have the Click Tracking Code or Conversion Tracking Code, preferably in the <head> section:

<script src='//cdn.clkmc.com/cmc.js'></script>


 


With the code in place, whenever the page is loaded all of the [cmc_vid] tokens you used in your affiliate links will automatically be replaced with a unique visitor ID for tracking purposes.

 
Note: Usually, adding that one line to your page is all you’ll need to do. However, there are two cases that will come up for web developers who create their own pages using advanced programming techniques. You can read about those below ...


Step 2 – Add a Visitor ID to Your Affiliate Link

The first step is to pass a visitor ID generated by ClickMagick to your affiliate network via your affiliate link.

The same process works for any affiliate network, but we’ll use MaxBounty for this example.
 
1.    When you’re on the Campaigns dashboard, you’ll see a menu that has some options in it. Click on the option that says “Affiliate Link Builder”.
 
  
      
 
2.    Next, select your network from the menu, paste your affiliate link into the edit box, and click the “Generate New Affiliate Link” button. This will add a new [cmc_vid] token to your affiliate link:
 
 
 
 
3.    Lastly, copy the modified affiliate link and use it everywhere you would normally use your unmodified affiliate link. This won’t change how your affiliate link works in any way—it simply sends some additional information to your affiliate network that allows ClickMagick to track your Campaign sales.


Step 3 – Add Your Postback URL to Your Affiliate Account

The next step is to go to the Postback URL Tool which you can find in the Tools menu under the subheading “Postback URLs”. Click on the Copy button next to the network that you’re using:
   
 
   

The Postback URLs in your account will be different from what you see in the screenshot, so copy the URL that you see listed in your account for the network that you’re using.

Every affiliate network is a bit different in terms of how and where you add your Postback URL, but with MaxBounty, for example, you would add it one time by clicking on the User icon, then select Global Postback and it will be used for all your offers

 

 
With other networks you may need to add the Postback URL to each specific offer.

If you have the choice of adding the Postback URL just once in a global setting, we strongly recommend doing that so you can set it once and forget about it.

Also, when you add your Postback URL you may have to select a “type” to go with it (as shown in the MaxBounty example). Each affiliate network is a bit different, but always choose the option that says something like URL, Postback URL, etc. and never select pixel, iframe, HTML, JavaScript, etc.

If you can’t figure out where to add your Postback URL in your affiliate account to track your sales, just ask your affiliate manager or contact their customer support and they can tell you.
 

Replacing [cmc_vid] tokens in Non-URL Attributes

By default, the cmc.js script will replace tokens in the href="..."src="..." and value="..." attributes of HTML elements.

If you need to use a [cmc_vid] token in another type of attribute, you can add the attribute type to the existing list of attributes by including a special attrs property in a clickmagick_cmc object.

For example, if you had a special data-url="..." attribute, you could add that to the list by including this piece of code before you load the cmc.js script:

<script>
   var clickmagick_cmc = {
      attrs: ['data-url'],
   }
</script>
<script src='//cdn.clkmc.com/cmc.js'></script>


If you needed to add more than one attribute type, just separate each one with a comma:

attrs: ['data-url', 'placeholder', ...],

If you already have an existing clickmagick_cmc object on the page because you’re tracking a Campaign click or conversion, simply add the attrs line anywhere in the existing object. Just be sure to include that final comma on the end of the line.
 

Adding the [cmc_vid] value to JavaScript code

In other cases, you might need to use the [cmc_vid] value in your own JavaScript code.

In this scenario, if you don’t already have a clickmagick_cmc object on your page, add one with an empty vid field before you load the cmc.js file, like this:

<script>
   var clickmagick_cmc = {
      vid: '',
   }
</script>
<script src='//cdn.clkmc.com/cmc.js'></script>


If the script sees a vid field, it will fill it in with the unique Visitor ID which you can then use. For example:

var url = 'https://affiliatenetwork.com?s2=' + clickmagick_cmc.vid;

For the vid property to be initialized, you need to load the cmc.js file before executing your own JavaScript code.



Setting up a Postback URL when tracking links is just as simple as with Campaigns, the main difference being the token used for the visitor ID. See the steps below to learn how to set up a Postback URL with your tracking links.
 
 
Note: Setting up a Postback URL with ClickBank is a bit different than for other networks. If you want to learn how to set up a Postback URL with ClickBank, take a look at this article and select the “ClickBank” tab:

How do I track sales with my affiliate network?




Step 1 – Add a Click ID to Your Affiliate Link


The first step is to pass a click ID generated by ClickMagick to your affiliate network via your affiliate link.

The same process works for any affiliate network, but we will use MaxBounty for this example.
 
1.    When you’re creating your tracking link, insert your affiliate link into the Primary URL, then click on the menu and choose the option to add the Click ID. That will automatically add the correct Postback URL tracking code to the end of your affiliate link:

  
 

This won’t change how your affiliate link works in any way. It simply sends some additional information to your affiliate network that allows ClickMagick to track your sales.
 
 
Step 2 – Add Your Postback URL to your Affiliate Account

 The next step is to go to the Postback URL Tool which you can find in the Tools menu under the subheading “Postback URLs”. Click on the Copy button next to the name of your affiliate network:
  

   

Your Postback URLs will be different from what you see in the screenshot, so copy the URL that you see listed in your account for the network that you’re using.

Every affiliate network is a bit different in terms of how and where you add your Postback URL, but using MaxBounty as an example, you would add it one time by clicking on the User Icon, then select Global Postback and it will be used for all your offers:

 

 

With other networks you may need to add the Postback URL to each specific offer.

If you have the choice of adding the Postback URL just once in a global setting, we strongly recommend doing that so you can set it once and forget about it.

Also, when you add your Postback URL you may have to select a “type” to go with it (as shown in the MaxBounty example). Each affiliate network is a bit different, but always choose the option that says something like URL, Postback URL, etc. and never select pixel, iframe, HTML, JavaScript, etc.

If you can’t figure out where to add your Postback URL in your affiliate account to track your sales, just ask your affiliate manager or contact their customer support and they can tell you.


Troubleshooting Your Postback URL

If you’re having trouble with your Postback URL, we have outlined common reasons why it isn’t working correctly in the article below:

What if my Postback URL isn’t working?

If you have any questions, please submit a ticket at our Helpdesk with all the relevant details and we’ll be happy to take a look. Be sure to explain exactly what you’ve done based on the steps of this tutorial (with screenshots if possible) and what’s not working as expected.

Remember – the more details you provide, the better we’ll be able to help you!

Article 119 Last updated: 10/31/2021 9:54:04 AM
https://www.clickmagick.com/kb/?article=119