You’re miss reading what I wrote.
I will simply just provide an example as I believe it will make far more sense.
The firm I work for has 20 Lawyers. Each Lawyer has their own contact form as the recipients differ form Lawyer to Lawyer. Now in the older itterations of CF7 I was able to use the ON sent OK and submit something which looked like this:
on_sent_ok: “ga( ‘send’, ‘event’, ‘Contact Form’, ‘submit’, ‘Contact Form-LawyerName’, ‘1’ );”
This then allowed me to track WHICH lawyer had the form submission and also allowed us as a firm to see groupings of our lawyers who were being contacted. Now fast forward to today.
The code I have added per your site is the following. Adding this to the bottom of functions.php:
//CF7 Forms & DOM
add_action( 'wp_footer', 'hgrgp_cf7_DOM_formtrack_footer' );
function hgrgp_cf7_DOM_formtrack_footer() {
?>
<script type="text/javascript">
document.addEventListener( 'wpcf7mailsent', function( event ) {
//Lawyer 1 Contact Form
if ( '####' == event.detail.contactFormId ) {
ga( 'send', 'event', 'Contact Form', 'submit', 'Lawyer1-Contact', '1' );
}
//Lawyer 2 Contact Form
elseif ( '####' == event.detail.contactFormId ) {
ga( 'send', 'event', 'Contact Form', 'submit', 'Lawyer2-Contact', '1' );
}
//Lawyer 3 Contact Form
elseif ( '####' == event.detail.contactFormId ) {
ga( 'send', 'event', 'Contact Form', 'submit', 'Lawyer 3-Contact', '1' );
}
//Lawyer 4 Contact Form
elseif ( '####' == event.detail.contactFormId ) {
ga( 'send', 'event', 'Contact Form', 'submit', 'Lawyer 4-Contact', '1' );
}
}, false );
</script>
<?php
}
The ####’s above are the contact forms which correlate to each lawyer. Now when I go into my GA I do not see any detail past the Event Action. Everything else is showing as not set.
You will also note that what I am attempting here has ZERO GPDR implications as the information which is being passed along is internal and organizational data and is not attempting to track the submitter of the form.