Available tracking parameters

Sale / lead tracking parameters

in your sale tracking code you can use various parameters that wil pass additional data about the transaction.

All possible tracking parameters
 
<script id="pap_x2s6df8d" src="https://www.yoursite.com/affiliate/scripts/salejs.php" type="text/javascript">
</script>
<script type="text/javascript">
var sale = PostAffTracker.createSale();
sale.setTotalCost('120.50');
sale.setFixedCost('20.50');
sale.setOrderID('ORD_12345XYZ');
sale.setProductID('test product');
sale.setAffiliateID('testaff');
sale.setCampaignID('11111111');
sale.setChannelID('chan');
sale.setCoupon('CouponCode');
sale.setCustomCommission('10.23');
sale.setCustomCommissionNextTiersFromCampaign('Y');
sale.changeCommissionBy('%10');
sale.setCurrency('EUR');
sale.setStatus('A');
sale.setData1('something');
sale.setData2('something');
sale.setData3('something');
sale.setData4('something');
sale.setData5('something');
sale.doNotDeleteCookies();

PostAffTracker.setCookieValue('{"c":"11111111","a":"testaff","ch":null}'); // In PAP 4.2.x and lower
PostAffTracker.setVisitorId('b2d774ac95d0db7ce446452b00HPgDcN'); // In PAP 4.4.x and higher

PostAffTracker.writeCookieToCustomField('fullCookieInfoId');
PostAffTracker.writeAffiliateToCustomField('affCookieInfoId');
PostAffTracker.writeCampaignToCustomField('campaignCookieInfoId');
PostAffTracker.writeCookieToLink('affCookieLinkId', 'papCookie');
PostAffTracker.writeAffiliateToLink('affLinkId', 'a_aid');

PostAffTracker.register();
</script>


Sale / lead parameters

setTotalCost() total cost of the order. It is required for percentage commissions campaigns, otherwise optional
setOrderID() ID of the order. Can be used for recognizing duplicate transactions
setProductID() ID of the product
setAffiliateID() ID or referral ID of the affiliate. With this parameter you can force to register commission to this affiliate
setCampaignID() ID of the campaign. With this parameter you can force to register commission using this campaign
setCustomCommission() value of custom commissions. You can force to use this commissions value instead of commissions set in campaign. If you put % in front of the number, the commission will be computed as percentage, for tiers separator use ';' e.g.: 10;5;3;1
setCustomCommissionNextTiersFromCampaign('Y') use this if you want to generate other default tiers by campaign settings, without this is generated only custom commission tiers
changeCommissionBy() value by which the calculated commission will be increased or decreased. Can be used if for example your campaign is set up with a fixed commission which you wish to decrease when a coupon is used. You can use values like %-50, %50, -5, 5 to increase/decrease the commission and you can use semicolon ';' as separator for changing multiple tiers. For example %-50;%-20 would decrease the 1st tier commission by 50% and 2nd tier commission by 20%
setStatus() force to set this status for this commission. You can use these states: 'A' - approved, 'P' - pending, 'D' - declined
setChannelID() ID or code of the channel. With this parameter you can force to register commission with this channel
setData1() set custom data for this transaction. You have up to five fields.
setData2() set additional custom data for this transaction
setData3() set additional custom data for this transaction
setData4() set additional custom data for this transaction
setData5() set additional custom data for this transaction
setCoupon() set coupon code for the Coupons feature. Since version 5.9.8.8 this attribute accepts a comma separated list of coupons. The first one existing in the software will be used.
doNotDeleteCookies() do not delete cookies after sale although 'Delete cookie after lead / sale' is enabled, this is useful for separate tracking per product

Global tracker parameters

PostAffTracker.setCookieValue() custom cookie value. With this parameter you can force to register commission with this cookie value.
            The cookie value saves affiliate ID and campaign ID. It is in format AFFILIATEID_CAMPAIGNID, for example e2r48sv3_d3425s9f.
PostAffTracker.setVisitorId() custom cookie value. This needs to be a valid visitor id. This is used in case the click tracking code is on different domain then the sale tracking code, or if you want to process sales later by batch. This is used in version 4.4.0.1 and higher.

Helper tracker functions

PostAffTracker.writeCookieToCustomField() this function writes the value of the cookie into input field with the specified ID
PostAffTracker.writeAffiliateToCustomField() this function writes the affiliate ID value from the cookie into input field with the specified ID
PostAffTracker.register() this function will call the affiliate system and saves the commission. This function MUST BE CALLED if you want to save the             commissions.

Examples of use

Saving commission with no additional parameters passed

It will save commission with no other parameters. Makes sense only for fixed (not percentage) commissions.

<script id="pap_x2s6df8d" src="https://www.yoursite.com/affiliate/scripts/salejs.php" type="text/javascript">
</script>
<script type="text/javascript">
var sale = PostAffTracker.createSale();
PostAffTracker.register();
</script>



Saving multiple commissions with one call

You can use this code if you want to save commissions separately for different items in your shopping cart.

<script id="pap_x2s6df8d" src="https://www.yoursite.com/affiliate/scripts/salejs.php" type="text/javascript">
</script>
<script type="text/javascript">
var sale = PostAffTracker.createSale();
sale.setTotalCost('50.50');
sale.setOrderID('ORD_12345XYZ(1)');
sale.setProductID('Product1');

var sale2 = PostAffTracker.createSale();
sale2.setTotalCost('35.40');
sale2.setOrderID('ORD_12345XYZ(2)');
sale2.setProductID('Product2');

var sale3 = PostAffTracker.createSale();
sale3.setTotalCost('67.30');
sale3.setOrderID('ORD_12345XYZ(3)');
sale3.setProductID('Product3');

PostAffTracker.register();
</script>



Saving commission to a specific affiliate

It will this save commission to affiliate with ID or Referrer ID = testaff, doesn't matter who really referred the sale / lead.

<script id="pap_x2s6df8d" src="https://www.yoursite.com/affiliate/scripts/salejs.php" type="text/javascript">
</script>
<script type="text/javascript">
var sale = PostAffTracker.createSale();
sale.setTotalCost('120.50');
sale.setOrderID('ORD_12345XYZ');
sale.setProductID('test product');
sale.setAffiliateID('testaff');
PostAffTracker.register();
</script>
×