我需要在我的success.phtml页面中添加以下代码,以跟踪转化价值。
任何人都可以帮我修改PHP代码以使其在Magento 1.8上运行吗?
<!-- Google Code for Purchase Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 1234567890;
var google_conversion_language = "en";
var google_conversion_format = "1";
var google_conversion_color = "666666";
var google_conversion_label = "xxxxXXx1xXXX123X1xX";
var google_conversion_value = 1.00;
if (<? echo $totalValue ?>) {
var google_conversion_value = <? echo $totalValue ?>;
var google_conversion_currency = <? echo $currency ?>;
}
var google_conversion_currency = "USD";
var google_remarketing_only = false;
/* ]]> */
</script>
<script type="text/javascript"
src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt=""
src="//www.googleadservices.com/pagead/
conversion/1234567890/?value=
<? echo $totalValue ?>&currency_code=<? echo $currency ?>
&label=xxxxXXx1xXXX123X1xX&guid=ON&script=0">
</div>
</noscript>
</body>
谢谢
最好的问候
Emanuele的
答案 0 :(得分:0)
您应该能够使用以下内容将订单值传递到AdWords转换跟踪代码中:
/app/design/frontend/package/theme/template/checkout/success.phtml
$order_details = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
$adwords_transval = $order_details->subtotal_incl_tax;
<!-- snip -->
var google_conversion_id = 123456789;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "Xw17CLqRyXIQ5NvqzgM";
var google_conversion_value = 0;
if (<?php echo $adwords_transval; ?>) {
google_conversion_value = <?php echo $adwords_transval; ?>;
}
var google_conversion_currency = "GBP";
var google_remarketing_only = false;
<!-- /snip -->
您可能需要根据您的纳税设置进行调整......