Adwords Conversion Tracking in Magento

As a web developer and digital marketian, I have worked on too many website, which was/is developed on different -different type of CMS, custom platform and frameworks.

Magento is one of the most popular open-source e-commerce platform. It is very popular and robust eCommerce platform because anyone having light knowledge of PHP, javaScript, HTML can built their own website and this is very easy to setup.

Magento Ecommerce

As a digital marketian, when I was trying to implement google or any other ads agency code, I faced some challenges and also too many other guys asked too many questions, like:

  1. How to add conversion tracking code on Magento?

  2.  Where do we have to add conversion tracking on Magento?

  3. How to fetch conversion value/total value in magento?

Here I have mentioned Simple solution of all 3 questions. But to implement conversion code(Google Adwords) you must have access of Admin panel or FTP access of the site.

If you have only admin access or light knowledge of web development, you can use Magento Adword Conversion extension(paid/free) from Magento Commerce.

But if you are a developer and you have FTP access you can follow below steps to add conversion code with value in Magento:

  • Login to FTP.
  • Open success.phtml (file path: app->design->frontend-> yourPackage->yourTheme->template->checkout->success.phtml).
  • Add the below code  in bottom of success.phtml.
<?php $order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId()); 
$subtotal = $order->getSubtotal();
$gtotal = $order->getGrandTotal();


// add Conversion code here and replace conversion value  with <?php echo $gtotal;?><br>

Just after above code add your conversion code and replace conversion value with in both script tag as well as noscript tag.

If any issue kindly leave comment or contact me.

Note: Above mention code will work on Magento v1.x(Like 1.9, 1.8, ..)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.