When setting up conversion tracking in Google Adwords, one of the options you will need to select is how much each conversion is worth to your business.
If you selling a variety of goods all with different values, it’s impossible to place a specific value for each conversion as they will always be different.
Fortunately, in Magento, it’s easy to set the actual total of each order as the conversion value.
During the conversion tracking setup in Adwords, you have three options to choose from; conversion action has the same value, conversion value may vary and conversion has no value.
When you select ‘the value of the conversion may vary’, you will be asked to assign a default value. Leave this as 1 because we will be changing it in a few minutes.
Once you have completed the rest of the setup, Google will provide you with some pre-populated code to add to the success page in your Magento theme. It will look like this:
<!-- Google Code for test Conversion Page -->
/* <![CDATA[ */
var google_conversion_id = xxxxxxxxxx;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "xxxxxxxxxxxxxxxxxxxx";
var google_conversion_value = 1.00;
var google_conversion_currency = "GBP";
var google_remarketing_only = false;
/* ]]> */
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/1041489413/?value=1.00&currency_code=GBP&label=9rNtCPXapV0QhbzP8AM&guid=ON&script=0"/>
However, as you can see, they have used the default value we entered previously for the conversion value.
To change this to use the total of the shopping cart (minus shipping), we need to do two things.
First, we need to add the following to the top of the success page:
$order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
Secondly, under this snippet of code you have just added, paste the code provided by Google and replace the ‘1.00’ at the end of google_conversion_value with the following:
<?php echo number_format( $order->getGrandTotal(), 2 ) ?>;
Check that everything is working as it should within Google Tag Manager and then you can start getting an accurate ROI for your Adwords account.