Piwik Tracking button click

Please help me write the correct tracking code for click the button (“Submit”) for my feedback form.


Depending on how detailed you want to track the form data, you can either track an event in JavaScript (Tracking a submit button) or use the form analytics premium plugin (https://www.form-analytics.net)


we do have Cloud license, so form tracking is available.
For our forms, we do have multiple buttons, other than type=submit, such as “Cancel” or other operations.

What is the recommended approach to track those buttons?
Seems to me the most elegant is to make button an input ( will it work?)

input type=“button” data-matomo-form data-matomo-name=“cancel”

Or do you suggest to have buttons and “submit” button ( for consistency) to track as Custom Event?