javascript - Google Tag Manager Removing some {{Click Text}} -
i want track link clicks i've set tag label {{click text}}
however, if have following html, returns "hello world dont want text"
<a href="http://example.com"> hello world <span><p> dont want text </p></span> </a>
how exclude "i dont want text" result?
thanks
i presume have trigger type click-just links
. then, achieve hello world
in tag need following:
1) create variable:
type: custom javascript
code: function () {return $({{click element}}).clone().children().remove().end().text();}
name: click text without children
2) in trigger, can use variable {{click text without children}}
return hello world
you
Comments
Post a Comment