How to modify Matomo tracking code with the replaced GA onclick

I try to replace GTM tracking events code with the _paq.push to stay GTM tracking. So, tracking events will be kept inside Matomo due to stability but it will replace all GA due to Matomo tracking. In this way I do not need to manualy modify and use only Javascript Matomo tracking code.

onclick=“ga(‘send’, ‘event’, ‘Menu’,‘Support’, ‘Contact Us’);”

It will stay in onclick element but Matomo tracking code will translate into:

onclick="_paq.push(['trackEvent', 'Menu', 'Support', 'Contact Us']);"