Welcome to the Kelkoo Group Customer Service

Magento integration of Kelkoo Sales Tracking

Step 1: identify your template

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.


Step 2: open the file of your thank you page

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).


Step 3: find the order details

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()


Step 4: insert the code

Right after the code added above we can add the Kelkoogroup script.

Kelkoogroup script

<script type="text/javascript">
    var _kkstrack = {
      merchantInfo: [{ country:"COUNTRY", merchantId:"COM_ID" }],
      orderValue: '<?=$_totalData['grand_total'] ?>',
      orderId: '<?=$this->getOrderId() ?>',
      basket: [{ productname: 'PRODUCT1_NAME',
                 productid: 'PRODUCT1_ID',
                 quantity: 'PRODUCT1_QUANTITY',
                 price: 'PRODUCT1_PRICE'
                },
                { productname: 'PRODUCT2_NAME',
                 productid: 'PRODUCT2_ID',
                 quantity: 'PRODUCT2_QUANTITY',
                 price: 'PRODUCT2_PRICE'
                }
               ]

    };
    (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.

    • GREEN VALUES are fixed (static) values to pass along in the tag;
      • COM_ID: This is the unique ID representing your shop within the Kelkoo system. Note that you can log into your Merchant Extranet account and directly use the JS tag generator that will automatically update the code with your COMID. You then just need to copy-paste the code generated and update the other values below.
      • COUNTRY  is the 2-letter country code for the country on which your products are listed on Kelkoo: : ‘at’ for Austria, ‘be’ for Belgium, ‘br’ for Brazil, ‘ch’ for Switzerland, ‘cz’ for Czech Republic, ‘de’ for Germany, ‘dk’ for Denmark, ‘es’ for Spain, ‘fi’ for Finland, ‘fr’ for France, ‘ie’ for Ireland, ‘it’ for Italy, ‘mx’ for Mexico, ‘nb’ for Flemish Belgium, ‘nl’ for Netherlands, ‘no’ for Norway, ‘pl’ for Poland, ‘pt’ for Portugal, ‘ru’ for Russia, ‘se’ for Sweden, ‘uk’ for United Kingdom, ‘us’ for United States.