Contact Form 7 is one of the most popular plugins for WordPress & the best part of this plugin is – it can easily be tracked in Google Analytics through Google Tag Manager. The best part of this plugin is you don’t need to create a thank you page for this & Google Analytics has no issues with it.
To set up the tracking, we would be required to:
- Contact Form 7 plugin installed on your WordPress
- Google Analytics Installed on your WordPress
- Google Tag Manager installed on your WordPress
STEP 1: Create a GTM tag for the Form Submission Event
Contact Form 7 Form Event submission means when you hit the form “Submit” button, an event fires which actually shows that your form has been submitted & the mail has been sent.
When someone submits the form, the Contact Form 7 plugin fires the DOM Events for several events which determine if the form has been submitted successfully or not. These DOM Events are:
- wpcf7invalid — Fires when form submission has been completed successfully, but mail hasn’t been sent because there are fields with invalid input.
- wpcf7spam — Fires when form submission has been completed successfully, but mail hasn’t been sent because a possible spam activity has been detected.
- wpcf7mailsent — Fires when form submission has been completed successfully, and mail has been sent.
- wpcf7mailfailed — Fires when form submission has been completed successfully, but it has failed in sending mail.
- wpcf7submit — Fires when form submission has been completed successfully, regardless of other incidents.
Since the wpcf7mailsent is that DOM Event which fires on form submission & mail sent successfully. We will create tags & triggers for this.
To create this tag:
- Go to Google Tag manager
- Click Tags on the left menu bar
- Click New on the dashboard
- Name this tag wpcf7mailsent, or what you feel is convenient.
- Click on Tag Configuration & Choose Custom HTML
Now, add the following code:
<script>
document.addEventListener( 'wpcf7mailsent', function( event ) {
dataLayer.push({
'event' : 'wpcf7successfulsubmit',
'CF7formID' : event.detail.contactFormId
});
}, false );
</script>
- Fire this tag to the All Pages –Page View trigger
- Save this tag
STEP 2: Create a GTM Trigger for Above Tag
- Go to Google Tag manager
- Click Triggers on the left menu bar
- Click on New &name it as per your convenience (I have used the name: Contact Form 7 Trigger)
- Click on Trigger Configuration & choose Custom Event
- Add event name wpcf7successfulsubmit
- Fire this trigger on All Custom Events
- Save this trigger
STEP 3: Create a Tag for Form Submission
- Go to Google Tag manager
- Click Tags on the left menu bar
- Click New on the dashboard
- Name this tag Contact Form Submission, or what you feel convenient
- Click on Tag Configuration & Choose Google Analytics: GA4 Event.
- Add the Event Name: Content_Form_Submission (This name will be used in Google Analytics 4 as a parameter)
- Action – successful-form-submission-mailsent
- Label – Enter Form ID, as mentioned in the Next step: 4.
- Non-Interaction Hit, choose the default value False
- Google Analytics Settings, choose you Google Analytics Settings
- Now, fire this tag on Contact Form 7 Triggerwhich we created in the previous step
STEP 4: Setting up the Conversion in Google Analytics 4
Now as the final step, you need to set a conversions for you successful form submission in Google Analytics 4.
To create the conversions, follow the below steps:
- Login to your Google Analytics account
- Navigate to Admin > View > Conversions. Click +New Conversion Event.
- once you create it, don’t forget to test it multiple times using Google Tag Manager & Google ANalytics 7 debug mode.
So, this is the procedure which you need to follow when you create a conversion for Contact Form 7 through in Google Analytics 4 using Google Tag Manager.
Hope this you find this blog helpful. If you are having any issues while setting up conversion with the above procedure, just comment below & we will help you out.
If you need any assistance in your SEO campaign, you can hire us.
Need any help or assistance on Google Analytics 4?
Contact Form 7 Conversion Tracking FAQs
If you have Contact Form 7 in Google Analytics plugin installed on your WordPress then you need to set up tags triggers using Google tag manager. This is a simple process.
Contact form 7 configuration in analytics required to google analytics event tracking which is done using Google Tag manager data layers. Once you are done with contact form 7 setup on WordPress, follow the steps mentioned in this blog to track Contact Form 7 submission.
Contact Form 7 Plugin is a free WordPress plugin to create forms with simple HTML markup.
To use Contact Form 7, you need to install it to your WordPress & start creating forms. You can simply put the forms on any page using shortcodes.
Related Articles
How to Setup Google Ads Conversion Tracking in BigCommerce (With Order Amount & Order ID)
How to Setup Enhanced Ecommerce Tracking to WooCommerce
How to Setup Ninja Forms Event Tracking with Google Tag Manager
The Use of Artificial Intelligence (AI) in SEO – All You Need To Know
I always like your blogs. Thanks Sumit.
Thanks Roksana.
This really helped me to setup form tracking for my website. I was struggling with that for a while. Thanks Sumit.
Thanks Johny. Always here to help!
Sumit, you are a rockstar man!
Thanks Sasha.
Nice share, I am fan of your articles.
Thanks Pova!
Hi Sumit, thank you very helpful.
If we have several forms and want to track all uniquely, how would we adapt the triggers, tags or variables to find and fire only for specific form IDs? For example, we tried to update the trigger to “some custom events” and added “C7-formID contains [specific ID]” but am not getting the event to fire. Thoughts?
Hi Nick,
In that case, we need to look around some more variables for separate forms.
If this is still unclear, please feel free to email me at sumit@searchenginemonkey.com. I’ll be happy to help you.
Hi,
Thanks for the guidance,
I was wondering how to do I get the form ID (here is 136), I stuck over there, while other points I followed.
please help me for the same.
ONE MORE THING I WISH TO KNOW.
I want that anywhere a contact form 7 will be submitted in a website, want to get it in Analytics. Do not want to create multiple events in Analytics.
Hi Flora,
Thanks for writing to us.
In the case of tracking multiple forms, you can create page specific triggers for the pages where the forms are added.
If you still feeling any issues, please email me at sumit@searchenginemonkey.com. I’d love to help you further.
Thanks
Configure form tracking options and view reports within your WordPress dashboard way more convenient than using Google Analytics platform by itself.
Thanks Steve.
Hello,
Thank you for this great tutorial.
I do have a question though, is there a way to replace the ID by the name of the form in GA? Instead of having 136 in your case, I would want to have Contact.
I do have several forms and I find it easier to read if it shows the name of the form.
Thanks
Hi Eve,
We cannot change the IDs in forms as it is a third-party plugin, but when we create the tags, we can name them as per our convenience & setup Goals in Google analytics accordingly.
Hope this help, let me know in case of further query & any help. feel free to email us at sumit@searchenginemonkey.com.
Thanks
hi!, I like your writing so a lot! share we keep in touch extra approximately your article on AOL? I require an expert in this area to resolve my problem. Maybe that is you! Taking a look ahead to peer you.
Thanks Marcano.
Its like you read my mind! You seem to know so much about this, like you wrote the book in it or something.