Find and edit the right XML layout and add :
<reference name="head">
<block type="core/text" name="kelkoo.lead.tag">
<action method="setText">
<text>
<![CDATA[<script type="text/javascript" src="https://s.kk-resources.com/leadtag.js"></script>]]>
</text>
</action>
</block>
</reference>
Before to start it’s necessary identify which template you are using for Magento. To do that, open the root folder of your site by an FTP client and go into the folder web/app/design/frontend/
In this folder there are the templates installed. Usually are “base”, “default” and a third theme. The latter probably is yours.
For example, if your template is “custom”. You should go to the directory
web/app/design/frontend/custom/default/template/checkout/
Clearly instead of “custom” you should have the name of your template.
At this path you’ll find the file “success.phtml”, that’s the file the we were looking for. Open it with your text editor (no word/wordpad/openoffice).
The file success.phtml changes from template to template, but we can assume that we won’t generate issues adding our code to the bottom of the file. Paste the code below at the end of the file
<?php
$orderObj = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
$_totalData =$orderObj->getData();
?>
This code allows us to get the value of the two variables: the total order and the id of the order. Those variables should be used in our sales tracking code.
The variables are :
Total order : $_totalData[‘grand_total’]
Order ID : $this->getOrderId()
Right after the code added above we can add the Kelkoogroup script.
<script type="text/javascript"> _kkstrack = { merchantInfo: [{ country:"COUNTRY", merchantId:"COM_ID" }], orderValue: '<?=$_totalData['grand_total'] ?>', orderId: '<?=$this->getOrderId() ?>', basket: [] }; (function() { var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = 'https://s.kk-resources.com/ks.js'; var x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x); })(); </script>
As you can see, Kelkoo Sales Tracking requires a few details of the order.
If you want to add Kelkoogroup leadtag without creating a module, you can add the following code on your active theme.
// YourTheme/Magento_Theme/layout/default_head_blocks.xml <script src="https://s.kk-resources.com/leadtag.js" src_type="url"/>
app/code/Kelkoo/Modulekelkoost/
|- Block
| |- Success.php
|- etc
| |- di.xml
| |- module.xml
|- registration.php
|- view
| |- frontend
| | |- layout
| | | |- checkout_onepage_success.xml
| | |- templates
| | | |- checkout
| | | | |- success.phtml
php bin/magento module:enable Kelkoo_Modulekelkoost php bin/magento setup:upgrade --keep-generated