-
Troubleshooting Challenge: Google Tag Manager's Failure to Recognize gtag.js eventModel DataLayer Variable
Hey, I’m in a bit of a pickle with Google Tag Manager (GTM) and gtag. I’m using gtag.js to send conversion data to Google Analytics 4 and I’ve got a gtag purchase event set up for purchase conversion. Now, as per Google Tag Assistant, the dataLayer setup is looking good. Here’s what it returns:
`
Data Layer Snippet
`
My next move was to add Microsoft Advertising UET via GTM and make use of the dataLayer data. All the UET tags seem to be doing their job, but the jig is that the purchase data variables aren’t getting noticed.
I’ve created a User-Defined Variable in GTM for the purchase amount and slotted it into the GTM UET Custom purchase tag. Check it out:
Name: dlv – eventModel.currency purchase
Data Layer Variable Name: eventModel.currency
Name: dlv – eventModel.value purchase
Data Layer Variable Name: eventModel.value
I’ve put those variables into the UET purchase tag as {{dlv – eventModel.currency purchase}} and {{dlv – eventModel.value purchase}}.
Everything seems to be in order, but the problem is the variables data is showing up as “undefined” or “null”. So, when the UET tag fires, the gv and gc parameters are MIA. In GTM, if I manually enter a string instead of the dataLayer variable for the “value”, the parameter gets inserted into the UET tag as it should.
I’m stumped. Why aren’t the eventModel.value and eventModel.currency variables being pulled from the dataLayer by GTM? Here’s a screenshot of my UET Purchase tag details; this one has the currency as hard-coded and not a variable:
Log in to reply.