【问题标题】:Google analytics enhanced ecommerce, help me debug setup please谷歌分析增强电子商务,请帮我调试设置
【发布时间】:2014-08-18 09:24:43
【问题描述】:

我已经在 Google UA 中实施了增强的电子商务跟踪,方法是填充 dataLayer,尽我所能看到正确的数据。

这是实际数据层脚本的 html:

<script type="text/javascript">

    dataLayer.push({
        'ecommerce': {
            'purchase': {
                'actionField': {
                    'id': 'ZW10317808',                         // Transaction ID. Required for purchases and refunds.
                    'affiliation': 'Online Store',
                    'revenue': '9.95',                     // Total transaction value (incl. tax and shipping)
                    'tax':'0.00',
                    'shipping': '0.00',
                    'coupon': '',
                    'products': [

                        {
                            'name': 'Test product', // Name or ID is required.
                            'id': 'ZCMNR010',
                            'price': '9.95',
                            'brand': 'Brand',
                            'category': '',
                            'variant': '',
                            'quantity': 1
                            //, 'coupon': '' // Optional fields may be omitted or set to empty string.
                            } 
                    ]
                }
            }
        }
    });
</script>

这是来自控制台的示例输出,因此(在我看来)这些值都在对 dataLayer 产生影响:

dataLayer
[
   0: {
      [functions]: ,
      __proto__: { },
      ecommerce: {
         [functions]: ,
         __proto__: { },
         purchase: {
            [functions]: ,
            __proto__: { },
            actionField: {
               [functions]: ,
               __proto__: { },
               action: "purchase",
               affiliation: "Online Store",
               coupon: "",
               id: "ZW10317808",
               products: [
                  0: {
                     [functions]: ,
                     __proto__: { },
                     brand: "Brand",
                     category: "",
                     id: "ZCMNR010",
                     name: "Test Product",
                     price: "9.95",
                     quantity: 1,
                     variant: ""
                  },
                  length: 1
               ],
               revenue: "9.95",
               shipping: "0.00",
               tax: "0.00"
            }
         }
      }
   },
   1: {
      [functions]: ,
      __proto__: { },
      event: "gtm.js",
      gtm.start: 1408351886007
   },
   2: {
      [functions]: ,
      __proto__: { },
      ecommerce: {
         [functions]: ,
         __proto__: { },
         checkout: {
            [functions]: ,
            __proto__: { },
            actionField: {
               [functions]: ,
               __proto__: { },
               step: "Order Confirmation"
            }
         }
      },
      event: "checkout"
   },
   3: {
      [functions]: ,
      __proto__: {
         [functions]: ,
         __proto__: null
      },
      event: "gtm.dom"
   },
   4: { },
   length: 5
]

该交易在 UA 中列出,但收入为 0.00,商品为 0 等。该交易来自上周,因此不太可能是数据延迟。

报告中也没有显示结帐步骤跟踪。我在 GA 视图中启用了增强跟踪,并在 GTM 中部署了插件视图设置。

我在挠头。希望一双新鲜的眼睛能发现一些明显的东西。

如果你能帮忙,谢谢。

谢谢

【问题讨论】:

  • 我没有看到任何明显的代码。您是否尝试过使用Google Analytics Debugger 来监控请求?
  • Blexy,非常感谢您花时间帮我看这个。我可以确认我已经解决了这个问题,并且通常这是一个简单的缺陷,我自己的眼睛隐藏了他们想要的东西,而不是那里的东西。我的渲染脚本在代码
     、'products': [
    和匹配的结束标记中缺少 { ,但其他方面看起来是正确的。有条不紊的调试揭示了这个问题,这应该是我的第一个停靠点。感谢 Chrome 扩展程序,我不知道,现在正在安装它。每朵云.. :)

标签: google-analytics


【解决方案1】:

产品必须位于“购买”下方,而不是在 actionFieldObject 中:

<script type="text/javascript">

dataLayer.push({
    'event': 'transaction',
    'ecommerce': {
        'purchase': {
            'actionField': {
                'id': 'ZW10317808',                         // Transaction ID. Required for purchases and refunds.
                'affiliation': 'Online Store',
                'revenue': '9.95',                     // Total transaction value (incl. tax and shipping)
                'tax':'0.00',
                'shipping': '0.00',
                'coupon': ''
            },
            'products': [

                {
                    'name': 'Test product', // Name or ID is required.
                    'id': 'ZCMNR010',
                    'price': '9.95',
                    'brand': 'Brand',
                    'category': '',
                    'variant': '',
                    'quantity': 1
                    //, 'coupon': '' // Optional fields may be omitted or set to empty string.
                    } 
            ]
        }
    }
});

希望对您有所帮助。

【讨论】:

    猜你喜欢
    • 2021-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-08
    相关资源
    最近更新 更多