Action Commissions

The Action Commissions feature allows you to define different CPA (cost per action) commissions. So, for example, a lead can be tracked as a 'lead' and not a 'sale' type of commission.
This way you can define a specific commission for user registrations, downloads, visiting specific pages, etc. 

You can create an unlimited number of action commissions in each campaign, which gives you the ability to track virtually every visitor's move as long as you can integrate the pages (in which the particular action is successfully accomplished) with a small JavaScript snippet or hidden image (pixel).

Activating the feature

First, you need to activate the feature from your merchant panel > Configuration > Features.
Click on the 'Activate' button next to the Action Commissions feature.
Once the feature is activated, you need to reload the merchant panel and then you will be able to create new per action commission types in your campaigns.

Creating and setting up a new action commission

Once the feature is activated, go to the Campaign Manager and edit any campaign in which you would like to create an action commission.
Go to the Commissions settings tab and you'll see a new 'Add per action commission' button.

Clicking on this button a new window will open up where you can define your new Action Commission. You need to define a couple of things:
Code - of action commission should be a string without spaces and special characters that will be used in the tracking script to specify that this action should be used. The code has to be unique within one campaign, so you cannot have actions with the same code in one campaign, but you can have the same code in two different campaigns.

Action name - should be a normal readable name of the action which you and your affiliates will see on the tracked commissions and reports. 

Approval - this only defines if a tracked commission should be created as 'approved' or 'pending' (in the case of manual approval, you would have to approve it manually).

Save transaction also for zero orders (Total Cost = 0) - this option allows you to create commission records even if the total cost is zero. In most cases, this option should be enabled. For example, you want to enable this if your action doesn't have any cost in it and you won't be setting the Total cost value in the tracking code. This could be free trial signup, download, etc.

Save transaction with zero commission - this option allows you to create commission records even if the commission is zero. For example, you can use this in a case where you would like to track downloads signups, etc., but you don't want to give a commission to affiliates for that. 

Use fixed cost - a value which is used to subtract something (taxes, shipping, special costs) from the total cost. More info here.

Commissions - for the new action, you have to define also the Commissions value and type (fixed or percentage) and possible multi-tier commissions. If you don't want to provide a commission for your action, you should set the zero value and enable 'Save transaction with zero commission' option.


Note! After creation, the new commission type is enabled automatically in the commission settings tab.


Tracking action commissions

- How to get an action tracking code

You can generate an action tracking code directly from your merchant panel > Tools > Integration > Sales/Leads Tracking.
There is a button called 'Show advanced tracking options'. You need to click on it to display additional options. 
The very first field is the 'Action code' field in which you can choose the action you have created.
If you want, you can also set more tracking parameters. All available tracking parameters which you set here will be added to the final action tracking code.
Once you choose the action and/or define all other tracking parameters you would like to have in the final tracking script, just scroll down to copy the code which is already generated. 

There are two optional features which you can enable:
- Hash script file names (hashed scripts are hard to be blocked by AdBlock), mod_rewrite rules are used, defined in .htaccess file. - this option uses hashed variant of tracking script.
The default script: https://URL_TO_PostAffiliatePro/scripts/trackjs.js
The hashed version: https://URL_TO_PostAffiliatePro/scripts/yoqy2j
More information you can find in this article.
- Use secure connection - if checked, the URL to your PAP account will use secure HTTPS protocol instead of HTTP. 

- Action tracking code explanation

Now that the new per action commission is created and set up, we can set up the tracking of the new action. To do that, we have to insert the JavaScript tracking code to the page that should trigger the action (a page displayed after successful action). In our case ('Trial signup' example) it should be a page that is displayed after the user registers.

This is the example of standard sale tracking code, so this is NOT the code you should use:
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/salejs.php" type="text/javascript">
<script type="text/javascript">
var sale = PostAffTracker.createSale();

To track action commissions, we have to use the createAction('actionCode') function instead of createSale() function and use the actionCode which we defined for our new action commission when configuring it in the merchant panel (trialsignup in our example).

So the complete script for tracking our trial signup action would be this:

<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/salejs.php" type="text/javascript"> </script>
<script type="text/javascript">
var action = PostAffTracker.createAction('trialsignup')action.setOrderID('ORD_12345XYZ');

If from whatever reason you cannot use the JavaScript tracking code on your website, you can use the action code in the 'Pixel tracking (HTML image)' integration code:
<img src="https://URL_TO_PostAffiliatePro/scripts/sale.php?AccountId=default1&ActionCode=trialsignup&OrderID=ORD_12345XYZ" width="1" height="1" >

Now whenever the page with such JavaScript code is displayed, it will create a new trial signup commission for the referring affiliate.

NOTE: The OrderID is not essential in the case of an action commission. So, you can remove the "action.setOrderID('ORD_12345XYZ');" from the code. However, we strongly recommend setting some unique identifier as order ID and not keeping an example one there 'ORD_12345XYZ'. It can help you filter commissions in PAP, you could actually cross-reference between commissions in PAP and whatever external system you would use, or help you with debugging if there is some tracking problem. 
NOTE 2: If you use 'plus' sign '+' in action code, it has to be replaced with '%2B' string. This applies only in Hidden Image tracking!