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

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -