If you’re using Gravity Forms on your website, tracking form submissions as conversions is essential for measuring performance in analytics and ad platforms.
But here’s the issue: Gravity Forms doesn’t automatically send clean events to Google Tag Manager.
In this guide, I’ll show you how to fix that using a simple event listener—so you can fire conversion tags only when a form is successfully submitted.
Why You Need This Setup
By default:
- No dataLayer push on submission
- GTM cannot detect successful submissions reliably
- Conversions may be missed or duplicated
The solution is to listen for Gravity Forms’ built-in event and push it into the dataLayer.
What You’ll Track
With this setup, you’ll be able to:
- Track successful form submissions
- Capture the form ID dynamically
- Fire conversion tags (GA4, Google Ads, Meta, etc.)
- Avoid false triggers
Step 1: Add Gravity Forms Event Listener
Create a Custom HTML Tag in GTM and paste the code below.
Trigger: All Pages or DOM Ready
<script type=”text/javascript”>
jQuery(document).ready(function() {
jQuery(document).bind(“gform_confirmation_loaded”, function(event, formID) {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: “GravityFormSubmit”,
formID: formID
});
});
});
</script>
What This Code Does
1. Listens for Successful Submission
gform_confirmation_loaded
This event fires only when the form is successfully submitted (not just clicked).
2. Pushes a Custom Event to dataLayer
event: “GravityFormSubmit”
This becomes your GTM trigger.
3. Captures the Form ID
formID: formID
Useful if you have multiple forms on your site.
Step 2: Create GTM Trigger
Inside GTM:
- Trigger Type → Custom Event
- Event Name →
formSubmissionSuccess
This ensures your tags fire only on successful submissions.
Step 3: Create Data Layer Variable
Create a variable in GTM:
- Variable Type → Data Layer Variable
- Data Layer Variable Name → formID
Step 4: Send Data to GA4
Create a GA4 Event Tag.
Example Setup:
Event Name:
generate_lead
Event Parameters:
| Parameter | Value |
| form_id | {{formID}} |
Step 5: Use for Advertising Platforms
Now you can fire:
- Google Ads Conversion Tag
- Meta Pixel Lead Event
- TikTok / LinkedIn events
All based on actual successful submissions.
Step 6: Test Your Setup
Use GTM Preview Mode:
- Submit your form
- Look for:
GravityFormSubmit
- Verify:
- formID is captured
- Tags are firing correctly
Pro Tips
Track Multiple Forms Separately
Use trigger conditions like:
formID equals 1
Improve Reporting
Send additional parameters like:
- Page URL
- Form name
Credit
This event listener code was created by Julius Fedorovicius.
