Contact Form 7 Tracking with Google Tag Manager

Zuletzt aktualisiert am: 7. January 2026

The WordPress plugin Contact Form 7 is quick to set up — but if you want to know which submissions actually turn into leads, you need a clean tracking setup. That’s where Google Tag Manager (GTM) comes in. It ensures your form submissions are reliably sent to Google Analytics 4 (GA4), Google Ads, or other marketing tools.

In this guide, we show you step by step:

• how to set up event tracking for Contact Form 7 in GTM,
• which DOM events you can use (e.g., wpcf7mailsent), and
• how to evaluate your data later in GA4 or as Ads conversions.

If you want to manage your marketing channels based on data, functional form tracking is essential. At WEVENTURE, we help companies build exactly these kinds of structures every day — efficiently, measurably, and at scale.

In this Article

Conversion rate optimization through clean tracking

We know from experience: Tracking is one of the most important pillars of lead generation. Book a personal consultation to learn how we use data-driven strategies to get the most out of your marketing.

Why Contact Form 7 tracking is important

Forms are among the most crucial conversion points on a website — especially in B2B and lead generation. If you use Contact Form 7, you’re collecting valuable contacts, but without tracking you never know where these leads actually come from.

Clean form tracking gives you the data you need for campaign management, budget decisions, and conversion optimization. With Google Tag Manager, you can centrally record form submissions and forward them to tools like Google Analytics 4 or Google Ads. This lets you see which channels truly deliver leads — and refine your marketing based on real performance data, from keyword strategy to audience targeting.

When you don’t need Google Tag Manager

In many cases, Google Tag Manager is the easiest way to manage tracking centrally — but it isn’t always necessary. If you use only a few tools or prefer not to rely on Google services, there are alternatives.

One option is to place the tracking code directly in the website — such as the GA4 snippet or a Meta Pixel. This is less flexible but can be perfectly sufficient for small websites or projects without complex tracking needs.

If you want to avoid Google entirely, platforms like Matomo are a strong alternative. Matomo is an independent analytics tool with its own tag manager that you can self-host — giving you full control over your data. Server-side tagging is another option if you want to collect tracking data independently from Google or send it to multiple tools at once.

In short: Google Tag Manager isn’t mandatory — it’s a tool.
If you prefer another infrastructure or want to keep your setup lightweight, you can still implement effective form tracking without GTM.

What you need for Contact Form 7 tracking

Before you start setting everything up, you’ll want to make sure a few fundamentals are in place. Tracking Contact Form 7 via Google Tag Manager (GTM) works smoothly only when all involved tools are correctly implemented and able to process events without issues. Below is an overview of the essential requirements and tools you’ll need.

WordPress with an active Contact Form 7 plugin

The Contact Form 7 (CF7) plugin must be installed and configured on your WordPress site. You can find it in the WordPress plugin directory, and setup usually takes just a few minutes. Create at least one form you want to track — under Forms → Contact Forms you’ll see the form ID, which will later be relevant for Google Tag Manager.

Google Tag Manager (GTM)

Google Tag Manager is your central control hub for tracking. It lets you capture events like form submissions without having to manually edit your website’s code.

You’ll need:

an active GTM container installed on your website,

access to that container (admin or edit rights),

and a basic understanding of tags, triggers, and variables.

GTM ensures that your form submission event lands in the Data Layer and can then be forwarded to tools like GA4 or Google Ads.

Google Analytics 4 (GA4)

To see which form submissions actually occur, you’ll need a GA4 property. This is where events are collected and analyzed. For Contact Form 7 tracking, it’s helpful to set up:

a custom event (e.g., generate_lead or form_submission),

clearly defined parameters (e.g., formID, formName),

and mark this event as a conversion inside GA4.

This allows you to see exactly which forms generate leads in your reports.

Google Ads

If you run paid campaigns, you should also track form submissions as Google Ads conversions. That way, you’re not just measuring clicks but real leads.

You can do this by linking your GA4 event (e.g., generate_lead) with Google Ads and marking it as a conversion there. Your CF7 submissions will then feed directly into campaign optimization.

Testing environment & debugging

Before finalizing your setup, use GTM’s Preview/Debug mode. This allows you to see in real time whether the event fires correctly when a form is submitted.
Alternatively, GA4’s DebugView helps verify whether your event is being received properly.

Tracking setup with WEVENTURE

Book a consultation to learn how we can help you build a clean, scalable tracking setup tailored to your business.

Preparing Contact Form 7 Tracking in Google Tag Manager

