Monday, March 14, 2011

Magento - How to track conversions from Google Adwords

Include the code below in app/design/frontent/default/your_template/template/checkout/success.phtml



Below:
<?php echo $this->__('Your order # is: %s'$this->getViewOrderUrl(), $this->getOrderId()) ?>.<?php else :?>
<?php 
echo $this->__('Your order # is: %s'$this->getOrderId()) ?>.<?php endif;?>
<?php //-------------------------------------------
// START ADWORDS CONVERSION VALUE TRACKING CODE
//-------------------------------------------
$order_details Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());$adwords_saleamt $order_details->subtotal?>
<!-- Google Code for Purchase/Sale Conversion Page -->
<
script language="JavaScript" type="text/javascript">
<!--
var 
google_conversion_id XXXXXXXX---YOURIDHERE---XXXXXX;
var 
google_conversion_language "en";
var 
google_conversion_format "1";
var 
google_conversion_color "ffffff";
var 
google_conversion_label "purchase";
var 
google_conversion_value "<?php echo $adwords_saleamt; ?>";//--></script><script language="JavaScript" src="http://www.googleadservices.com/pagead/conversion.js"></script><noscript>
<
img height="1" width="1" border="0" src="http://www.googleadservices.com/pagead/conversion/XXXXXXXX---YOURIDHERE---XXXXXX/?label=purchase&amp;guid=ON&amp;script=0"/>
</
noscript>
<?php//-------------------------------------------
// END ADWORDS CONVERSION VALUE TRACKING CODE
//-------------------------------------------
?>
From http://www.magentocommerce.com/boards/viewthread/22973/P0/

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...
Web Design & Marketing - Click and get an instant quote on your project