Magento and Google Adwords conversion tracking

If you use Google Adwords advertising for your Magento web store, you will probably need this module. This module will be very useful, because Magento doesn’t have functionality for tracking Adowrds conversion. Feel free to download module and use it on personal responsibility. I’m using this module on web store without any problems.

You need to know that this module will track Adwords conversion over checkout/success page. At checkout/success page will be executed javascript (this is code of Block for checkout/success page):

< ?php /** * * @category Inchoo * @package Inchoo Google Adwords * @author Domagoj Potkoc, Inchoo Team */ class Inchoo_Adwords_Block_Block extends Mage_Core_Block_Abstract { public function __construct() { parent::__construct(); $this->setGoogleConversionId(Mage::getStoreConfig('adwordsmodule/inchoad/google_conversion_id'));
$this->setGoogleConversionLanguage(Mage::getStoreConfig('adwordsmodule/inchoad/google_conversion_language'));
$this->setGoogleConversionFormat(Mage::getStoreConfig('adwordsmodule/inchoad/google_conversion_format'));
$this->setGoogleConversionColor(Mage::getStoreConfig('adwordsmodule/inchoad/google_conversion_color'));
$this->setGoogleConversionLabel(Mage::getStoreConfig('adwordsmodule/inchoad/google_conversion_label'));
}
 
protected function _toHtml()
{
$html = "";
 
if(Mage::helper('inchoo_adwords')->isTrackingAllowed()){
 
$this->setAmount(Mage::helper('inchoo_adwords')->getOrderTotal());
$html .= '
<!-- Google Code for Purchase Conversion Page -->
<script type="text/javascript">
/* < ![CDATA[ */ var google_conversion_id = '.$this->getGoogleConversionId().';
var google_conversion_language = "'.$this->getGoogleConversionLanguage().'";
var google_conversion_format = "'.$this->getGoogleConversionFormat().'";
var google_conversion_color = "'.$this->getGoogleConversionColor().'";
var google_conversion_label = "'.$this->getGoogleConversionLabel().'";
var google_conversion_value = 0;
if ('.$this->getAmount().') {
google_conversion_value = '.$this->getAmount().';
}
/*  */
</script>
<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/'.$this-/>getGoogleConversionId().'/?value='.$this->getAmount().'&amp;amp;amp;amp;amp;label='.$this->getGoogleConversionLabel().'&amp;amp;amp;amp;amp;guid=ON&amp;amp;amp;amp;amp;script=0"/></div>
</noscript>';
}
 
return $html;
}
}
?>

Module has some config options which you need set over Magento admin section. Go to admin System -> Configure -> left tab: “Inchoo Extensions” -> Google Adwords.
You need set some data as: Google conversion id, Google conversion label and so on, if you use Adwords advertising I hope that you know this 🙂

Download Magento – Google Adwords module