Google analytics - track form submission with html event handlers / datalayer Example from: https://www.simoahava.com/analytics/track-form-engagement-with-google-tag-manager/#2
Google dev guide: https://developers.google.com/tag-manager/devguide
<!--
implement a custom dataLayer.push() into the callback function
which is invoked upon a successful submission.
The piece of code could be something like:
-->
<script>
function onFormSuccess(event) {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event' : 'formSubmissionSuccess',
'formId' : 'contactForm'
});
// Rest of the success callback code
}
</script>
<!--
This would push formSubmissionSuccess into
the dataLayer as the value of the event key.
Then, you can create a Custom Event Trigger, which waits
for an event named formSubmissionSuccess.
Using this Trigger would then fire a Tag when
the form is successfully submitted.
-->