1ShoppingCart integration
Build a powerful, secure eCommerce storefront with online store software.
Integration with 1ShoppingCart is made by placing a sale tracking script into the thank you page.
1. Edit your thank you page
In case you are using the built-in thank you page, please continue to step 5.
1ShoppingCart allows you to have your own custom thank you page. To set it up, navigate to Setup > Orders and set the “Thank You URL” field to the full URL address leading to your custom URL page.
E.g.:
http://www.domain.com/thankyou/ will not work
http://www.domain.com/thankyou/index.php does work
2. Sale tracking
Put the following code (in case that your page is in PHP) right before the row with text </body> (or somewhere at the end of page body).
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">
PostAffTracker.setAccountId('Account_ID');var sale = PostAffTracker.createSale();
sale.setTotalCost('<?php echo $_POST['Total']; ?>');
sale.setOrderID('<?php echo $_POST['orderID']; ?>');
PostAffTracker.register();
</script>
3. Per product tracking
Put the following code (in case that your thank you page is in PHP) right before line with text </body>
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">
PostAffTracker.setAccountId('Account_ID');
<?php
$i = 0;
foreach($_POST as $key=>$value){
if(preg_match('/product(\d+)/',$key)){
$i++;
}
}
for($j = 1; $j<= $i; $j++){
echo "var sale" . $j . " = PostAffTracker.createSale();\n";
echo "sale" . $j . ".setTotalCost('" . ($_POST['price'.$j] * $_POST['quantity'.$j]) . "');\n";
echo "sale" . $j . ".setOrderID('" . addslashes($_POST['orderID']) . "(" . $j . ")');\n";
echo "sale" . $j . ".setProductID('" . addslashes($_POST['product'.$j]) ."');\n";
}
?>
PostAffTracker.register();
</script>
If you want to track product ID as SKU numbers, you can call it as $_POST[‘sku’.$j]
If you want to track customer email (for lifetime commissions) you can use $_POST[’email1′]
4. Recurring commissions tracking
Using 1ShoppingCart notifications it is possible to track recurring commissions as well. To do so, you have to activate the 1ShoppingCart plugin in your Post Affiliate Pro and then set this URL in your 1ShoppingCart admin panel:
https://URL_TO_PostAffiliatePro/plugins/OneShoppingCart/oneshoppingcart.php
Do not forget to configure the plugin based on your 1ShoppingCart API details.
5. Integration of built in Thank you page
In case you use the built-in Thank You page, you have to use Third-Party Integrations section (Setup> Third-Party Integrations) which allows you to insert a custom code to the Thank You page. Just copy the following code and use it in HTML Body Section Bottom:
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">
var papOrderObject = SecureCartOrders[0];
PostAffTracker.setAccountId('Account_ID');var sale = PostAffTracker.createSale();
sale.setTotalCost(papOrderObject.Total);
sale.setOrderID(papOrderObject.orderID);
PostAffTracker.register();
</script>
Save your work and you are done.
It is now integrated. Every time customer enters the order confirmation page, the tracking code is called, and it will register a sale for referring affiliate.
Do not forget to integrate your site with the click tracking code.