Using Product ID to select campaign

One of the most useful information in sales tracking is the product ID. You can use it to: 
- set different commissions for different products
- save commissions only for chosen products
- track the product ID just as additional information about the order sale made on your website/e-shop

To explain with an example:
Whenever a visitor/customer clicks on an affiliate link or banner, the referral information is stored in the cookie. This information includes also the campaign into which the banner/link belongs. When the sale is accomplished, Post Affiliate Pro generates a commission according to the campaign that was stored in the cookie, which may not be the campaign where your product should belong to!

So, if you would like to create commissions under particular campaigns for specific products, you need to use the 'Product ID' parameter in a sale tracking code and define the particular product IDs in desired campaigns.

You should also check how Post Affiliate Pro recognizes a campaign in case you are using multiple campaigns: 

Requirements

To make tracking of product ID useful for the above scenarios, you would need to:
- track product IDs within a sale
- set product IDs under specific campaigns

 

How to track product IDs within a sale

Many of our integration methods support also the 'per product' integration (every product from an order creates a separate commission record in Post Affiliate Pro). With this type of integrations, product IDs are tracked automatically within a sale. 

However, if you are using a general sale tracking code, the idea is to add a product ID parameter in the JavaScript sale tracking script like this:

<script id="pap_x2s6df8d" src="http://URL.postaffiliatepro.com/scripts/trackjs.js" type="text/javascript">
</script>
<script type="text/javascript">
PostAffTracker.setAccountId('default1');

var sale = PostAffTracker.createSale();
sale.setTotalCost('50.50');
sale.setOrderID('ORD_12345XYZ_1');
sale.setProductID('sport-bag');

var sale2 = PostAffTracker.createSale();
sale2.setTotalCost('35.40');
sale2.setOrderID('ORD_12345XYZ_2');
sale2.setProductID('sport-socks');

var sale3 = PostAffTracker.createSale();
sale3.setTotalCost('67.30');
sale3.setOrderID('ORD_12345XYZ_3');
sale3.setProductID('sport-shirt');

PostAffTracker.register();
</script>


If you can't or don't want to use JavaScript tracking code, you can track product ID with a hidden image (pixel) tracking code this way:

<img src="https://URL.postaffiliatepro.com/scripts/sale.php?AccountId=default1&TotalCost=120.50&OrderID=ORD_12345XYZ&ProductID=PRODUCTX" width="1" height="1" >

With HTML pixel you would have to make sure that your integration triggers a pixel for every product within an order. 
Note: You shouldn't use 'Delete cookie after lead / sale' option in this case, as it would save commission only for the first product from an order! If you are using this option, then you can add 'DoNotDeleteCookies' URL parameter in the pixel.  


In the case of PHP sale tracking code, you need to use this in the script: 

$sale->setProductID('PRODUCTX');

All the above tracking codes would pass the product ID parameter with the exact value to Post Affiliate Pro. To send a real product ID from order into Post Affiliate Pro, you need to replace the exact values in the above code with variables that represent the product ID value in the system you are using to process sales. 

  • In the case of using a shopping cart, the creator of the shopping cart should be able to tell you by what variable you can obtain the unique IDs of your products. 
  • In the case of using PayPal buttons, the product ID goes to the 'item_number' field. If you are going to use a hosted PayPal button (saved at PayPal), then whatever you put into the "Item ID" field when configuring the button in your PayPal account, then it will be used as the value of 'item_number'  field in PayPal's notification (IPN). 

 

Set product IDs under a campaign

If you decided to provide different commissions for different products, or you just want to create a commission under a specific campaign based on the purchased product, you need to add desired product IDs into your campaigns.

You can do it by editing campaigns in your merchant panel > Campaigns > Campaign manager > edit some campaign and while you are on the "Edit details" tab, scroll down to the "Product ID matching" section.

You can define the Product ID or even multiple IDs (separated by comma) here:

Now, every time a sale with the given product ID is registered, the commission will be created under this campaign, provided that some other campaign matching logic won't override it.


Extended search mode

