简体   繁体   English

Google Analytics(分析)(gtag.js):产品列表名称未显示,但其他字段显示

[英]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文档中存在错误/错误/不一致:

  • you should use 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_contentview_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.

相关问题 我是否需要包括这一行:<!-- Global site tag (gtag.js) - Google Analytics --> - Do I need to include this line: <!-- Global site tag (gtag.js) - Google Analytics --> 如何在javascript中动态加载gtag.js(谷歌分析) - How to load gtag.js (Google analytics) dynamically in javascript Google Analytics 内容分组无法使用 gtag.js - Google Analytics content grouping not working using gtag.js Google anayltics.js 移动到外部 js 文件有效,但 gtag.js 没有 - Google anayltics.js moved to external js file works, but gtag.js doesn't 为什么 gtag 事件没有出现在 Google Analytics(分析)中? - why the gtag event doesn't appear in Google Analytics? Google Analytics 脚本片段 analytics.js 和 gtag.js 之间的区别 - Difference between Google Analytics script snippets analytics.js and gtag.js 如何在Google Analytics(分析)(gtag.js,analytics.js)过滤器中设置“用户定义”字段? - How to set User Defined field in Google Analytics (gtag.js, analytics.js) filter? 结合Google Analytics(gtag.js)和Google跟踪代码管理器(gtm.js) - Combining Google Analytics (gtag.js) and Google Tag Manager (gtm.js) 我可以为多个子域使用相同的Google Analytics(gtag.js)跟踪ID吗? - Can I use the same Google Analytics (gtag.js) tracking ID for multiple subdomains? GA4 谷歌分析。 gtag.js 发送请求有几秒钟的延迟,而不是立即 - GA4 Google Analytics. gtag.js sends a request with a delay of a few seconds, not instantly
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM