2016-11-10 139 views
0

當我運行在谷歌這個代碼鍍鉻的 沒有工作,在頁面查看源代碼無法查看,我不能夠跟蹤訂單,而此代碼工作,可見在Firefox瀏覽器頁面查看源代碼,我可以跟蹤谷歌分析儀表板上的訂單。谷歌Analytics(分析)訂單不可見的,不工作的谷歌瀏覽器

所以,請建議我在哪裏,我做錯了。代碼如下。

在此先感謝。

**********eCommerce Tracking Sample Code********* 
 

 
<script> 
 
(function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){ 
 
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 
 
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 
 
})(window,document,’script’,’//www.google-analytics.com/analytics.js’,’ga’); 
 

 
ga(‘create’, ‘UA-XXXXXX-12’, ‘auto’); 
 

 
ga(‘require’, ‘ecommerce’, ‘ecommerce.js’); 
 

 
ga(‘ecommerce:addTransaction’, { 
 
‘id’: ‘1234’, // Transaction ID. Required. 
 
‘affiliation’: ‘skinny jeans’, // store name. 
 
‘revenue’: ‘28.8’, // total revenue. 
 
‘shipping’: ‘10.00’, // Shipping. 
 
‘tax’: ‘1.89’ // Tax. 
 
}); 
 

 
ga(‘ecommerce:addItem’, { 
 
‘id’: ‘1234’, // Transaction ID. Required. Same as in the transaction data. 
 
‘name’: ‘OKEJeans’, // Product name. Required. 
 
‘sku’: ‘SKJ49’, // Product SKU. 
 
‘category’: ‘Men Jeans’, // Product Category or variation. 
 
‘price’: ‘76.65’, // Product price. 
 
‘quantity’: ‘1’ // Product Quantity. 
 
}); 
 

 
ga(‘ecommerce:send’); 
 

 
ga(‘send’, ‘pageview’); 
 

 
</script>

+0

代碼工作正常,我用鉻(你的例子使用彎曲的報價,我認爲這就是複製和粘貼的效果,取而代之的是用於測試)。我建議你與GA調試器擴展測試https://chrome.google.com/webstore/detail/google-analytics-debugger/jnkmfdileelhofjcijamephohjechhna?hl=en和/或谷歌標記助理https://get.google.com/tagassistant /並查看是否顯示錯誤消息。僅基於代碼,我認爲它不可能幫助你。 –

回答

0

您的代碼有不正確的報價和交易逆轉以及項目的順序。

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 
})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); 

ga('create', 'UA-XXXXXX-12', 'auto'); 

ga('require', 'ecommerce', 'ecommerce.js'); 


ga('ecommerce:addItem', { 
'id': '1234', // Transaction ID. Required. Same as in the transaction data. 
'name': 'OKEJeans', // Product name. Required. 
'sku': 'SKJ49', // Product SKU. 
'category': 'Men Jeans', // Product Category or variation. 
'price': '76.65', // Product price. 
'quantity': '1' // Product Quantity. 
}); 

ga('ecommerce:addTransaction', { 
'id': '1234', // Transaction ID. Required. 
'affiliation': 'skinny jeans', // store name. 
'revenue': '28.8', // total revenue. 
'shipping': '10.00', // Shipping. 
'tax': '1.89' // Tax. 
}); 

ga('ecommerce:send'); 

ga('send', 'pageview'); 

它似乎工作。

enter image description here

相關問題