Gravity Forms is the most common form plugin I find on WordPress sites for lead generation businesses, and the most common tracking setup I find with it is a thank-you page that anyone can open directly, or a button click trigger that counts failed submissions.
Gravity Forms gives you a cleaner option. When a form is embedded with AJAX enabled, it fires a gform_confirmation_loaded event after a successful submission, with the form ID attached. This guide shows how to use that event in Google Tag Manager, plus a fallback for forms without AJAX.
Two Ways Gravity Forms Confirms a Submission
- Text confirmation with AJAX on: the page does not reload, a confirmation message replaces the form, and
gform_confirmation_loadedfires. This is the best case for tracking. - Redirect or page confirmation: the browser navigates to another page. No event fires on the original page, so you track the destination page view.
Check which one your form uses under Form Settings, then Confirmations, and check whether AJAX is enabled in the block or shortcode.
Method 1: The Confirmation Event
Step 1: Capture the email before submission
Add a Custom HTML tag named Listener - Gravity Forms firing on All Pages:
<script>
(function () {
if (!window.jQuery) { return; }
var lastEmail = '';
var lastPhone = '';
jQuery(document).on('submit', 'form[id^="gform_"]', function () {
var email = this.querySelector('input[type="email"]');
var phone = this.querySelector('input[type="tel"]');
lastEmail = email ? email.value.trim().toLowerCase() : '';
lastPhone = phone ? phone.value.trim() : '';
});
jQuery(document).on('gform_confirmation_loaded', function (event, formId) {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'form_submit_success',
form_tool: 'gravity_forms',
form_id: String(formId),
user_email: lastEmail || undefined,
user_phone: lastPhone || undefined
});
});
})();
</script>
The first handler stores the email and phone at the moment of submission, because the form fields are removed from the page by the time the confirmation loads. The second handler pushes the success event with the form ID.
Step 2: Variables and trigger
Create Data Layer Variables for form_id, user_email and user_phone. Create a Custom Event trigger for form_submit_success. To track a single form, add a condition where form_id equals that form's numeric ID, visible in the Gravity Forms admin list.
Step 3: Tags
- GA4 Event: event name
generate_lead, parameterform_id. Mark it as a key event in GA4. - Google Ads Conversion: your conversion ID and label, with a Conversion Linker on All Pages. For Enhanced Conversions, create a User-Provided Data variable from the email and phone variables and attach it to the tag.
- Meta Lead: fire the Lead event with advanced matching, and deduplicate with the Conversions API using a shared event ID if you run server-side.
Method 2: Thank-You Page Fallback
If your form redirects:
- Create a Page View trigger where Page Path equals the thank-you page path.
- Fire the same GA4, Google Ads and Meta tags on it.
- Add a
noindextag to the thank-you page and remove it from the sitemap and navigation. - For Enhanced Conversions, pass the email through the redirect as a query parameter from Gravity Forms confirmation settings, read it with a URL variable, and clear it from the URL with a history replace afterwards. If that feels like too much exposure, skip Enhanced Conversions on this form.
The redirect method cannot stop someone from opening the thank-you URL directly, which is why Method 1 is preferred.
Testing
- In GTM Preview, submit the form. Confirm
form_submit_successappears with the correctform_id, and that email and phone are populated if you captured them. - Confirm each tag fired exactly once.
- Inspect the outgoing Google Ads request with a tag debugger such as the Insighter Debugger extension and confirm the hashed user data is present.
- Submit the form with a validation error. Nothing should fire.
- For multi-page forms, move through the pages. Nothing should fire until the final submission.
Common Problems
- Event does not fire: AJAX is disabled on the embed. Enable it, or switch to Method 2.
- Fires on every page of a multi-page form: you are using the generic GTM form trigger. Remove it.
- Email is empty: the submit handler did not run, usually because a different plugin intercepts the submit. Use the
gform_pre_submissionhook in a small WordPress snippet to push the email instead. - Double conversions: both methods are live at once. Keep one.
Summary
Use the gform_confirmation_loaded event with AJAX forms, capture the contact fields on submit, and fire GA4, Google Ads and Meta from one dataLayer event. It takes 15 minutes and removes every false conversion a thank-you page or button click would have counted.
