Warning: Use of undefined constant wp_cumulus_widget - assumed 'wp_cumulus_widget' (this will throw an Error in a future version of PHP) in /home/blogoptimise/public_html/wp-content/plugins/wp-cumulus/wp-cumulus.php on line 375
Optimise Blog » Magento with GetClicky & Analytics : Campaign Revenue Tracking
Warning: Use of undefined constant style - assumed 'style' (this will throw an Error in a future version of PHP) in /home/blogoptimise/public_html/wp-content/themes/optimblog/functions.php on line 522

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.

[php]
<?php
$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
?>
[/php]

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

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

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