Attribute missing on data layer
-
Hi, I’m trying to configure the Pinterest tag on my website, but I’ve noticed that the product category only appears in the data layer on the front page when I select a product, but not on product page (I tested it with the gtm preview tool). So it can’t track page visits and add-to-cart events properly. Is it the theme’s fault? I use Elementor with Hello Theme.
Thanks already.
-
Hi,
The category element in the ecommerce object should be there on each page and each ecommerce action. If it is missing, that should be something site specific.
This event works and shows categories: gtm4wp.productClickEEC
? currencyCode: “BRL”,
? click: {
? ? actionField: {list: “General Product List”},
? ? products: [
? ? ? {
? ? ? ? id: “BRA3-004-2.1”,
? ? ? ? name: “Bralette Bicolor #3 – Cole??o Laminae”,
? ? ? ? price: 69.9,
? ? ? ? category: “Lingerie/Bralettes”,
? ? ? ? stocklevel: “”,
? ? ? ? brand: “M. Frontzek Lingerie”,
? ? ? ? position: 1But I don’t get any “view item” events on the product page, nor the infos above appear. I only get infos from product impressions from the previous page on the product page. I’ve configured everything myself, exactly as your tutorials.
Please, can you help? My website is mfrontzek.com
- This reply was modified 3 years, 2 months ago by mftzk.
This is the info I have of the product on the product page:
productRatingCounts: [],
productAverageRating: 0,
productReviewCount: 0,
productType: “variable”,
productIsVariable: 1,
ecomm_prodid: “BRA1-001-1.2”,
ecomm_pagetype: “product”,
ecomm_totalvalue: 109.9`I am having the same problem. I usually don’t work on enhanced e-commerce. Then I setup my gtm event by event. Today I went to setup all the GA4 events and I could not see the view item info. I just could see the products impression and cart products
productRatingCounts: [], productAverageRating: 0, productReviewCount: 0, productType: "simple", productIsVariable: 0, ecomm_prodid: 3530, ecomm_pagetype: "product", ecomm_totalvalue: 58,
- This reply was modified 3 years, 1 month ago by ronnymiuxa.
There was a plugin conflicting with gtm4wp (my shipment plugin had a shipping calculator that was blocking the code), I solved it, and now I get this code after selecting the product variation I wish to shop on product page:
detail: {
products: [
{
name: “Bralette Bicolor #3 – Cole??o Laminae”,
id: “BRA3-004-2.1-PP”,
price: 69.9,
category: “Lingerie/Bralettes”,
stocklevel: “”,
brand: “M. Frontzek Lingerie”,
variant: “pp”
}
]
}But still I can’t refer to it on google tag manager variables, I’ve tried several ways but I don’t know how to do it. I was able to refer to this piece of code, though:
productRatingCounts: [],
productAverageRating: 0,
productReviewCount: 0,
productType: “variable”,
productIsVariable: 1,
ecomm_prodid: “BRA1-001-1.2”,
ecomm_pagetype: “product”,
ecomm_totalvalue: 109.9`But there’s no product category there.
Can the support help?
[Moderator note: Please, No bumping].
- This reply was modified 3 years ago by Steven Stern (sterndata).
Hi @mftzk,
Sorry for the delay.
Please post the URL of your site so that I can have a look at it.
Also a GTM shared preview link would be very useful, this would allow me to turn on GTM debug mode without the need to grant me specific access to your container.My website: https://mfrontzek.com
The link (is that correct?) https://tagassistant.google.com/#/?id=GTM-WMG7558&url=https%3A%2F%2Fmfrontzek.com%2F%3Fgtm_debug%3D1637181272585&source=TAG_MANAGER>m_auth=BhJhWuoQByUswjyeegew2A>m_preview=env-16
I’d like to know how to refer to the “id” and “category” in these pieces of code when I build a Google Tag Manager variable to pull these informations, please:
detail: {
products: [
{
name: “Bralette Bicolor #3 – Cole??o Laminae”,
id: “BRA3-004-2.1-PP”,
price: 69.9,
category: “Lingerie/Bralettes”,
stocklevel: “0”,
brand: “M. Frontzek Lingerie”,
variant: “pp”and
event: “gtm4wp.orderCompletedEEC”,
ecommerce: {
currencyCode: “BRL”,
purchase: {
actionField: {
id: “11314”,
affiliation: “”,
revenue: 132.82999999999998,
tax: 0,
shipping: 11.18,
coupon: “”
},
products: [
{
id: “BRA1-003-3-M”,
name: “Bralette Vinho #1 – Cole??o Pythonissam”,
sku: “BRA1-003-3-M”,
category: “Lingerie/Bralettes”,
price: 62.93,
stocklevel: 5,
brand: “M. Frontzek Lingerie”,
variant: “m”,
quantity: 1
},
{
id: “BRA3-004-2.1-PP”,
name: “Bralette Bicolor #3 – Cole??o Laminae”,
sku: “BRA3-004-2.1-PP”,
category: “Lingerie/Bralettes”,
price: 69.9,
stocklevel: -1,
brand: “M. Frontzek Lingerie”,
variant: “pp”,
quantity: 1Currently I was able to refer only to this code when making a variable to pull the product ID and value, but there’s no product category in it:
productRatingCounts: [],
productAverageRating: 0,
productReviewCount: 0,
productType: “variable”,
productIsVariable: 1,
ecomm_prodid: “BRA3-004-2.1-PP”,
ecomm_pagetype: “product”,
ecomm_totalvalue: 69.9,As far as I can see you have the following Pinterest related tags in your GTM container:
Tag Pinterest – fires on all pages, but does not include any Pinterest event set
Tag Pinterest – Visualiza??es – fires on all page load (“All pages”) with the pagevisit Pinterest event
Tag Pinterest – Compra – Firess on the purchase eventI do not see any tag that would fire on the view_item
Generally as far as I can see you setup your Pinterest purchase tag to use the GA4 version of the ecommerce data which I would also recommend. In this case you should ignore all events starting with gtm4wp. and use only GA4 events like view_item, add_to_cart, begin_checkout and purchase.
With that, you will need to get the data rather from this code:
ecommerce: { currency: "BRL", items: [ { item_id: "BRA3-004-2.1-PP", item_name: "Bralette Bicolor #3 - Cole??o Laminae", item_brand: "M. Frontzek Lingerie", price: 69.9, item_category: "Lingerie", item_category_2: "Bralettes", item_variant: "pp", google_business_vertical: "retail", id: "BRA3-004-2.1-PP" } ] },
To access the category name of the first product in the items array you need to create a data layer variable and enter this variable name:
ecommerce.items.0.item_category
Or if you need a comma separated list of category names of all products in the items array you can create a new custom javascript variable with this script:
function() {
var items = {{Ecommerce Items}};
var cat_list = [];
items.forEach(function(item) {
cat_list.push(item.item_category);
});return cat_list.join(“, “);
}
- The topic ‘Attribute missing on data layer’ is closed to new replies.