Affiliate Sale Tracking Codes

The Affiliate Sale Tracking Codes feature enables the affiliates to specify their postback URLs/pixels which should be called once they get a sale in your system. This is useful for affiliates who promote multiple different affiliate programs and they want all their commissions from all the affiliate programs tracked in one place (their own tracking platform) or for affiliates who would want to run their own affiliate program to promote your offers/products.

This feature is available only in the Ultimate and Network edition. Users of lower editions would need to upgrade.

You can activate this feature in your merchant panel Configuration -> Features -> Affiliate Sale Tracking Codes. Once the feature is activated the affiliates can specify their postback URLs/tracking codes in Promotion -> Campaigns -> Action 'Edit Tracking codes' (the pencil icon). There are 3 options the affiliates can choose from:

  • Call URL from server - once a commission for the affiliate under the specific campaign and of the particular commission type is saved or approved the affiliate's URL will be called by PAP server.
  • Execute Javascript in client's browser - once a commission is created affiliate's javascript code will be executed on the thank you page. You need to enter only pure javascript, without any HTML tags.
  • Show HTML in client's browser - once a commission is created affiliate's HTML code will be added to the thank you page in an iframe.

The last 2 options work only in self-hosted/downloadable versions, hosted with us/monthly customers can use only the Call URL from server option which should however be enough for most of the affiliates. Also the first 2 options require that your website is integrated with the javascript version of the sale tracking code and not via HTML pixel.

Each tracking code has to be approved by the merchant (Affiliates -> Affiliate tracking codes) before it is used. After a referred sale the approved code is executed in the thank you page or the callback URL is called by Post Affiliate Pro server.

Warning: Affiliate tracking codes may damage your thank you page. Approve them only after good consideration.
Note: For customers using a hosted (SaaS) solution of Post Affiliate Pro or Post Affiliate Network on only the "Call URL from server" option is available.
Note 2: For version and older, this feature can be used only with the JavaScript version of sale tracking code
It also disables offline transaction processing (cron job processing of visits), so all sales/leads (and clicks connected with these sales/leads) will be tracked online (immediately, not postponed) which may slow down your site performance in case you have a heavy-traffic site. 
Note 3: The "Execute JavaScript in client's browser" and "Show HTML in client's browser" options require the JavaScript version of Sale Tracking code to be used in the thank you page
If you have the Split Commissions feature active, the 'Affiliate Sale Tracking Code' will be executed for all affiliates who got a commission from the sale.


Available variables in the Affiliate Sale Tracking Codes:

{$visitorid} - Visitor ID
{$transactionid} - Transaction ID
{$userid} - User ID
{$refid} - Referral ID
{$commission} - Commission
{$totalcost} - Total cost
{$fixedcost} - Fixed cost
{$orderid} - Order ID
{$productid} - Product ID
{$tier} - Tier
{$campaignid} - Campaign ID
{$campaignname} - Campaign name
{$status} - Status
{$statuscode} - Status
{$type} - Type
{$rawtype} - RawType
{$actionName} - Action name
{$actionCode} - Action code
{$refererurl} - Referer URL
{$ip} - IP
{$countrycode} - Country code
{$firstclicktime} - First click - time
{$firstclickreferer} - First click - referer
{$firstclickip} - First click - IP
{$firstclickdata1} - First click - data1
{$firstclickdata2} - First click - data2
{$lastclicktime} - Last click - time
{$lastclickreferer} - Last click - referer
{$lastclickip} - Last click - IP
{$lastclickdata1} - Last click - data1
{$lastclickdata2} - Last click - data2
{$saledata1} - Transaction data1
{$saledata2} - Transaction data2
{$saledata3} - Transaction data3
{$saledata4} - Transaction data4
{$saledata5} - Transaction data5
{$merchantnote} - Note to affiliate
{$systemnote} - Note to merchant
{$channel} - Channel name
{$channel_code} - Channel code
{$originalcurrency} - Original currency
{$originalcurrencyvalue} - Original currency value
{$originalcurrencyrate} - Original currency rate


Most common questions/problems

1. How to access sub IDs?

The affiliates usually want to access their Sub IDs which they specified in their affiliate links but they don't know what variable to use. Essentially you as the merchant must check whether you have "Overwrite cookies" option enabled in Configuration -> Cookies or not. If you do have it enabled then the affiliates should use {$lastclickdata1} and {$lastclickdata2}, if you have this option disabled then your affiliates should use {$firstclickdata1} and {$firstclickdata2}.