Magento Integration
David Rolenc avatar
Written by David Rolenc
Updated over a week ago

This Magento integration guide is created for websites built on Magento.

In order to successfully integrate tracking with Magento, you will need to set up your system by instructions in the Quick setup section in the system and then tracking for clicks and conversions by following the guide below.

  1. Add a click script to the Miscellaneous HTML box. This field is accessible in your Magento admin area in Configuration > General > Design > Footer

    <!-- Trackdesk tracker begin -->
    <script async src="//cdn.trackdesk.com/tracking.js"></script> <script>
    (function(t,d,k){(t[k]=t[k]||[]).push(d);t[d]=t[d]||t[k].f||function(){(t[d].q=t[d].q||[]).push(arguments)}})(window,"trackdesk","TrackdeskObject");

    trackdesk('YOUR TENANT ID', 'click');
    </script>
    <!-- Trackdesk tracker end -->

    Make sure to replace YOUR TENANT ID with your actual tenant id.
    โ€‹

  2. Navigate to the file after successful checkout. app\design\frontend\XXXX\XXXX\template\checkout\success.phtml
    โ€‹

  3. Next, you will paste the following code here in order to track conversions.

    <!-- Trackdesk tracker begin -->
    <?php
    $order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
    $amount = number_format($order->getGrandTotal() - $order->getShippingAmount() - $order->getShippingTaxAmount() ,2);
    ?>

    <script async src="//cdn.trackdesk.com/tracking.js"></script>
    <script>
    (function(t,d,k){(t[k]=t[k]||[]).push(d);t[d]=t[d]||t[k].f||function(){(t[d].q=t[d].q||[]).push(arguments)}})(window,"trackdesk","TrackdeskObject");

    trackdesk('YOUR TENANT ID', 'conversion', {
    conversionType: 'YOUR SELECTED CONVERSION TYPE',
    customParams: {
    advS1: '<?php echo $this->getOrderId() ?>',
    },
    amount: {
    value: '<?php echo $amount ?>'
    }
    });
    </script>
    <!-- Trackdesk tracker end -->

    Make sure to replace YOUR TENANT ID with your actual tenant id.

    Make sure to replace YOUR SELECTED CONVERSION TYPE with the conversion type you want to use for tracking.

Testing Your Integration

Please remember to test the creation of click and conversion before starting your program. This way you can verify that tracking has been set up correctly. You can create a test click and conversion by following the steps described here.

Did this answer your question?