我试图将bing转换脚本添加到我的magento网站。
我知道我需要将以下代码添加到网站标题中
<script>(function(w,d,t,r,u){var f,n,i;w[u]=w[u]||[],f=function(){var o={ti:"XXXXXXX"};o.q=w[u],w[u]=new UET(o),w[u].push("pageLoad")},n=d.createElement(t),n.src=r,n.async=1,n.onload=n.onreadystatechange=function(){var s=this.readyState;s&&s!=="loaded"&&s!=="complete"||(f(),n.onload=n.onreadystatechange=null)},i=d.getElementsByTagName(t)[0],i.parentNode.insertBefore(n,i)})(window,document,"script","//bat.bing.com/bat.js","uetq");</script><noscript><img src="//bat.bing.com/action/0?ti=XXXXXXX&Ver=2" height="0" width="0" style="display:none; visibility: hidden;" /></noscript>
****删除了XXXXX ******的bing id
但我需要在结帐成功页面中传递变量转换值,以便将以下脚本添加到成功页面中?
<script>
window.uetq = window.uetq || [];
window.uetq.push({ 'gv': '<?php echo $order->getBaseGrandTotal(); ?>'}); // Pass the computed revenue
</script>
上面的代码脚本是否也适用于最终的magento价格,以便传递到每个页面首部的主脚本?
谢谢..
答案 0 :(得分:0)
要将脚本添加到标头,您可以在local.xml中添加以下内容:
<reference name="head">
<block type="core/text" name="bing.conversion">
<action method="setText">
<text>
<![CDATA[<script>(function(w,d,t,r,u){var f,n,i;w[u]=w[u]||[],f=function(){var o={ti:"XXXXXXX"};o.q=w[u],w[u]=new UET(o),w[u].push("pageLoad")},n=d.createElement(t),n.src=r,n.async=1,n.onload=n.onreadystatechange=function(){var s=this.readyState;s&&s!=="loaded"&&s!=="complete"||(f(),n.onload=n.onreadystatechange=null)},i=d.getElementsByTagName(t)[0],i.parentNode.insertBefore(n,i)})(window,document,"script","//bat.bing.com/bat.js","uetq");</script><noscript><img src="//bat.bing.com/action/0?ti=XXXXXXX&Ver=2" height="0" width="0" style="display:none; visibility: hidden;" /></noscript>]]>
</text>
</action>
</block>