Affiliate login| Merchant login

Sale / lead / action tracking parameters

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

Back to Samples & tests home

All possible tracking parameters

<script id="pap_x2s6df8d" src="https://chatnik.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.setBannerID('11110001');
sale.setCampaignID('11111111');
sale.setChannelID('chan');
sale.setCoupon('CouponCode');
sale.setCustomCommission('10.23');
sale.setCurrency('EUR');
sale.setStatus('A');
sale.setData1('something');
sale.setData2('something');
sale.setData3('something');
sale.setData4('something');
sale.setData5('something');

PostAffTracker.setVisitorId('ae5f51c3145771c87a0fe467000FvW6e');

PostAffTracker.writeCookieToCustomField('id_field');
PostAffTracker.writeAffiliateToCustomField('id_field');
PostAffTracker.writeCookieToLink('id_field', 'papCookie');
PostAffTracker.writeAffiliateToLink('id_field', 'a_aid');

PostAffTracker.register();
</script>
	
Sale / lead / action parameters
setTotalCost()  total cost of the order. It is required for percentage commissions campaigns, otherwise optional
setFixedCost()  fixed cost of the order. Fixed cost is substracted from totalcost before commission is computed. If you put % in front of the number, the fixed cost will be computed as percentage
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
setBannerID()  ID of the banner. With this parameter you can force to register commission using this banner, also is applied campaign to which banner belongs.
setCampaignID()  ID of the campaign. With this parameter you can force to register commission using this campaign
setChannelID()  ID of the channel. With this parameter you can force to register commission for this channel
setCoupon()  Coupon code. If set, affiliate is recognized from coupon code
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
setCurrency()  currency code. You can force to use this currency instead of default currency. (you need to have Multiple currencies feature enabled)
setStatus()  force to set this status for this commission. You can use these states:
  • 'A' - approved
  • 'P' - pending
  • 'D' - declined
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
Global tracker parameters
PostAffTracker.setVisitorId()  custom cookie value. With this parameter you can force to register commission with this cookie value.
The cookie value stands for visitor ID which is stored in PAP4 database representing the relation between visitor and the referring affiliate.
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.writeCookieToLink()   this function appends the value of the cookie into the specified link
PostAffTracker.writeAffiliateToLink()   this function appends the affiliate ID value into the specified link
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. Also, you have to enable "saving commission for zero total cost".

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

It will save per action commission with code 'signup'.

<script id="pap_x2s6df8d" src="https://chatnik.com/affiliate/scripts/salejs.php" type="text/javascript">
</script>
<script type="text/javascript">
var signup = PostAffTracker.createAction('signup');
signup.setOrderID('ORD_12345XYZ');
signup.setProductID('Product1');
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://chatnik.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');
sale.setProductID('Product1');

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

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

PostAffTracker.register();
</script>
Saving commission to a specific affiliate

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

<script id="pap_x2s6df8d" src="https://chatnik.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>
Displaying value of the cookie and affiliate

You can use this functionality to get the ID of affiliate who referred your customer, and then use it in your own script. Note that this is callback function, and getting the value is delayed 1 second. It is because the JavaScript code has to get the cookie also from the Flash object.

<script id="pap_x2s6df8d" src="https://chatnik.com/affiliate/scripts/salejs.php" type="text/javascript">
</script>
<script type="text/javascript">
PostAffTracker.writeCookieToCustomField('id_field');
PostAffTracker.writeAffiliateToCustomField('id_field');
PostAffTracker.writeCookieToLink('id_field', 'papCookie');
PostAffTracker.writeAffiliateToLink('id_field', 'a_aid');
</script>
Full cookie:
Affiliate ID:
Link with added cookie info: see destination url of this link
Link with added affiliate id: see destination url of this link