Title: Attribute missing on data layer
Last modified: September 25, 2021

---

# Attribute missing on data layer

 *  [mftzk](https://wordpress.org/support/users/mftzk/)
 * (@mftzk)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/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.

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Plugin Author [Thomas Geiger](https://wordpress.org/support/users/duracelltomi/)
 * (@duracelltomi)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/attribute-missing-on-data-layer/#post-14913099)
 * 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.
 *  Thread Starter [mftzk](https://wordpress.org/support/users/mftzk/)
 * (@mftzk)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/attribute-missing-on-data-layer/#post-14913301)
 * 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: 1
 * But 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 4 years, 8 months ago by [mftzk](https://wordpress.org/support/users/mftzk/).
 *  Thread Starter [mftzk](https://wordpress.org/support/users/mftzk/)
 * (@mftzk)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/attribute-missing-on-data-layer/#post-14913643)
 * 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`
 *  [ronnymiuxa](https://wordpress.org/support/users/ronnymiuxa/)
 * (@ronnymiuxa)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/attribute-missing-on-data-layer/#post-14989051)
 * 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 4 years, 8 months ago by [ronnymiuxa](https://wordpress.org/support/users/ronnymiuxa/).
 *  Thread Starter [mftzk](https://wordpress.org/support/users/mftzk/)
 * (@mftzk)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/attribute-missing-on-data-layer/#post-14989900)
 * 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](https://make.wordpress.org/support/handbook/forum-welcome/#do-not%c2%a0bump-posts)]._
    -  This reply was modified 4 years, 7 months ago by [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/).
 *  Plugin Author [Thomas Geiger](https://wordpress.org/support/users/duracelltomi/)
 * (@duracelltomi)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/attribute-missing-on-data-layer/#post-15078847)
 * Hi [@mftzk](https://wordpress.org/support/users/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.
 *  Thread Starter [mftzk](https://wordpress.org/support/users/mftzk/)
 * (@mftzk)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/attribute-missing-on-data-layer/#post-15078920)
 * My website: [https://mfrontzek.com](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&gtm_auth=BhJhWuoQByUswjyeegew2A&gtm_preview=env-16](https://tagassistant.google.com/#/?id=GTM-WMG7558&url=https%3A%2F%2Fmfrontzek.com%2F%3Fgtm_debug%3D1637181272585&source=TAG_MANAGER&gtm_auth=BhJhWuoQByUswjyeegew2A&gtm_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: 1
 * Currently 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,
 *  Plugin Author [Thomas Geiger](https://wordpress.org/support/users/duracelltomi/)
 * (@duracelltomi)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/attribute-missing-on-data-layer/#post-15082709)
 * 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
   event
 * I 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(“, “);
    }

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Attribute missing on data layer’ is closed to new replies.

 * ![](https://ps.w.org/duracelltomi-google-tag-manager/assets/icon-256x256.png?
   rev=1708451)
 * [GTM4WP - A Google Tag Manager (GTM) plugin for WordPress](https://wordpress.org/plugins/duracelltomi-google-tag-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/duracelltomi-google-tag-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/duracelltomi-google-tag-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/duracelltomi-google-tag-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/duracelltomi-google-tag-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/duracelltomi-google-tag-manager/reviews/)

 * 8 replies
 * 3 participants
 * Last reply from: [Thomas Geiger](https://wordpress.org/support/users/duracelltomi/)
 * Last activity: [4 years, 7 months ago](https://wordpress.org/support/topic/attribute-missing-on-data-layer/#post-15082709)
 * Status: not resolved