Google 分析电子商务实施
Google Analytics ecommerce implementation
我不知道为什么 Google Analytics 不读取我的代码。我不知道我的错误在哪里。
当我进行交易时生成的代码是这样的:
<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>
我把这个写在页眉中。不知道是不是少了什么,还是应该先加载一个库。
谢谢
虽然项目和交易中的 ID 应该相同,但您的代码看起来不错。
您是否启用了 ecommerce tracking in google analytics。
您在控制台中看到任何错误吗?
希望对您有所帮助,
Cheers Analytics ML。
我不知道为什么 Google Analytics 不读取我的代码。我不知道我的错误在哪里。 当我进行交易时生成的代码是这样的:
<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>
我把这个写在页眉中。不知道是不是少了什么,还是应该先加载一个库。
谢谢
虽然项目和交易中的 ID 应该相同,但您的代码看起来不错。 您是否启用了 ecommerce tracking in google analytics。 您在控制台中看到任何错误吗?
希望对您有所帮助,
Cheers Analytics ML。