AffilBox implementation in Magento

Datum přidání10. 05. 2012
AutorKateřina Střelcová
AffilBox implementation in Magento

Today we have for you a tutorial on how to implement AffilBox into the popular opensource eshop system Magento.

Before deploying the codes, create a subdomain for your commission program.
This will give you both a tracking and conversion code in the shape of your domain, and you will have a higher order tracking success rate.

Implementation of tracking code

The tracking code tracks incoming visitors and stores a cookie to later identify and match them to the partner that brought them in.

The tracking code looks something like this:

[sourcecode language=”javascript”]
<script type=”text/javascript”
src=”http://demo.affilbox.cz/js/module/tracking.js”>
</script><script type=”text/javascript”>//
<![CDATA[
var affilate = ‘http://demo.affilbox.cz/’;
var advertiser = 1;
var campaign = 1;
tracking();
// ]]<</script>
/sourcecode]

The specific code for your campaign can be found in AffilBox in the left menu – Campaigns:

Expand your campaign and select Codes from the top menu:

Place this code in the header or footer template of your store.

Implementation of conversion code

In the same place you will find the conversion code in AffilBox, it takes care of recording the conversion and its value.

Place the following code in /app/design/frontend/default/template/checkout/success.phtml.

Place this line:

[sourcecode language=”php”]
<!–?php $lastOrderId = Mage::getSingleton(‘checkout/session’)—>
getLastOrderId();
$order = Mage::getSingleton(‘sales/order’); $order->load($lastOrderId);
$_totalData = $order->getData(); $_grand = $_totalData[‘subtotal’];
$_subtotal = number_format($_grand, 0); ?
/sourcecode]

And place this code underneath (modify according to your domain and campaign).

[sourcecode language=”php”]
<iframe src=”http://demo.affilbox.cz/konverze/aid/1/kid/1/cena/
<?php echo $_subtotal;?>/transactions/<?php echo $this->getOrderId()?>/”
height=”1″ width=”1″ frameborder=”0″ scrolling=”no”></iframe>
/sourcecode]

And that’s it!

If you need help with anything, feel free to contact us anytime and we’ll be happy to help and advise you.

Leave a comment

Your email address will not be published. Required information is marked with *