But what if your landing page is not at the same domain as the "thank you page" containing the sales tracking code? You can transfer the affiliate information.
NOTE: In case you do not use Standard Link (redirect) linking method and on the other domain (where the purchase happens) there is no click tracking code, then you do not need to follow the instructions below, since Flash cookies (set by Post Affiliate Pro click tracking code) are cross-domain cookies.
The code for the transfer is below. The main idea is to append the affiliates ID and campaign ID within the cookies to the link. It is a JavaScript code used in those HTML pages which contain the redirect links (links which redirect from the 'landing page' domain to the 'thank you page' domain). You can also use API for smoother usage, but it can be used only in PHP. So here is the code for HTML:
JavaScript code:
<script id="pap_x2s6df8d" src="path_to_PAP/scripts/salejs.php" 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 PostAffTracker.writeAffiliateToLink('affLinkId', 'a_aid'); </script>
Note that your links where you want to append the cookies, have to contain id="affLinkId" (it is identification from the script above - you can change both) so the link will look like this:
<a href="https://www.wheretomigrate.com/site.html" id="affLinkId">Click here</a>
<?php require_once 'PapApi.class.php'; // init session for PAP $session = new Pap_Api_Session("URL_TO_PAP/scripts/server.php"); // register click $clickTracker = new Pap_Api_ClickTracker($session); try { $clickTracker->track(); $clickTracker->SaveCookies(); } catch (Exception $e) { } if ($clickTracker->getAffiliate() != null) { $a_aid = $clickTracker->getAffiliate()->getValue('userid'); $affiliateRefId = $clickTracker->getAffiliate()->getValue('refid'); // optionally you can get affiliate refid too } if ($clickTracker->getCampaign() != null) { $a_cid = $clickTracker->getCampaign()->getValue('campaignid'); // get campaign id } ?>
Then you can use variables $a_aid and $a_cid to append it to link:
<a href="https://www.wheretomigrate.com/site.html<?php echo ("?a_aid=". $a_aid . "&". $a_cid); ?>">Click here</a>