Google Analytics(分析)(gtag.js):产品列表名称未显示,但其他字段显示 [英] Google Analytics (gtag.js): Product List Name doesn't appear but other fields do
问题描述
我正在使用新的gtag.js
库实施GA增强型电子商务.我想按照以下文档发送有关产品印象和产品点击的信息: https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce .
I'm implementing GA Enhanced E-commerce using the new gtag.js
library. I want to send information about product impressions and product clicks, following the documentation here: https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce.
一切正常(我可以在GA中看到数据),产品列表名称除外.
Everything works (I can see the data in GA), except for Product List Name.
文档在命名属性时似乎不一致(有时称为"list"
,有时称为"list_name"
),但它们都不适合我.
The docs seem to be inconsistent in naming the property (sometimes it's called "list"
and sometimes "list_name"
) and none of them worked for me.
这是我的(简体)代码:
Here's my (simplified) code:
deals = [
{
"id": "18",
"name": "Some product",
"list": "All Deals", // also tried "list_name" here
"category": "Multiplatform",
"list_position": "1",
"price": "18,39",
"currency": "EUR",
"product_url": "https://www.amazon.com/someproduct",
},
...
]
...
// on page load
gtag('event', 'view_item_list', {
"items": deals
});
...
// on click
gtag('event', 'select_content', {
"content_type": "product",
"items": [
deals[0]
]
});
所有数据均已成功进入GA,但无论如何,产品列表名称均显示(not set)
:
All the data successfully make their way to GA, but Product List Name shows (not set)
, no matter what:
感谢您对如何解决/调试此问题的任何想法!
Thanks for any idea on how to fix/debug this!
推荐答案
从任意列表添加到购物车时,您可以发送2个事件:
You can send 2 events, when adding to cart from any list:
gtag('event','view_item',deals); gtag('event','add_to_cart',deals);
列表名称必须在list_name中设置.
name of list must be set in list_name.
deals = [{"id": "18","name": "Some product","list_name": "All Deals", ...}]
然后正常工作.
这篇关于Google Analytics(分析)(gtag.js):产品列表名称未显示,但其他字段显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!