Before you can evaluate your first form event in Google Analytics 4 or Google Ads, you need to make sure Google Tag Manager (GTM) correctly detects your form submissions.
To do this, you’ll use Contact Form 7’s built-in DOM events, set up a Data Layer push, and test everything in Debug Mode.

Using Contact Form 7 DOM events in Google Tag Manager

For GTM to know when a form has been submitted, it needs a signal from Contact Form 7.
The plugin fires several DOM events during form interaction that GTM can listen for.

The most important events:

wpcf7mailsent – fires when a form is successfully submitted

wpcf7invalid – fires when inputs are invalid

wpcf7spam – fires when the spam filter triggers

wpcf7mailfailed – fires when sending fails

wpcf7submit – fires on any form submission attempt

For clean conversion tracking, wpcf7mailsent is usually enough, since it only fires on successful submissions.

Setting up an event listener for the Data Layer

To make GTM capture your form event, you need an event listener that listens for wpcf7mailsent and pushes a custom event to the Data Layer. Create a new tag in GTM and give it a descriptive name — we like to call it ContactForm7 Listener.
Contact-Form-7-Screenshot-Event-Listener-1

In Tag Configuration, choose Custom HTML and paste the following snippet.
Set the trigger to All Pages.

<script>
document.addEventListener(‘wpcf7mailsent’, function(event) {
dataLayer.push({
‘event’: ‘wpcf7successfulsubmit’,
‘formID’: event.detail.contactFormId,
‘formName’: event.detail.contactFormName
});
}, false);
</script>
 

 

Screenshot-Event-Listener-2 (1)

Once this tag is published, GTM will detect every successful form submission and push the event to the Data Layer — the foundation for your GA4 or Google Ads conversion tracking.

Testing the event listener in GTM (Debug Mode)

Before moving on, make sure the event fires correctly.

Activate Preview/Debug Mode in GTM and open a page with your form.

Submit the form — in the debug panel, you should see the event wpcf7successfulsubmit.

If you use multiple forms, verify that the correct formID or formName appears in the Data Layer.

If everything shows up as expected, your event listener works — and GTM will reliably detect every successful Contact Form 7 submission.

Creating Variables and Triggers for Contact Form 7

In the next steps, we’ll walk you through additional preparations that are useful — and in many cases necessary — for clean tracking.

Use variables to distinguish between different forms

If your website uses multiple forms, we recommend creating a variable for the formID. Contact Form 7 automatically generates a unique ID for each form in WordPress. You can view these under Forms → Contact Forms at any time.

To send this unique ID through GTM, you’ll need a dedicated variable.
Create a Custom Variable with the type Data Layer Variable.
Give it a clear and meaningful name that reflects its purpose.

 

Even if you currently use only one form, we still recommend implementing the formID from the beginning — it’s minimal effort and keeps your setup scalable.

Create the trigger

The required trigger is a Custom Event. The event name must match the one used in your listener script — in our case: wpcf7successfulsubmit. You can use a different event name if you prefer, as long as it’s consistent.

Instead of triggering on All Custom Events, you can choose Some Custom Events and use your newly created variable (e.g., DataLayer – CF7formID) to track only a specific form.

Pro tip for managing multiple triggers

If you’re working with Some Custom Events, name your trigger in a way that makes it immediately clear which form it belongs to.
For example, include:

  • the form name, or
  • the page where it fires.

This helps keep your workspace organized — especially when tracking several forms across the site.

Event Tracking with Google Analytics 4 in Google Tag Manager

Once your event listener is working, you can pass the collected form events from Google Tag Manager (GTM) to Google Analytics 4 (GA4). This allows you to see in your Analytics reports how many forms were actually submitted and which channels your leads are coming from.

Create a GA4 event in Google Tag Manager

Go to your GTM container and create a new tag of the type “Google Analytics: GA4 Event.”
Select your existing GA4 configuration tag (e.g., GA4 – Configuration).

Under Event Name, enter a clear identifier, such as:

form_submission

In the Event Parameters section, you can send additional information, for example:

  • formID → {{formID}} (variable from the data layer)

  • formName → {{formName}}

These parameters help you analyze different forms or pages more precisely later on.

As the trigger, select the Custom Event Trigger that detects your previously created event in the data layer — in this case, wpcf7successfulsubmit. This ensures that the GA4 event fires every time a form is successfully submitted.

Make sure your event and parameter names align with Google’s recommended event structure. Ideally, follow Google’s naming conventions and register your parameters as Custom Dimensions in GA4.

Recommended GA4 events

