发送增强型电子商务数据
Send enhanced ecommerce data
当我登陆确认页面时,我 运行 下面的代码。
var purchaseObject = {
'id': $OrderID,
'revenue': $total,
'shipping': $deliverycost
};
if (couponCode.length) {
purchaseObject['coupon'] = couponCode;
}
ga('ec:setAction', 'purchase', purchaseObject);
ga('ec:send');
两次发送都会生成错误消息。
Plugin "ec" does not have method "send".
和
Error calling a plugin method: {0: "ec:send"}
我已经添加了
ga('require', 'ec');
在头部和其他事件有效所以我不明白为什么发送不起作用。
EEC 没有发送方法,您使用电子商务数据设置操作,这将与下一次网页浏览(或其他交互)一起发送。参见 example from the Google documentation:
// Transaction level information is provided via an actionFieldObject.
ga('ec:setAction', 'purchase', {
'id': 'T12345',
'affiliation': 'Google Store - Online',
'revenue': '37.39',
'tax': '2.85',
'shipping': '5.34',
'coupon': 'SUMMER2013' // User added a coupon at checkout.
});
ga('send', 'pageview'); // Send transaction data with initial pageview.
注意最后一条评论 - 交易随网页浏览一起发送。如果您不想要其他综合浏览量,请使用事件。
可以通过活动发送:
ga('ec:setAction', 'purchase', { // Transaction details are provided in an actionFieldObject.
'id': 'T12345', // (Required) Transaction id (string).
'affiliation': 'Google Store - Online', // Affiliation (string).
'revenue': '37.39', // Revenue (currency).
'tax': '2.85', // Tax (currency).
'shipping': '5.34', // Shipping (currency).
'coupon': 'SUMMER2013' // Transaction coupon (string).
});
ga('send','event','Ecommerce','Purchase','revenue', {nonInteraction: true});
当我登陆确认页面时,我 运行 下面的代码。
var purchaseObject = {
'id': $OrderID,
'revenue': $total,
'shipping': $deliverycost
};
if (couponCode.length) {
purchaseObject['coupon'] = couponCode;
}
ga('ec:setAction', 'purchase', purchaseObject);
ga('ec:send');
两次发送都会生成错误消息。
Plugin "ec" does not have method "send".
和
Error calling a plugin method: {0: "ec:send"}
我已经添加了
ga('require', 'ec');
在头部和其他事件有效所以我不明白为什么发送不起作用。
EEC 没有发送方法,您使用电子商务数据设置操作,这将与下一次网页浏览(或其他交互)一起发送。参见 example from the Google documentation:
// Transaction level information is provided via an actionFieldObject.
ga('ec:setAction', 'purchase', {
'id': 'T12345',
'affiliation': 'Google Store - Online',
'revenue': '37.39',
'tax': '2.85',
'shipping': '5.34',
'coupon': 'SUMMER2013' // User added a coupon at checkout.
});
ga('send', 'pageview'); // Send transaction data with initial pageview.
注意最后一条评论 - 交易随网页浏览一起发送。如果您不想要其他综合浏览量,请使用事件。
可以通过活动发送:
ga('ec:setAction', 'purchase', { // Transaction details are provided in an actionFieldObject.
'id': 'T12345', // (Required) Transaction id (string).
'affiliation': 'Google Store - Online', // Affiliation (string).
'revenue': '37.39', // Revenue (currency).
'tax': '2.85', // Tax (currency).
'shipping': '5.34', // Shipping (currency).
'coupon': 'SUMMER2013' // Transaction coupon (string).
});
ga('send','event','Ecommerce','Purchase','revenue', {nonInteraction: true});