未发送 GA 电子商务跟踪数据

GA Ecommerce tracking data not being sent

我有以下电子商务跟踪代码。我正在使用多个跟踪器。网页浏览量得到正确跟踪,但当我查看电子商务报告时,没有数据通过。我错过了什么?

(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-34658431-1', 'auto', {'name' : 'primary'}); // primary tracker
ga('create', 'UA-64375824-1', 'auto', {'name': 'secondary'});  // secondary tracker.

ga('secondary.send', 'pageview');
ga('primary.send', 'pageview');

ga('primary.require', 'ecommerce');
ga('secondary.require', 'ecommerce');
//ga('primary.ecommerce:clear');
//ga('secondary.ecommerce:clear');

var transaction_id = '1';

var ga_transaction = {
    'id': transaction_id,
    'affiliation': 'primary',
    'revenue': '2.46',
    'shipping': '',
    'tax': ''
};

ga('primary.ecommerce:addTransaction', ga_transaction);
ga('secondary.ecommerce:addTransaction', ga_transaction);

var ga_item = {
    'id': transaction_id,
    'name': 'Test',
    'sku': 'Pc6Q',
    'category': 'eBook',
    'price': '2.00',
    'quantity': '1'
};

ga('primary.ecommerce:addItem', ga_item);
ga('secondary.ecommerce:addItem', ga_item);

ga('secondary.ecommerce:send');
ga('primary.ecommerce:send');

就像我在评论中指出的那样(就像您现在在文档中发现的那样)存在处理延迟(通常交易和自定义维度和自定义指标比综合浏览量和事件要长得多)。

为了其他人的利益,这里是相关部分from the documenation:

Data processing latency Processing latency is 24-48 hours. Standard accounts that send more than 200,000 sessions per day to Google Analytics will result in the reports being refreshed only once a day. This can delay updates to reports and metrics for up to two days. To restore intra-day processing, reduce the number of sessions you send to < 200,000 per day. For Premium accounts, this limit is extended to 2 billion hits per month.

数据可能处理得更快,但您不能依赖它。

所以这个问题只需等待即可解决。