Magento

An open-source ecommerce software and platform trusted by the world’s leading brands.

1. Edit the template

Navigate to your directory

yourfolder/app/design/frontend/base/default/template/checkout/success.phtml

for editing.

2.Code

The sale tracking code to track one commission per order is this:

<script src="https://yourname.affberry.com/sales/sale.js" type="text/javascript"></script> 
<script type="text/javascript">
var accountid ='5';
var campaignid='7';
var pluginc='3';
var trackurl = 'https://yourname.affberry.com/';
var currencycode='<?php echo $currentcurrency; ?>';
<?php
foreach ($allitems as $item) 
{
echo "var cost="."'".$item['price']."';";
echo "var orderid="."'".$item['order_id']."';";
echo "var productid="."'".$item['product_id']."';";
}
?>
register(accountid,campaignid,cost,orderid,productid,currencycode,pluginc,trackurl);
</script>

And now just save it and you are ready to track the sales now.