How can we help?

Using Product ID to select campaign

One of the most useful data fields in sales tracking is the product ID. Within SustainAffiliate, 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

Example

Whenever a visitor clicks on an affiliate banner or link, the referral information is stored in a cookie. This information includes the campaign to which the banner/link belongs. When the sale is accomplished, SustainAffiliate generates a commission according to the campaign that was stored in the cookie, which may not be the campaign to which 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 SustainAffiliate recognises 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 SustainAffiliate). With this type of integration, 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="https://Network.SustainAffiliate.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. 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 the 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 SustainAffiliate. To send a real product ID from an order into SustainAffiliate, 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 decide 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 Brand Owner panel | Campaigns | Campaign manager | edit a 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:

Product ID Matching

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. With 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 in the screenshot.

Example

You have five 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 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 the purchase of sport-bag products 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, SustainAffiliate uses the following logic to choose a campaign:

When the same product is added in multiple campaigns, then SustainAffiliate first looks at all public with manual approval campaigns and then at public campaigns. Within the same campaign type, it selects the campaign in which the Content Creator is approved/added. If a Content Creator is approved/added in public with manual approval campaigns, where the same product ID is defined, SustainAffiliate selects the campaign with the lowest system ID.

Save commissions ONLY for chosen products

Sometimes, you would like to provide commissions to specific Content Creators ONLY for referring certain products. There is a setting with which SustainAffiliate 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 the Configuration |  Tracking settings | Tracking levels section.

Tracking Levels

Do not stop, but save to the 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 setups.

Basically, if you still want to save sales without the product ID set in a campaign (despite you are using the “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 one

For different commissions for some special products, such as setting up 20% commission for 5 special products and for all the rest to set 10%. The setup would be:

  • you would use two 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 a Content Creator could use a link/banner belonging to the campaign with the five special products and a customer could purchase a different product! Without this option enabled, a Content Creator would get a commission from the campaign of the special product despite a special product was not purchased by a customer.

Table of Contents