Unlike other tracking codes, we need to put Yahoo Analytics Conversion code between <HEAD> and </HEAD> tags.

Yahoo’s Instructions for the following code are:

To add the Yahoo conversion tracking code in the Head tags, we need to look at the checkout layout configuration file:

out which layout it uses when an order is completed.

i.e.) For one checkout, look for this code:

You can edit the Head section of ‘2columnsright.phtml’ to add the Yahoo tracking code. But if this template, 2columnsright.phtml is being used for other pages, I would make a copy of it and name it ‘2columnsright-success.phtml’ and add the tracking code there. This way, it will track it only when there is a successful conversion.

By Charlie Cheng, March 12, 2010 @ 7:13 am

Thx for pointing right direction. But I would recommend the following code as referenced by yahoo help.

$y_order_details = Mage::getModel(’sales/order’)->loadByIncrementId($y_orderid);
$y_saleamt = $y_order_details->subtotal;

<!– Yahoo! Search Marketing Australia & NZ
window.ysm_customData = new Object();
window.ysm_customData.conversion = “transId=,currency=AUD,amount=”;
var ysm_accountid = “//////YOUR TRACKING ACOUNT ID////////”;
// –>

By Charlie Cheng, March 12, 2010 @ 7:14 am

Missing partial of code before, the first line should be:

$y_orderid = Mage::getSingleton(’checkout/session’)->getLastRealOrderId();


61 thoughts on “Magento – Yahoo Analytics Conversion Code”

Leave a Reply