我是开发新手,无法让Google Analytics跟踪Safari和Firefox中的电子商务交易。该标记在Chrome中成功触发。以下是我在订单页面上生成的代码:
ga("require", "ecommerce");
var gaInfo = {
"id": resp.number,
"affiliation": "Bivouac Ann Arbor",
"revenue": resp.total,
"shipping": resp.shipping,
"tax": resp.tax
};
ga("ecommerce:addTransaction", gaInfo);
for (var i = 0; i < resp.lineItems.length; i++) {
var lineItemInfo = {
"id": resp.number,
"name": resp.lineItems[i].name,
"sku": resp.lineItems[i].sku_id,
"category": "",
"price": resp.lineItems[i].cost,
"quantity": resp.lineItems[i].quantity
};
ga("ecommerce:addItem", lineItemInfo);
};
ga("ecommerce:send");
不确定为什么代码可以在一个浏览器上运行而不在其他浏览器上运行。