简体   繁体   English

Google Analytics(分析)电子商务实施

[英]Google Analytics ecommerce implementation

I don't know why Google Analytics is not reading my code. 我不知道为什么Google Analytics(分析)不读取我的代码。 I don't know where it is my mistake. 我不知道这是我的错。 the code that is generate when I do a transaction is this: 我进行交易时生成的代码是这样的:

 <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-1', 'auto'); ga('require', 'ecommerce'); ga('ecommerce:addTransaction', { 'id': '195', // Transaction ID. Required. 'affiliation': 'Company name', // Affiliation or store name. 'revenue': '18.00', // Grand Total. 'shipping': '0.00', // Shipping. 'tax': '3.12', // Tax. 'currency': 'EUR' }); ga('ecommerce:addItem', { 'id': '761', // Transaction ID. Required. 'name': 'Agus y los monstruos 3. La canción del parque ESP.', // Product name. Required. 'sku': 'xxxxx', // SKU/code. 'category': 'Primeres novel·les', // Category or variation. 'price': '9.00', // Unit price. 'quantity': '2' // Quantity. }); ga('ecommerce:send'); ga('send', 'pageview'); </script> 

I write this in the header. 我将此写在标题中。 I don't know if something is missing or if I should load a library previously. 我不知道是否缺少某些东西,或者是否应该先前加载库。

Thanks 谢谢

Your code looks fine although the ID in Item and transaction should be the same. 尽管项目和事务中的ID应该相同,但是您的代码看起来也不错。 Have you enabled ecommerce tracking in google analytics . 您是否在Google Analytics(分析)中启用了电子商务跟踪 Do you see any errors in the console? 您是否在控制台中看到任何错误?

Hope this helps, 希望这可以帮助,

Cheers Analytics ML. 干杯分析ML。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM