How to Track Contact Form 7 Conversions in GA4 with Google Tag Manager

CF7 Form Submission

If your website runs on WordPress and you use Contact Form 7 to collect enquiries, tracking those form submissions in Google Analytics 4 is one of the most important things you can do as a service business. It tells you how many leads your site is generating, where those people came from, and which pages or campaigns are actually driving results.

The problem is that Contact Form 7 works a little differently to other form plugins, which means the standard tracking approach does not apply. This guide walks you through exactly how to get it set up using Google Tag Manager.

Before You Start

This guide assumes you already have Google Tag Manager and GA4 installed and firing correctly on your website. If you have not done that yet, watch this video first which walks you through how to get both platforms set up and connected, then come back and follow along here.

One important thing to confirm before you dive in: this method only works if your Contact Form 7 does not reload the page after submission. When someone submits the form, a success message should appear on the same page without any redirect. If your form sends people to a separate thank you page, this particular setup will not apply.

Video Tutorial

Why Contact Form 7 Needs a Different Approach

When someone visits a new page on your website, Google Tag Manager picks that up automatically and can track it. Contact Form 7 works differently though. When a visitor hits submit on the form, the page stays exactly where it is. A success message just appears. No page reload, no new URL, nothing that GTM would normally notice.

So GTM has no idea anything happened unless you tell it to watch for it.

That is where the listener comes in. It is a small piece of JavaScript that you add to your website through GTM. It sits quietly in the background and watches for the moment a form is submitted successfully. When it detects that, it sends a signal to Google Tag Manager saying a form was just submitted, along with some basic details like which form it was. GTM then picks that up and sends it through to GA4 as a conversion.

Think of it like a motion sensor. Nothing happens until it detects something. The moment it does, it triggers the alarm and GTM springs into action.

Step 1: Create the Contact Form 7 Listener Tag in GTM

Head into your Google Tag Manager account and go to Tags. Create a new tag and name it something easy to recognise like Contact Form 7 Listener Tag.

For the tag type, select Custom HTML.

Paste the following code into the Custom HTML field:

<script>
document.addEventListener( 'wpcf7mailsent', function( event ) {
  window.dataLayer.push({
    "event" : "cf7submission",
    "formId" : event.detail.contactFormId,
    "response" : event.detail.inputs
  })
}); 
</script>

Do not worry too much about understanding every line in there. Just make sure you copy it exactly as it is. What this code does is watch for the moment a form is submitted successfully. When it detects that, it sends a signal to Google Tag Manager saying a form was just submitted, along with some basic details like which form it was. GTM then picks that up and sends it through to GA4 as a conversion.

For the trigger, set this tag to fire on All Pages. This is important because the listener needs to be loaded and ready before someone can submit the form. If it only fires on certain pages and your form appears somewhere unexpected, you will miss submissions.

Save the tag once that is done.

Step 2: Test the Listener Tag

Before moving on, you want to confirm the listener is actually working.

Click Preview in the top right corner of Google Tag Manager. Enter the URL of the page where your Contact Form 7 lives and click Connect. This opens your website in a new tab with Tag Assistant running in the background.

First, try submitting the form without filling in the required fields. The listener should not fire for an incomplete submission. If it does, something is off and you will end up with inaccurate data.

Now fill the form out properly with some dummy details and hit submit. When the success message appears on the page, head back to Tag Assistant.

On the left side you should see a new event called cf7submission. If it is there, the listener is doing its job and data is being pushed into the Data Layer correctly. Click on it to confirm the event name, because you will need to match it exactly in the next step.

If the cf7submission event does not appear at all, the two most likely reasons are that your form is actually using a different plugin (not Contact Form 7), or the form is redirecting to a thank you page after submission. You can check which plugin your form uses by right-clicking a form field and inspecting the code. If you see something containing wpcf7 in there, it is Contact Form 7.

Step 3: Create a Custom Event Trigger

Now you need a trigger that fires whenever the cf7submission event shows up in the Data Layer.

Go to Triggers in GTM and click New. Click Trigger Configuration and choose Custom Event from the list.

In the Event Name field, type cf7submission exactly as it appeared in Tag Assistant. This field is case sensitive, so it needs to match perfectly.

Name the trigger Custom – cf7submission and save it.

Step 4: Create the GA4 Event Tag

Now you need the tag that actually sends the submission data through to Google Analytics 4.

Go to Tags and click New. Click Tag Configuration and select Google Analytics: GA4 Event from the list.

For the Measurement ID, head into your GA4 account and grab it from Admin, then Data Streams. It starts with a G followed by a dash and a string of characters. Paste that into the Measurement ID field.

For the Event Name, type form_submission. Keep it lowercase with underscores to stay consistent with how GA4 handles event names.

Scroll down to the Triggering section and select the Custom – cf7submission trigger you just created.

Name the tag GA4 Event – form_submission and save it.

Step 5: Test the Full Setup End to End

Head back into GTM and click Preview again. Connect to your website, fill out the Contact Form 7 with dummy details and submit it.

Go back to Tag Assistant and click on the cf7submission event. This time you should see both the Contact Form 7 Listener Tag and the GA4 Event tag listed as fired. If both are showing as fired, you are in good shape.

Now head into Google Analytics 4 and go to Admin, then Data Display, then Debug View. You should see the form_submission event appear in the event stream. If it does not show up straight away, give it a minute or two as there can be a slight delay.

Once you can see it in Debug View, everything is connected and working end to end.

Step 6: Publish Your GTM Container

Once you are happy everything is working correctly in preview, go back to GTM and hit Submit to publish your changes.

Give the version a name like CF7 Conversion Tracking so you can refer back to it later, then publish.

From this point on, every time someone fills out your Contact Form 7, it will be tracked as an event in GA4.

Step 7: Mark the Event as a Key Event in GA4

The last step is to make sure GA4 treats form submissions as conversions so the data actually shows up in your reporting.

Go to Admin, then Data Display, then Events inside GA4. The form_submission event can take up to 24 hours to appear in this list after your first test submission, so check back the following day if it is not there yet.

Once it appears, click the toggle next to the event to mark it as a Key Event. This tells GA4 that this action is significant, and it will now be reported on as a conversion across your account.

If you are running Google Ads, you can also import this Key Event directly into your Google Ads account as a conversion action. That means you will be able to see exactly which campaigns and keywords are driving form submissions on your site, which makes a real difference when it comes to getting the most out of your ad budget.

You Are All Set

That is the full setup. Once everything is in place, every Contact Form 7 submission on your website will be tracked through to GA4, giving you a clear picture of how many leads your site is generating and where they are coming from.

If you want to follow along visually, the video at the top of this page walks through every step. Make sure you subscribe to the channel for more tutorials like this one.