javascriptCopy codedocument.addEventListener('wpcf7mailsent', function(event) {
// Get field values by field ID, replace 'your_field_id' with actual field IDs
var field1 = document.querySelector('#wpforms-5').value;
var field2 = document.querySelector('#wpforms-10').value;
var field3 = document.querySelector('#wpforms-1').value;
// Push the data to the data layer
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'wpFormSubmit',
'formData': {
'field1': field1,
'field2': field2
'field3': field3
}
});
});Call Us Now! (973) 845-5200