google-tag-managergoogle-datalayerdata-layer

Google Tag Manager Shows Data Layer Variable Values as undefined in the fired tag


I am trying to add dataLayer variable values inside my tag, but when I look at the tag fired inside the Network tab of my console in Chrome, I see that the tag has been populated with undefined values, even though the dataLayer object in console has the right values.

Here is my dataLayer variable in GTM:

enter image description here

This is how I access the value inside the tag:

ORDERID={{ORDERID}}

And this is what I see as dataLayer values in console:

enter image description here

But inside the network tab, I see that the dataLayer variable is undefined:

enter image description here

This is how my Tag Manager's DataLayer in preview mode looks like:

enter image description here Why?? I am pulling my hair over this now. How can I access dataLayer variable values?


Solution

  • Your ORDERID variable is correctly defined. Your tag which reads that variable should be fired on the "CHECKOUT: COMPLETE" event, otherwise that variable will be undefined.