Gravity Forms is the form plugin I find on most serious WordPress lead-gen sites: law firms, clinics, B2B services. It’s also where I find the most creative broken tracking. I’ve seen click triggers on the submit button, thank-you page triggers on forms that don’t have thank-you pages, and once a tag that fired on every page containing the word “thanks”.
There’s a clean way, and it uses Gravity Forms’ own events.
Why the usual triggers fail
Most Gravity Forms are set to submit with AJAX, so the page doesn’t reload. GTM’s Form Submission trigger can’t see a successful submit, and a click trigger can’t tell a valid submission from one that bounced back with “This field is required”.
Gravity Forms fires a jQuery event, gform_confirmation_loaded, the moment the confirmation message appears. That only happens after a valid, saved entry.
The listener
<script>
(function () {
if (window.__analyticsrush_gf || !window.jQuery) return;
window.__analyticsrush_gf = true;
jQuery(document).on('gform_confirmation_loaded', function (e, formId) {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'gravity_form_submit',
form_id: formId
});
});
})();
</script>
WordPress loads jQuery by default, and Gravity Forms needs it anyway. If jQuery isn’t on the page, the listener simply does nothing.
Set it up in GTM
- Check the form setting first. In Gravity Forms, open the form’s embed (block or shortcode) and make sure AJAX is on. Without AJAX, use a confirmation page URL trigger instead.
- Custom HTML tag with the listener, fired on DOM Ready.
- Data Layer Variable:
form_id. - Custom Event trigger:
gravity_form_submit. - GA4 event tag:
generate_leadwithform_id, fired on that trigger. Add a trigger condition likeform_idequals3if you only want one form to count as a lead. - Preview, submit a real entry, and confirm one
gravity_form_submitwith the right ID.
Mistakes to avoid
- Non-AJAX forms. If the page reloads on submit, this event never fires. Either turn AJAX on or track the confirmation page.
- Redirect confirmations. If the confirmation is set to redirect to another URL, the message never loads. Track the redirect page instead, or switch to a text confirmation.
- Counting the newsletter box as a lead. Every Gravity form fires the same event. Filter on
form_idso your footer signup doesn’t inflate lead numbers. - Multi-page forms counted at step 1. They’re not; the event waits for the final submit. If you want step data, see below.
What I usually see
On multi-step quote forms, the big insight isn’t the submit count, it’s the drop-off. Clients often assume people abandon on the contact details step. Very often it’s the step that asks for budget.
Go further
The AnalyticsRush library includes two more Gravity Forms listeners: gravity_form_step (fires on each page of a multi-page form, from gform_page_loaded) and gravity_form_error (pushes which fields failed validation). Together they show exactly where your form loses people.
Bottom line
Listen for gform_confirmation_loaded, filter by form ID, and you have lead tracking you can trust.
Need this sent server-side to Meta CAPI and Google Ads Enhanced Conversions? AnalyticsRush builds it on Stape. Book a tracking audit.