Sale (action) tracking request data description

Sale/action tracking request

This request is sent from sale tracker to Post Affiliate Pro server:
The base of it is same as in a click request, since it contains the following  parameters (they are common in both click request and sale tracking request): visitorIdaccountIdurl,referrertrackingipuseragent.
The difference is that getParams is empty and the new sale parameter contains all the information about the created sale:

Sale data parameters:

ac: action code, if you want to register an action commission (so not a 'sale' type of action); for simple sale tracking keep it empty
- t: total cost
- f: fixed cost
- o: order id
- p: product id
- d1: extra data1
- d2: extra data2
- d3: extra data3
- d4: extra data4
- d5: extra data5
- a: affiliate id or referral id (if should be recognized from cookie, let it empty)
- c: campaign id  (if should be recognized from cookie, let it empty)
- b: banner id  (if should be recognized from cookie, let it empty)
ch: channel id
cc: custom commission
s: status, force to set this status, possible values 'A', 'P', 'D' for approved, pending, declined
cr: currency of sale
cp: coupon code
- dndc: do not delete cookies (used for per product tracking with option to delete cookie after sale)
Sale parameters are in JSON format and url encoded.


Response works the same way as for click tracking request, if cookie is empty the response returns a value to be saved in cookie, otherwise the response is empty (blank).


A simple example how to compose such a sale tracking request in php:

$saleData = array(array(

$accountId = '';
$visitorid = @$_COOKIE['PAPVisitorId'];

$referer = encodeUrlParam($_SERVER['HTTP_REFERER']);
$urlParam = encodeUrlParam('http://'.$_SERVER["SERVER_NAME"].$_SERVER['SCRIPT_NAME']);

$url ='http://your_postaffiliatepro_url/scripts/track.php?visitorId='.$visitorid. '&accountId='.$accountId.'&url='.$urlParam.'&referrer='.$referer.'&tracking=1&getParams=&ip='.$ip;

$encodedSaleData = 'sale=' . urlencode(json_encode($saleData));

$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $encodedSaleData);

$json_response = curl_exec($curl);

echo ($json_response);

function encodeUrlParam($url) {
	$url = str_replace('http://', 'H_', $url);
	$url = str_replace('https://', 'S_', $url);
	return $url;