Standard links (redirect)
Banner code (example)
<a href="https://affiliate.aforemedia.com/scripts/click.php?a_aid=testaff&a_bid=11110001"> <img src="https://affiliate.aforemedia.com/accounts/default1/banners/sample_image_banner.gif" alt="" title="" WIDTH="468" HEIGHT="60"></a> <img src='https://affiliate.aforemedia.com/scripts/imp.php?a_aid=testaff&a_bid=11110001' width='1' height='1' border='0'>
New style links (URL parameters)
Banner code (example)
<a href="http://www.targetsite.com/?a_aid=testaff&a_bid=11110001"> <img src="https://affiliate.aforemedia.com/accounts/default1/banners/sample_image_banner.gif" alt="" title="" WIDTH="468" HEIGHT="60"></a> <img src='https://affiliate.aforemedia.com/scripts/imp.php?a_aid=testaff&a_bid=11110001' width='1' height='1' border='0'>
SEO links (require mod_rewrite)
Banner code (example)
<a href="http://www.targetsite.com/reftestaff/11110001.html"> <img src="https://affiliate.aforemedia.com/accounts/default1/banners/sample_image_banner.gif" alt="" title="" WIDTH="468" HEIGHT="60"></a> <img src='https://affiliate.aforemedia.com/scripts/imp.php?a_aid=testaff&a_bid=11110001' width='1' height='1' border='0'>
DirectLink style (no URL parameters)
Banner code (example)
<a href="http://www.targetsite.com/"> <img src="https://affiliate.aforemedia.com/accounts/default1/banners/sample_image_banner.gif" alt="" title="" WIDTH="468" HEIGHT="60"></a> <img src='https://affiliate.aforemedia.com/scripts/imp.php?a_aid=testaff&a_bid=11110001' width='1' height='1' border='0'>
Referral (click) tracking
To track affiliate referrals, this page contains click tracking code.
You have to put this click tracking code into your homepage as well. The best practice is to put it somewhere into the page footer, so it is included in every page.
Tracking code used on this page:
<script id="pap_x2s6df8d" src="https://affiliate.aforemedia.com/scripts/trackjs.js" type="text/javascript"> </script> <script type="text/javascript"> papTrack(); </script>
This is standard tracking code that you can use also on your pages.
Note that when you’ll insert it to your page, you’ll have to set the full path to the scripts directory, so it will look like this:
<script id="pap_x2s6df8d" src="https://affiliate.aforemedia.com/scripts/trackjs.js" type="text/javascript">
Advanced referral (click) tracking
In click tracking code you can use folloving additional variables. These variables are optional and they must be placed above papTrack(); or PostAffTracker.track(); (in newer versions)
var AffiliateID='affiliate id'; // click will be saved for affiliate specified by this parameter var BannerID='banner id'; // click will be saved for banner specified by this parameter var CampaignID='campaign id'; // click will be saved for campaign specified by this parameter var Channel='channel'; // channel var Data1='data1'; // extra data 1 var Data2='data2'; // extra data 2
Another example would be creating a channel for different places on your site.
PAP will track not only the user referral, but also through which channel he came. This way your affiliate will know which channel (banner placing) converts most.
The good thing about channels and Sub ID codes is that they are passed also to sales / leads. So your affiliate will know not only which referral (click) was made through which channel, but also which sales were made through the channel.
Note that the banner codes used in these sample pages are specially changed to work in the test conditions. You can see how this banner will look in the real situation in the banner code example.
Channel code example
Banner code (example)
<a href="http://www.targetsite.com/?a_aid=testaff&a_bid=11110001&chnl=testchnl"> <img src="https://affiliate.aforemedia.com/accounts/default1/banners/sample_image_banner.gif" alt="" title="" WIDTH="468" HEIGHT="60"></a> <img src='https://affiliate.aforemedia.com/scripts/imp.php?a_aid=testaff&a_bid=11110001' width='1' height='1' border='0'>
SubId tracking
Except channel variable you can use two more custom variables: data1, data2. They work exactly like channels, and can be used for additional tracking.
SubId data examples
Banner code (example)
<a href="http://www.targetsite.com/?a_aid=testaff&a_bid=11110001&data1=somedata&data2=even_more_data"> <img src="https://affiliate.aforemedia.com/accounts/default1/banners/sample_image_banner.gif" alt="" title="" WIDTH="468" HEIGHT="60"></a> <img src='https://affiliate.aforemedia.com/scripts/imp.php?a_aid=testaff&a_bid=11110001' width='1' height='1' border='0'>
Sales / leads tracking explained
To track leads and sales, you have to use sale tracking code. The exact integration depends on your shopping cart or payment gateway, so refer to our documentation for this.
General tracking method
General tracking method uses javascript that you should put to your order confirmation page.
The general tracking code is:
<script id="pap_x2s6df8d" src="https://affiliate.aforemedia.com/scripts/trackjs.js" type="text/javascript"> </script> <script type="text/javascript"> PostAffTracker.setAccountId('default1'); //use this line for PAN account, set here your account Id instead of default1 var sale = PostAffTracker.createSale(); sale.setTotalCost('120.50'); sale.setOrderID('ORD_12345XYZ'); sale.setProductID('test product'); PostAffTracker.register(); </script>
Hidden image example
If you don’t want to use JavaScript tracking code, you can use also hidden image (hidden pixel tracking) version.
Note that by using hidden the system cannot use functionality of Flash cookies, it will depend only on standard cookies and IP address.
The hidden image variant of the tracking code above is:
<img src="https://affiliate.aforemedia.com/scripts/sale.php?TotalCost=120.50&OrderID=ORD_12345XYZ&ProductID=test+product" width="1" height="1"">
Variables you can use in hidden image are:
TotalCost, OrderID, ProductID, data1, data2, data3, data4, data5, AffiliateID, CampaignID, ChannelID, Commission, PStatus and Currency
All possible tracking parameters
<script id="pap_x2s6df8d" src="https://affiliate.aforemedia.com/scripts/trackjs.js" type="text/javascript"> </script> <script type="text/javascript"> PostAffTracker.setAccountId('default1'); //use this line for PAN account, set here your account Id instead of default1 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.setCustomCommissionNextTiersFromCampaign('Y'); 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, 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 | |
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:
|
|
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.setAccountId(‘account_id’) | use this line for Post Affiliate Network, set here your account Id instead of ‘account_id’. Network owner can find it in Accounts > Account manager | |
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
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