As you probably noticed in the above screenshot, there is an additional option called 'Extended search mode'. This option you can use to add similar product IDs in which only some part is different, so you don't have to insert all of them. You can use wildcard signs as it is explained on the screenshot. 

Example: you have 5 similar products and you want all of them to be tracked under the specific campaign 'A'. The IDs of these products would be: sport-bag, sport-shirt, sport-socks, sport-shorts. 

Now, instead of adding all of them into the campaign like this: sport-bag,sport-shirt,sport-socks,sport-shorts
you would add only one record and use a wildcard like this: sport-*

With such a setting, all products starting with 'sport-' will be saved in under campaign 'A', unless their specific ID is defined in a different campaign. So if 'sport-*' is set in campaign A and 'sport-bag' is set in campaign B, then purchase of sport-bag product would be tracked under campaign B.

 

It is not advised to use the same product ID in more campaigns

However, in some special cases with a more complicated campaign and commission setup, you might actually want to add the same product IDs into multiple campaigns despite it is not a good practice. In such a case, Post Affiliate Pro uses the following logic to choose a campaign:

When the same product is added in multiple campaigns, then Post Affiliate Pro first looks at all private campaigns where the product ID is set, then on all public with manual approval campaigns and only then on public campaigns. Within the same campaign type (private, manual approval, public) it selects the campaign in which the affiliate is approved/added. If an affiliate is approved/added in more private campaigns and/or public with manual approval campaigns, where the same product ID is defined, Post Affiliate Pro selects the campaign with the lowest system ID.

 

Save commissions ONLY for chosen products

Sometimes, you would like to provide commissions to your affiliates ONLY for referring the certain products. There is a setting with which Post Affiliate Pro will create a commission only for products specified in campaigns. The sale with product IDs not defined in any campaign will not be saved.

You still have to make the integration and campaign setup as it is described above, but in this case, you need to also enable "Stop tracking if a product is not found in any campaign" option under Configuration > Tracking settings > Tracking levels section. 


Do not stop, but save to default campaign

As you probably noticed, there is another option as an additional setting to the "Stop tracking if a product is not found in any campaign" option and together they can be very useful in specific campaign and commission setup.

Basically, if you still want to save sales without the product ID set in a campaign (despite you are using "Stop tracking if a product is not found in any campaign" option), you can enable this option: "Do not stop, but save to default campaign". In that case sales without product ID or with unknown product ID will be saved into the default campaign. Let's explain with some examples. 

Use case - different commission for some special products
- you would like to set 20% commission for 5 special products and for all the rest to set 10%.

Setup:
- you would use 2 campaigns. The first one would be set as default with a 10% commission setup. The second campaign would be created for those 5 special products with 20% commission.
- you would need to set IDs of those 5 special products under the second campaign which is NOT set as default. 
- you would enable "Do not stop, but save to default campaign" option. 

Explanation:
You need to enable this option because an affiliate could use a link/banner belonging to campaign with the 5 special products and a customer could purchase a different product! Without this option enabled, an affiliate would get a commission from the campaign of the special product despite a special product was not purchased by a customer. 


Use case - special 35% commission on 10 special products, 0% commission on 5 products, and 15% default commission for 2000 other products

Setup:
- you would use 3 campaigns. First one would be set as default with 15% commission setup. The second campaign would be created for those 10 special products with a 35% commission. The third campaign would be set as private (not visible to affiliates) with zero commission setup and no affiliates added in it.
- you would need to add IDs of those 10 special products under the second campaign.
- you would need to add IDs of those 5 NON-commission products under the third private campaign.
- you would enable "Do not stop, but save to default campaign" option. 

Explanation:
Let's say a customer clicks on affiliate link promoting a special product, but purchases a NON-commission product. In this case, no commission will be created, because product ID will be in the private campaign with zero commission setup and with no affiliate added in this campagin (it will be invisible for affiliates). 
If the customer would purchases any of those 2000 products instead (after clicking on affiliate link promoting a special product), then 15% commission would be created under a default campaign as you have enabled the "Do not stop, but save to default campaign" option.