I have a tag in gtm with an event parameter which can be true or false. This tag is triggerd by a domReady (or page loaded) trigger on a specific URL. Inside the DOM I have an element that has inside a div-Tag the attribute data-ga-confirmation="true"
or data-ga-confirmation="false"
.
The variable is not given to GTM though, the event parameter of the tag always has the default value.
For click triggers it works fine, but there I can add the data-ga-confirmation="true"
attribute to the element I'm actually clicking on.
Make a CJS variable in GTM. Like so:
function(){
return {{Clicked Element}}.getAttribute("data-ga-confirmation");
}
And use it in your tag. Since you've not provided your HTML, I assume we're talking about the attribute on the clicked element. Well if no, you can always parse your way through GTM from the clicked element.