我想跟踪GA-EC的承诺,但是,由于这些不是购买,因此必须以相当创造性的方式使用某些字段。尽管如此,以下跟踪器代码确实可以部分工作:
(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-XXXXXXXX-X", 'auto');
ga('require', 'displayfeatures');
ga('require', 'ec');
(...)
ga('ec:addProduct', {
"id":"Reward@123",
"name":"50",
"category":"music",
"currency":"EUR",
"price":"50"
});
ga('ec:setAction', 'purchase', {
"id":"Payment@123",
"affiliation":"Project@123",
"coupon":"prepaid"
});
(...)
ga('send', 'pageview');
我确实看到了从属关系或优惠券,但无论选择哪种货币,金额始终为0。
知道我在这里做错了什么吗?