Forminator Form is a powerful and popular form builder for WordPress. Today, I will share a step-by-step guide to tracking Forminator with Google Tag Manager. In this comprehensive tutorial, I will detail how to track Forminator forms so that you can monitor them with GA4. Additionally, I will provide code that captures user-inputted values, such as email addresses, phone numbers, names, etc., to enhance conversion tracking.
Forminator Form Tracking Code
<script>
/**
* Author: Md Hasanuzzamna
* Linkedin: https://linkedin.com/in/md-h
* Youtube: https://youtube.com/@leomeasure
* Email: info@leomeasure.com
*/
(function() {
function formDataToObject(formData) {
var object = {};
formData.forEach(function(value, key) {
object[key] = value;
});
return object;
}
jQuery(document).on('forminator:form:submit:success', function (e, formData) {
var formDataObject = formDataToObject(formData);
window.dataLayer = window.dataLayer || [];
dataLayer.push({
event: 'forminator_form_submit',
form_id: formDataObject.form_id,
inputs: formDataObject
});
});
})();
</script>