# Target "Click text" of buttons

**URL:** <https://community.piwik.pro/t/target-click-text-of-buttons/318>\
**Category:** Data collection and tags\
**Created:** [November 1, 2021, 2:28pm UTC](https://community.piwik.pro/t/target-click-text-of-buttons/318 "2021-11-01T14:28:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julian](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/julian/32/2244_2.png) [@Julian](https://community.piwik.pro/u/Julian)\
**Post date:** [November 1, 2021, 2:28pm UTC](https://community.piwik.pro/t/target-click-text-of-buttons/318/1 "2021-11-01T14:28:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Michael](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/michael/32/27_2.png) [@Michael](https://community.piwik.pro/u/Michael)\
**Post date:** [November 2, 2021, 10:12am UTC](https://community.piwik.pro/t/target-click-text-of-buttons/318/2 "2021-11-02T10:12:01Z")

</div>

Hi @Julian,

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![Julian](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/julian/32/2244_2.png) [@Julian](https://community.piwik.pro/u/Julian)\
**Post date:** [November 2, 2021, 11:12am UTC](https://community.piwik.pro/t/target-click-text-of-buttons/318/3 "2021-11-02T11:12:26Z")

</div>

Thank you @Michael ! This works perfectly.

---

<div class="post-metadata">

**Author:** ![WWNL](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/wwnl/32/292_2.png) [@WWNL](https://community.piwik.pro/u/WWNL)\
**Post date:** [April 28, 2022, 3:04pm UTC](https://community.piwik.pro/t/target-click-text-of-buttons/318/4 "2022-04-28T15:04:16Z")

</div>

This works great for now, but I do wish all the standard variables in GTM would also be available in Piwik PRO. Would make live a lot easier!
