[英]Google Analytics (gtag.js): Product List Name doesn't appear but other fields do
I'm implementing GA Enhanced E-commerce using the new gtag.js
library. 我正在使用新的gtag.js
库实施GA增强型电子商务。 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 . 我想按照以下文档发送有关产品印象和产品点击的信息: https : //developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce 。
Everything works (I can see the data in GA), except for Product List Name . 一切正常(我可以在GA中看到数据), 产品列表名称除外 。
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. 文档在命名属性时似乎不一致(有时将其称为"list"
,有时也称为"list_name"
),但它们都不适合我。
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] ] });
All the data successfully make their way to GA, but Product List Name shows (not set)
, no matter what: 所有数据都成功进入了GA,但是无论如何,产品列表名称都会显示(not set)
:
Thanks for any idea on how to fix/debug this! 感谢您提供有关如何解决/调试此问题的想法!
there is an error/mistake/inconsistency in gtag
documentation: gtag
文档中存在错误/错误/不一致:
list_name
instead of list
您应该使用list_name
而不是list
it works as expected with list_name
它可以按预期与list_name
!!! !!! DO NOT USE gtag
as it does not send list_name
value with events such as select_content
and view_item
不要使用 gtag
因为它不会发送带有select_content
和view_item
事件的list_name
值
in short, query parameter pal
(Product Action List) for collect
call via gtag
is not included, when using gtag
— this is a major error comparing to analytics.js
implementation. 简而言之,使用gtag
时,不包括用于通过gtag
进行collect
呼叫的查询参数pal
(产品操作列表)-与analytics.js
实施相比,这是一个主要错误。
You can send 2 events, when adding to cart from any list: 从任何列表添加到购物车时,您可以发送2个事件:
gtag('event','view_item',deals); gtag('event','add_to_cart',deals);
name of list must be set in list_name. 列表名称必须在list_name中设置。
deals = [{"id": "18","name": "Some product","list_name": "All Deals", ...}]
Then it works fine. 然后工作正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.