Google 电子商务代码问题
此谷歌电子商务代码是否有任何问题。我们有大量交易,但没有显示 在电子商务中...
<script type="text/javascript">
try{
var pageTracker = _gat._getTracker("UA-XXXXXX-1");
pageTracker._trackPageview();
pageTracker._addTrans(
"429", // order ID - required
"louiseh", // affiliation or store name
"11.65", // total - required
"3.15", // shipping
"Santa Clara", // city
"California", // state or province
);
//Add each items in the order
pageTracker._addItem(
"429", // order ID - necessary to associate item with transaction
"99", // SKU/code - required
"Sandwich WrapIt!", // product name
"Home, Garden & Pets", // category or variation
"8.5", // unit price - required
"1",
);
//Now submit the transaction
pageTracker._trackTrans(); //submits transaction to the Analytics server
} catch(err) {}
</script>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-xxxxx-1");
pageTracker._trackPageview();
} catch(err) {}</script>
Is there any issue in this google ecommerce code. We had tons of transactions but none showing
up in the ecommerce...
<script type="text/javascript">
try{
var pageTracker = _gat._getTracker("UA-XXXXXX-1");
pageTracker._trackPageview();
pageTracker._addTrans(
"429", // order ID - required
"louiseh", // affiliation or store name
"11.65", // total - required
"3.15", // shipping
"Santa Clara", // city
"California", // state or province
);
//Add each items in the order
pageTracker._addItem(
"429", // order ID - necessary to associate item with transaction
"99", // SKU/code - required
"Sandwich WrapIt!", // product name
"Home, Garden & Pets", // category or variation
"8.5", // unit price - required
"1",
);
//Now submit the transaction
pageTracker._trackTrans(); //submits transaction to the Analytics server
} catch(err) {}
</script>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-xxxxx-1");
pageTracker._trackPageview();
} catch(err) {}</script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
电子商务代码在
ga.js
脚本加载之前执行,因此_gat
对象尚不可用。抛出了一个错误,但它没有显示在错误控制台中,因为它包含在try/catch
块中。如果您重新排序脚本块,那么它应该可以工作:The ecommerce code is being executed before the
ga.js
script is loaded so the_gat
object isn't available yet. An error is being thrown but it's not being shown in the error console because it's enclosed in atry/catch
block. If you reorder the script blocks then it should work: