Contact Form 7 Tracking with GTM

Step 1:

Create Tag (custom html - copy the follow code in it) -> fire on all pages


Code:

<script> document.addEventListener( 'wpcf7mailsent', function( event ) { dataLayer.push({ 'event' : 'wpcf7successfulsubmit', 'CF7formID' : event.detail.contactFormId }); }, false ); </script>



Step 2:

Fire tag on GA4

Trigger:
Custom Event: wpcf7successfulsubmit

No comments:

Post a Comment