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 .
Everything works (I can see the data in GA), except for Product 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] ] });
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!
there is an error/mistake/inconsistency in gtag
documentation:
list_name
instead of list
it works as expected with list_name
!!! DO NOT USE gtag
as it does not send list_name
value with events such as select_content
and view_item
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.
You can send 2 events, when adding to cart from any list:
gtag('event','view_item',deals); gtag('event','add_to_cart',deals);
name of list must be set in list_name.
deals = [{"id": "18","name": "Some product","list_name": "All Deals", ...}]
Then it works fine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.