增强的电子商务转换问题

时间:2014-12-12 14:07:47

标签: google-analytics

这是使用增强型电子商务从GA通用确认页面发送的代码:

ga("create", "UA-XXXXXXX-xx", "auto");
ga("require", "displayfeatures");
ga("require", "ec");
ga("ec:addProduct", {
    Id: null, 
    Name: "ProductNameTest", 
    Brand: "Foo", 
    Category: null, 
    Variant: null, 
    Price: 5.49, 
    Quantity: 1, 
    Coupon: "", 
    Position: 0
});
ga("ec:setAction", "purchase", {
    Id: "33558", 
    Affiliation: "Foo", 
    Revenue: 5.49, 
    Tax: 0, 
    Shipping: 0, 
    Coupon: "", 
    List: null, 
    Step: 4, 
    Option: null
});
ga("send", "pageview");

我没有在GA调试器或Chrome的Tag Assistant插件中看到任何问题。

我在这里缺少的是我们的转化数据/交易没有出现?

编辑:

以下是我为上述内容删除的GA调试器的输出:

Initializing Google Analytics.
Loading resource for plugin: ec
Loading script: "http://www.google-analytics.com/plugins/ua/ec.js"
Running command: ga("create", "UA-XXXXXXX-xx", "auto")
Creating new tracker: t0
Running command: ga("require", "displayfeatures")
Set called on unknown field: "dcLoaded".
Plugin "displayfeatures" intialized on tracker "t0".
Running command: ga("require", "ec")
Waiting on require of "ec" to be fulfilled.
Executing Google Analytics commands.
Registered new plugin: ga(provide, "ec", Function)
Running command: ga("require", "ec")
Plugin "ec" intialized on tracker "t0".
Running command: ga("send", "pageview")

1 个答案:

答案 0 :(得分:4)

我看到一些可能影响您的交易的问题:

  1. 重复ga("require", "ec")个命令。
  2. Id addProduct为空。这是一个required value,应该是一个字符串。
  3. 更多javascript最佳实践:在调用函数后,以分号结束。例如ga("send", "pageview");
  4. 修改 关于第2点,如果开发人员正在传递name参数的值,则Id的{​​{1}}可以为null(请参阅Product Data table)。

    所有属性键必须为小写,addProduct应为Id。 (感谢Eduardo指出)。