Target "Click text" of buttons

Hi there,

I’d like to create a trigger which looks at the “click text” of a button. So e.g. if the button text is “Next”, and this button is being clicked, I’d like the trigger to fire.

GTM comes with this by default. How can I achieve that in Piwik Pro?

Thank you and best regards
Julian

Hi @Julian,

Currently we supply this as Custom JS variable, just add this code as a new JS function variable in your Tag Manager:

function() {
  	e = window.event;
   if (e && e.target && e.target.tagName !== "BODY"){
		return e.target.textContent || e.target.innerText;
    };
}

I hope this will be helpful. Feel free to reach out in case you have any other questions.

1 Like

Thank you @Michael ! This works perfectly.

1 Like