I have been requested by a client to push data into gtm.elementClasses using the dataLayer.push() function. More specifically, 99% of all links on our webpage don’t have classes, as they are inside of div elements with button classes and therefore elementClasses is empty.
I have found few articles talking about the stuff I think I need, but I seem to have hit a hard wall.
I would say that I could possibly use this for my needs, but the question I have is, how would I do so. Should it trigger on
<a> tag click and then fill the dataLayer with appropriate data? If it is the case, how?
Until now we used just the easiest setup described here.
Thanks a lot for any kind of answer.
The answer was quite simple – make a specific trigger in GTM and filter it there, not create custom JS functions.