Track Contact Form 7 Submissions in Google Tag Manager with this Free GTM Recipe
A free, tested Google Tag Manager recipe that captures Contact Form 7 submissions and turns them into a trigger you can use to fire conversions to Google Ads, Google Analytics and more.


Google Tag Manager is a common way to send conversions to Google Ads, Google Analytics, etc after someone submits a Contact Form 7 form on their website.
The trouble is, it's fiddlier than it looks.
Contact Form 7 submits over AJAX, so Google Tag Manager's built-in form submission trigger never sees it, which leaves you writing custom code to catch the submission, push an event to the dataLayer, and wire a trigger on top of that.,And unless you can write code or know Google Tag Manager inside out, that's a real slog.
The good news is there's an easier way. Just import this Contact Form 7 Conversion Tracking Recipe into your Google Tag Manager account and everything you need for basic conversion tracking is already in place.
What Is a Google Tag Manager Recipe and What's in It?
A recipe is a pre-built bundle of Google Tag Manager assets (a tag, a trigger and a variable) that you import in one go instead of building each piece yourself. You can see all our recipes and how they work in the GTM recipe library.
This recipe listens for Contact Form 7 submissions, sends a 'Form Submitted' event to Google Tag Manager, and gives you a Trigger for sending conversions to Google Analytics, Google Ads, etc. There are three parts to it, and nothing inside is hidden. Here's exactly what each piece contains, so you can see what you're importing before you import it.
Custom HTML Tag
Watches for a successful Contact Form 7 submission and pushes a 'contact_form_7_submitted' event to the dataLayer. It fires on All Pages, once per event, and this is the code inside it.
(function () {
if (window.__converlyRecipeContactForm7) return;
window.__converlyRecipeContactForm7 = true;
window.dataLayer = window.dataLayer || [];
function fireConversion(formEl) {
// Modern Contact Form 7 (verified against 6.1.6 on a live site) puts
// data-wpcf7-id on the WRAPPING <div class="wpcf7">, not on the <form>
// element itself. Check the form first (older/other CF7 setups may
// still stamp it there) and fall back to the wrapper.
var formId = '';
try {
if (formEl && formEl.getAttribute) {
formId = formEl.getAttribute('data-wpcf7-id') || '';
}
if (!formId && formEl && formEl.closest) {
var wrap = formEl.closest('.wpcf7');
if (wrap && wrap.getAttribute) {
formId = wrap.getAttribute('data-wpcf7-id') || '';
}
}
} catch (e) {
// .closest unsupported in very old browsers — non-fatal, form_id stays ''
}
window.dataLayer.push({
event: 'contact_form_7_submitted',
form_id: formId
});
}
// Fire path — Contact Form 7's own native DOM CustomEvent, dispatched on
// the <form> element once an AJAX submission passes CF7's server-side
// validation and spam checks, then bubbles to document. This is the ONLY
// path this recipe tracks; a legacy non-AJAX (full page reload) CF7 setup
// never dispatches this event at all — CF7 itself provides no client-side
// success signal in that mode either (the real module only logs a
// warning for it, it never fires a conversion).
document.addEventListener('wpcf7mailsent', function (event) {
var formEl = event && event.target;
if (!formEl || (formEl.tagName || '').toLowerCase() !== 'form') return;
fireConversion(formEl);
}, false);
})();Variable
Reads the ID of the form that was submitted, ready to use in any tag. These are its exact settings.
Name
DLV - Contact Form 7 ID
Variable Type
Data Layer Variable
Data Layer Variable Name
form_id
Trigger
Fires when the 'contact_form_7_submitted' event is received. Use it as the trigger for any conversion tag. These are its exact settings.
Name
CE - Contact Form 7 Submitted
Trigger Type
Custom Event
Event Name
contact_form_7_submitted
Download This Recipe
Get the ready-to-import file and upload it into Google Tag Manager. Everything shown above (the tag, the variable and the trigger) comes pre-built inside.
Built from Converly's own Contact Form 7 detection code
Why It's the Best Recipe Out There
It comes from the same detection code that powers our own conversion tracking product, Converly, but adapted to run inside Google Tag Manager.
How to Use the Contact Form 7 GTM Recipe
Install the Recipe
Download the recipe from the form above, then import it into your Google Tag Manager container. Inside GTM, open Admin, pick Import Container, choose the file you saved, and select Merge so nothing already in your container gets overwritten. The tag, variable and trigger are set up for you automatically.

