Google 电子商务数据 - 未附加到交易的项目
Google Ecommerce Data - Items not attached to Transaction
我正在将数据发送到我的分析仪表板上的电子商务视图 - 但这些项目并未附加到交易 - 看起来这些项目也作为交易进行。
我是不是弄错了,还是应该将物品附加到交易中?我哪里错了。
// Build e-commerce items for each item groups
let items = _.map(basket.item_groups, (group) => {
let category = group.type && 'events' || 'products';
let id = group.type && `tt-${group.type}` || `pa-${group.product_attribute}`;
return {
'id': id,
'name': group.description,
'sku': id,
'category': category, // causes problems if removed entirely
'price': group.price,
'quantity': group.quantity,
'currency': basket.currency,
};
});
let transaction = {
'id': basket.id, // Transaction ID. Required.
'affiliation': basket.payment_venue, // Affiliation or store name.
'revenue': basket.total_price,
'shipping': 0,
'tax': basket.taxes,
};
this.call(`${this.namespace}.ecommerce:addTransaction`, transaction);
_.each(items, (item) => {
this.call(`${this.namespace}.ecommerce:addItem`, item);
});
this.call(`${this.namespace}.ecommerce:send`);
您的商品的 id
属性 似乎未设置为交易 ID,但它需要设置。相反,您在 id
和 sku
字段中为每个产品提供自己的 SKU/ID。
在定义item的时候,好像只需要:
'id': basket.id,
在经典电子商务跟踪中,项目和交易作为单独的点击发送(与增强型电子商务不同),因此每个项目都需要链接到交易。您改为使用 SKU 而不是交易 ID 将您的产品分配给交易,这就是它们显示为没有收入的交易的原因。
我正在将数据发送到我的分析仪表板上的电子商务视图 - 但这些项目并未附加到交易 - 看起来这些项目也作为交易进行。
我是不是弄错了,还是应该将物品附加到交易中?我哪里错了。
// Build e-commerce items for each item groups
let items = _.map(basket.item_groups, (group) => {
let category = group.type && 'events' || 'products';
let id = group.type && `tt-${group.type}` || `pa-${group.product_attribute}`;
return {
'id': id,
'name': group.description,
'sku': id,
'category': category, // causes problems if removed entirely
'price': group.price,
'quantity': group.quantity,
'currency': basket.currency,
};
});
let transaction = {
'id': basket.id, // Transaction ID. Required.
'affiliation': basket.payment_venue, // Affiliation or store name.
'revenue': basket.total_price,
'shipping': 0,
'tax': basket.taxes,
};
this.call(`${this.namespace}.ecommerce:addTransaction`, transaction);
_.each(items, (item) => {
this.call(`${this.namespace}.ecommerce:addItem`, item);
});
this.call(`${this.namespace}.ecommerce:send`);
您的商品的 id
属性 似乎未设置为交易 ID,但它需要设置。相反,您在 id
和 sku
字段中为每个产品提供自己的 SKU/ID。
在定义item的时候,好像只需要:
'id': basket.id,
在经典电子商务跟踪中,项目和交易作为单独的点击发送(与增强型电子商务不同),因此每个项目都需要链接到交易。您改为使用 SKU 而不是交易 ID 将您的产品分配给交易,这就是它们显示为没有收入的交易的原因。