undefined Variables in Tag Manager

56 views Asked by At

I am new to Datalayers and GTM but i want to learn it on myself and right now im struggeling to get everything done correctly.

enter image description here

i have tried to add this item_id from Datalayer. The Problem i have everything i type i get "undefined" back.

My Data Layer Looks like This:

{
  event: "view_item",
  gtm: {uniqueEventId: 297, start: 1701096179133},
  ecommerce: {
    currency: "EUR",
    value: 2799,
    items: [
      {
        item_id: "2345",
        item_name: "xxxxxxxx",
        affiliation: "xxxxx",
        coupon: "lorem233",
        discount: 400,
        index: 0,
        item_brand: "lorem ipsum",
        item_category: "lorem ipsum",
        item_category2: "Japan",
        item_category3: "Reisejahr 24",
        item_variant: "",
        price: 3199,
        quantity: 1
      }
    ]
  }
}

My Variable:

enter image description here

i tried also to use only "item_id" as a Data Layer Variable Name" but it didnt work either. Can anyone let me know what i am doing wrong here?

appreciate ur help a lot!

1

There are 1 answers

1
Vlad K. On

You need to use this value for your variable: ecommerce.items.item_id - to capture item id ecommerce.items.item_name - to capture item name etc..