Send form data to Google Tag Manager

My Mautic version is: 4.4.12
My PHP version is: 8.0

My problem is: we want to setup enhanced conversion. To do so we need to send a dataLayer.push to Google Tag Manager after a form is submitted. I’m not sure how to do this?

I think I need to use something like below, but I got no clue what to insert in onResponse: function (response). I want to send the data that contacts insert in the input fieds to Google Tag Manager. For example email, firstname and lastname.

<script> var formName = 'contactformulier'; if (typeof MauticFormCallback == 'undefined') { var MauticFormCallback = {}; } MauticFormCallback[formName] = { onResponse: function (response) { }, }; </script>

Any help is much appreciated.