Magento with GetClicky & Analytics : Campaign Revenue Tracking

Written by Gordon

Topics: Magento

With Analytics, GetClicky and other tracking tools, you can setup campaigns and the revenue associated with it. To track the revenue of all orders in Magento, you will have to include a bit of Javascript code on the checkout success page.

Edit the checkout/success.phtml file inside your template folder.

$order = Mage::getModel(‘sales/order’)->load(Mage::getSingleton(‘checkout/session’)->getLastOrderId());
// After this you can get various data from the order
// $subTotal = $order->getSubtotal();
// $order->getId(); //the id of the order
// $order->getIncrementId(); //the increment id of the order
$grandTotal = number_format($order->getGrandTotal(), 2); //grand total of the order

In case of GetClicky, the campaign revenue code will look as follows.

<script type="text/javascript">
var clicky_goal = { id: "112", revenue: "<?php echo $grandTotal; ?>" };

Leave a Comment Here's Your Chance to Be Heard!