rss
twitter
    Find out what I'm doing, Follow Me :)

Tuesday, May 18, 2010

Pin It

Widgets

How To Setup Conversion Tracking In Magento

3rd Party Conversion Tracking

Magento Commerce has the ability to track eCommerce sale with Google Analytics out of the box (more on that in a future post). Something that a lot of merchants struggle with is how to set up conversion tracking for other tracking software or comparison shopping engines.

How To

Here is an easy hack to track conversions for Shopzilla, PriceGrabber and the likes:

Open the file: app\design\frontend\XXXX\XXXX\template\checkout\success.phtml

At the end of the file, add the following code, this will create two variables with the order number and the order total:

1    <?php
2        //Get Order Number & Order Total
3        $order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
4        $amount = number_format($order->getGrandTotal(),2);
5    ?>

After the above code snippet, copy and paste the tracking code from the third party analytics software of comparison shopping engine. Insert the following variable where they suggest placing the order ID and the order total:

1    <?php echo $amount; ?> // Order Total
2    <?php echo $this->getOrderId() ?> // Order Number

Here is a code example for the Shopzilla conversion tracking tool:

1    <script language="javascript">
2        var mid            = 'XXXXX'; // Your Shopzilla Merchant ID
3        var cust_type      = '';
4        var order_value    = '<?php echo $amount; ?>'; // Order Amount
5        var order_id       = '<?php echo $this->getOrderId() ?>'; //Order Number
6        var units_ordered  = '';
7    </script>
8    <script language="javascript" src="https://www.shopzilla.com/css/roi_tracker.js"></script>
9    <script language="JavaScript" src="https://eval.bizrate.com/js/pos_193511.js" type="text/javascript"></script>

2 comments:

  1. This works perfectly! Thanks.

    ReplyDelete
  2. Great post however , I was wondering if you could write a litte more on this topic?
    Appreciate it!

    ReplyDelete