2
I created the event in Google tag manager, and I need to bring the value that is in the ID clicked. But in Analytics it shows as 'Undefined', someone has some hint?
$('a#HomeB02').on('click', function() {
var Id_ = $(this).attr('id');
dataLayer.push({
'event': 'HomeB',
'gaEventCategory': 'Home',
'gaEventAction': 'Banner',
'gaEventLabel': Id_
});
});
Have you tried putting
console.log(Id_)to see if there appearsundefinedalso? Also, you can write simplythis.idin place of$(this).attr('id'). Whatconsole.log(this)prints? I would guess that the context of your Handler is not what you expect it to be.– user25930
Tested and does not work either, I believe it works only by setting directly on gaEventLabel. Thanks for the help.
– lucas inverso
Thanks for the help @ctgPi managed to resolve.
– lucas inverso