![](/img/trans.png)
[英]Do I need to include this line: <!-- Global site tag (gtag.js) - Google Analytics -->
[英]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 。
一切正常(我可以在GA中看到數據), 產品列表名稱除外 。
文檔在命名屬性時似乎不一致(有時將其稱為"list"
,有時也稱為"list_name"
),但它們都不適合我。
這是我的(簡化)代碼:
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)
:
感謝您提供有關如何解決/調試此問題的想法!
gtag
文檔中存在錯誤/錯誤/不一致:
list_name
而不是list
它可以按預期與list_name
!!! 不要使用 gtag
因為它不會發送帶有select_content
和view_item
事件的list_name
值
簡而言之,使用gtag
時,不包括用於通過gtag
進行collect
呼叫的查詢參數pal
(產品操作列表)-與analytics.js
實施相比,這是一個主要錯誤。
從任何列表添加到購物車時,您可以發送2個事件:
gtag('event','view_item',deals); gtag('event','add_to_cart',deals);
列表名稱必須在list_name中設置。
deals = [{"id": "18","name": "Some product","list_name": "All Deals", ...}]
然后工作正常。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.