EventTrigger when a user…
ad_impressionviews an ad (app only)
earn_virtual_currencyreceives virtual currency such as coins, gems, or tokens
generate_leadsubmits a form or request for information
join_groupjoins a group
loginsigns in
purchasemakes a purchase
refundreceives a refund
searchsearches on your website or app
select_contentselects content on your website or app
shareshares content from your site or app
sign_upregisters for an account
spend_virtual_currencyspends virtual currency
tutorial_beginstarts an onboarding tutorial
tutorial_completecompletes an onboarding tutorial

Marking the event as a conversion in GA4

After publishing your tag in GTM, you can mark the event as a conversion in GA4. Open your GA4 property and go to Admin → Events. Your event generate_lead will appear once it fires for the first time. Toggle the Mark as conversion switch — this ensures that form submissions are included in your reports and conversion tracking.

Analyzing form tracking in reports

Once data begins to flow in, you’ll find your events in GA4 under
Reports → Engagement → Events.

Here you can see:

how often your form was submitted,

on which pages submissions occurred,

and which channels generated the leads.

If you pass additional parameters (e.g., form name or page path), you’ll gain deeper insights into how your forms perform — providing a strong foundation for data-driven marketing and optimized campaigns.

Conversion Tracking for Contact Form 7 in Google Ads with Google Tag Manager

If you’re generating leads through Google Ads, you should absolutely track your Contact Form 7 (CF7) submissions as conversions. Google Tag Manager (GTM) plays a central role in this setup: it detects successful form submissions and sends them to Google Analytics 4 (GA4) — and from there to Google Ads.

Linking GA4 Events with Google Ads

To evaluate your form submissions as conversions in Google Ads, import the corresponding GA4 event:

Open in Google Ads:
Tools & Settings → Measurement → Conversions

Click New Conversion Action → Import

Select Google Analytics 4 Property → Web

Google Ads will now show all GA4 events that are marked as conversions — including your event form_submission.

Select the event and confirm the connection.

From this point on, GA4 automatically sends all successful form submissions to Google Ads. The platform uses this data to optimise bids, audiences, and overall campaign performance — based on real leads instead of just clicks.

Alternative: Direct Contact Form 7 Conversion Tag in GTM

If you prefer not to use GA4 as an intermediary, you can track conversions directly in Google Ads using GTM.

Here’s how:

Create a new Google Ads Conversion Tracking Tag in GTM.

Add your Conversion ID and Conversion Label from Google Ads.

Set the trigger to your custom event wpcf7successfulsubmit, which fires when a CF7 form is successfully submitted.

With this setup, every Contact Form 7 submission is sent directly to Google Ads as a conversion — ideal for accurate lead tracking without additional layers.

We boost your digital visibility!

With expertise and experience, our SEA specialists help your business achieve real results. Get your free consultation today!

Conclusion: Tracking Contact Form 7 successfully with Google Tag Manager

Reliable form tracking is essential for making informed marketing decisions. With Google Tag Manager (GTM), your Contact Form 7 forms become a dependable data source — whether you’re working with Google Analytics 4, Google Ads, or other tools.

Once you’ve completed the following steps, your tracking setup is fully operational:

✅ The event listener in GTM responds to wpcf7mailsent.
✅ The data layer push correctly sends formID and formName.
✅ Both values are implemented as variables inside GTM.
✅ The GA4 event generate_lead fires on successful form submissions.
✅ The event is marked as a conversion in GA4.
✅ The conversion is imported into Google Ads or tracked via a dedicated Ads tag.
✅ Live testing confirms: events fire reliably with no false triggers.

With everything in place, you can clearly see which campaigns generate real leads — and you can optimise your marketing strategies based on accurate data.

A clean GTM setup saves time, keeps your tracking organised, and lays the foundation for advanced configurations such as server-side tagging or enhanced conversions.

In short: Your Contact Form 7 form no longer just collects requests — it delivers valuable insights for your entire performance marketing strategy.

FAQs: Tracking CF7 with Google Tag Manager

How can I track Contact Form 7 with Google Tag Manager?

In Google Tag Manager, you set up an event listener that detects the wpcf7mailsent DOM event. This event is pushed into the data layer and passed on as a custom event to Google Analytics 4 or Google Ads.

Author

Picture of Lara Hötzsch

Lara Hötzsch

As Senior SEO & AdTech Manager at WEVENTURE, Lara is responsible for increasing organic performance and implementing data-driven strategies. Her focus is on website tracking, data analysis, and the development of sustainable SEO and AdTech solutions.

Further articles