Configure Your Tags
Once the recipe is installed, you'll get a Trigger you can use to fire your conversion tags. Here are two common examples.
Example 1: Google Analytics
In Google Tag Manager, open Tags and click New. Choose "Google Analytics: GA4 Event" as the tag type, enter your GA4 configuration tag (or enter your Measurement ID), and name the event something like generate_lead. Set its firing trigger to the recipe's trigger (which is named CE - Contact Form 7 Submitted), and click save. Every Contact Form 7 submission now sends that event to Google Analytics.

Example 2: Google Ads
First, set up a conversion action in your Google Ads account (under Goals, then Conversions) to get a Conversion ID and Conversion Label. Back in Google Tag Manager, add a new "Google Ads Conversion Tracking" tag, drop in those two values, and set its firing trigger to 'CE - Contact Form 7 Submitted'. Save and publish, and each Contact Form 7 submission will send a conversion to Google Ads.

What This Enables You to Do (and What It Doesn't)
Whenever a successful Contact Form 7 submission is detected, this recipe fires an event in Google Tag Manager that you can trigger conversions from. But there are a few things it can't do:
What it does
Sends an Event to GTM
Detects successful Contact Form 7 submissions and pushes an event called 'contact_form_7_submitted' into your dataLayer on its own.
Tells You Which Form Fired
Captures the ID of the form that was submitted and sends it along with the 'contact_form_7_submitted' event, so a site with several forms can fire different tags for each one.
Creates a Trigger in GTM
Gives you a 'Trigger' in Google Tag Manager you can attach to any of your conversion tags.
What it doesn't do
Doesn't send the conversion server-side
Google Tag Manager runs entirely in the visitor's browser, so an ad blocker can block the tag from loading and browser privacy settings can shrink your tracking window to as little as a day.
Doesn't send Click IDs or Identifiers
It doesn't collect the Google click ID, Facebook click ID, Meta pixel cookies, IP address or user agent. These are the details ad platforms need for Enhanced Conversions (Google) or a solid Event Match Quality score (Meta).
Doesn't send personal details
The script fires an event and nothing more. It doesn't pass the lead's name, email or phone number, which Google and Meta both need for enhanced conversions and a high match score.
Doesn't log conversions or send notifications
You can check it with Tag Assistant when you set it up, but after that there's nothing to tell you if it breaks (you'll just later notice that conversions have stopped appearing in your ad accounts)
The Proper Way to Send Conversions to Google Ads, Meta Ads & More
If you're only sending events to Google Analytics, which takes no personal information or IP addresses, this recipe has you covered. But the moment you want a solid Event Match Quality (EMQ) score in Meta or Enhanced Conversions in Google, the data has to go server-side, together with the lead's name and email. That's where Converly comes in.

So here's what makes Converly the best way to send conversions to Google Ads, Meta Ads, Microsoft Ads, LinkedIn Ads, etc.
Easy to set up
Converly gives you a simple drag-and-drop builder for creating a Conversion Flow. Choose a trigger (a Contact Form 7 submission) and then choose your actions (like sending a conversion to Google Ads). No custom code, no fiddly configuration.
Sends Data Server-Side
Converly delivers conversions straight to the ad servers of Google, Meta and the rest, so ad blockers and privacy restrictions have nothing to block.
Sends More Data
It collects the lead's name, email and phone alongside the Google and Facebook click IDs, IP address and user agent, and sends the lot with every conversion. That enables Enhanced Conversions in Google Ads and earns you an Event Match Quality (EMQ) score of 9 or 10 in Meta.
Full Conversion Log & Email Notifications
See every conversion, what was captured, what went to each platform and whether it arrived. Set up email alerts to let you know if anything goes wrong so you'll be the first to know if your conversion tracking breaks.
Supports Multiple Tools & Destinations
Converly listens for submissions from 80+ form, scheduling and chat tools and delivers to 20+ destinations including Google Ads, Meta, LinkedIn, Microsoft and TikTok. So whenever you add a new tool or start advertising on a new platform, it's only a few clicks to get covnersiont racking set up.
Provides Free Support
Our team has 20 years of experience in conversion tracking and analytics and is ready to help whenever you need it. With tools like Google Tag Manager, you're on your own.
Start Your Free Trial
Start a 14-day free trial and track your conversions the proper way. No code, no complicated configuration.
About the author

Aaron is the founder of Converly. With over 15 years of experience in digital marketing and SaaS, he's passionate about helping businesses track and optimise their ad conversions.
