代码之家  ›  专栏  ›  技术社区  ›  PJU

谷歌电子商务跟踪分析没有显示任何内容

  •  0
  • PJU  · 技术社区  · 9 年前

    我阅读了谷歌电子商务跟踪分析的文档。我只是按照它的指示,复制并粘贴到测试页面上,然后才能在lives网站上进行测试。我的问题是,我没有看到任何关于电子商务跟踪的东西,尽管我遵循了它的例子。有人能帮我吗?谢谢

    以下是谷歌分析电子商务文档: 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>
    

    是的,我启用了“启用电子商务”和“增强电子商务设置” enter image description here

    1 回复  |  直到 9 年前
        1
  •  2
  •   apradillap    9 年前

    您必须在ga(“电子商务:addTransaction”)和ga(“电子商业:发送”)之间发送;

    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.
    });