Google Analytic on Ecommerce Tracking没有显示任何内容

时间:2016-11-15 21:24:55

标签: javascript web google-analytics e-commerce

我在电子商务跟踪中阅读了Google Analytic的文档。我只是按照它的指示,我复制并粘贴在测试页面上,然后才能在生命网站上进行。我的问题是,即使我遵循其示例,我也没有看到电子商务跟踪的任何内容。有人能帮帮我吗?感谢。

以下是Google Analytic电子商务文档:https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce

<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','https://www.google-analytics.com/analytics.js','ga');

    ga('create', 'UA-87205702-2', 'auto');
    ga('send', 'pageview');

    ga('require', 'ecommerce');

    ga('ecommerce:addTransaction', {
      'id': '1234',                     // Transaction ID. Required.
      'affiliation': 'Acme Clothing',   // Affiliation or store name.
      'revenue': '11.99',               // Grand Total.
      'shipping': '5',                  // Shipping.
      'tax': '1.29'                     // Tax.
    });
    ga('ecommerce:send');

</script>

是的,我启用了&#34;启用电子商务&#34;和#34;增强型电子商务设置。&#34; enter image description here

1 个答案:

答案 0 :(得分:2)

你必须在ga之间发送('ecommerce:addTransaction'和ga('ecommerce:send');

ga('ecommerce:addItem', {
  'id': '1234',                     // Transaction ID. Required.
  'name': 'Fluffy Pink Bunnies',    // Product name. Required.
  'sku': 'DD23444',                 // SKU/code.
  'category': 'Party Toys',         // Category or variation.
  'price': '11.99',                 // Unit price.
  'quantity': '1'                   // Quantity.
});