Matomo script runs more then once

hello dear,

matomo exectute same action more then once.

for example

we have created a custom variable to fetch the click of text where visitor clicks.
the problem is when visitor click on one button matomo capture as a more then one so can any one help on that.

Thank you