Click tracking request data description

Post Affiliate Pro tracking is based on requests between client (banner destination web page, 'thank you page') and server. 
If it is the first request, browser visitor cookie is not loaded, the server generates a new cookie value and sends it to the client as a response. JavaScript on Client will store the received cookie value to browser and HTML5 local storage cookie.
If browser visitor cookie is loaded and inserted into request parameter 'visitorId', then response is empty and click/sale is saved under affiliate recognized from cookie.

Click tracking request

 
This request is sent from click tracker to Post Affiliate Pro server:
https://my_pap_url/scripts/track.php?visitorId=&accountId=&url=H_my_pap_url%2Ftests%2Fapi%2Fclick.php&referrer=&tracking=1&getParams=%3Fa_aid%3Dtestaff%26a_bid%3D11110001%26chan%3Dcode2&ip=127.0.0.1&useragent=Mozilla%2F5.0+%28Windows+NT+6.1%3B+WOW64%3B+rv%3A10.0%29+Gecko%2F20100101+Firefox%2F10.0 
Request url is your PAP/PAN url to file track.php in the 'scripts' directorys : https://my_pap_url/scripts/track.php
 

Url parameters:

 
visitorId: loaded from browser cookie (let it empty if doesn't exist in browser cookie - common for first click): for value in php use: @$_COOKIE['PAPVisitorId'];
 
- accountId: for Post Affiliate Pro you can let it empty or set value 'default1', for Post Affiliate Network you need to set there the accountid of a particular PAN merchant account 
 
- url: URL to script file  where the script is running. We are filling it as: my script is on url: https://my_url/tests/api/click.php, 'https://' is replaced with 'H_' and 'https://' is replaced with 'S_',  
In php we get from $_SERVER['HTTPS'] if protocol is http or https, server name is from $_SERVER["SERVER_NAME"], and script name from $_SERVER['PATH_INFO'] or $_SERVER['SCRIPT_NAME'] 
 
referrer: loaded from $_SERVER['HTTP_REFERER'], 'http://' is replaced with 'H_' and 'https://' is replaced with 'S_' (same as url) 
 
tracking: in click tracking contains value: 1
 
- getParams: contains all get params from url, for example: url used to visit this page by visitor is: https://my_url/tests/api/me/click.php?a.aid=testaff&a_bid=11110001 so getParams will contain a_aid=testaff&a_bid=11110001 (in php loaded from $_GET), every one param value is encoded with urlencode($value) 
 
- ip: visitor IP, in php loaded from $_SERVER['REMOTE_ADDR'] or $_SERVER['HTTP_X_FORWARDED_FOR'] 
 
useragent: loaded from $_SERVER['HTTP_USER_AGENT'] 
 

Response

 
Response after executing this request will contain the generated cookie (only for first click if  cookie value of parameter visitorId  is empty), response with cookie looks like this: 
setVisitor('b57b0406c5b9febba85ce10J1xJqsL8Z');
(for next visits/requests from the same visitor it will be empty) 
if response is not empty and you need to create a browser/HTML5 local storage cookie for this visitor, then along the php api tracking there is a javascript code added and it is executed by the browser: 
 
echo '<script id="pap_x2s6df8d" src="https://my_pap_url/scripts/trackjs.js" type="text/javascript"></script>'; 
echo '<script type="text/javascript">setVisitor('b57b0406c5b9febba85ce10J1xJqsL8Z');</script>'; 
javascript function setVisitor() from file trackjs.js will create browser cookie  and HTML5 local storage cookie with name PAPVisitorId and with corresponding cookie value (in this case: b57b0406c5b9febba85ce10J1xJqsL8Z).
 
×