How to Track Contact Form 7 Submissions with Google Tag Manager and GA4
Missing form submission data costs you money. Without accurate tracking of Contact Form 7 submissions, you can’t optimize your conversion funnel, calculate true cost per lead, or measure the ROI of your traffic sources. This guide shows you how to implement complete Contact Form 7 tracking using Google Tag Manager and GA4, enabling you to measure which marketing channels drive the most valuable leads.
By the end of this tutorial, you’ll have accurate form submission tracking that shows exactly which traffic sources, campaigns, and pages generate leads—critical data for optimizing your marketing budget and reducing customer acquisition costs.
Why Contact Form 7 Tracking Matters for Your Business
Contact forms are conversion points. Every submission represents a potential customer, a lead that required marketing spend to generate. Without tracking:
- You can’t identify which marketing channels drive form submissions
- Google Ads and Facebook campaigns can’t optimize for lead conversions
- You’re blind to which pages convert visitors into leads
- Cost per lead (CPL) calculations are impossible
- A/B testing form variations lacks data
Business Impact:
- Reduce CPL by 20-35% by identifying and scaling high-performing channels
- Improve conversion rates by seeing which page content drives submissions
- Optimize ad spend by feeding conversion data back to ad platforms
- Calculate true ROAS including lead value, not just ecommerce transactions
Contact Form 7 is the most popular WordPress form plugin (5+ million active installations), but it doesn’t automatically send submission events to Google Analytics. Manual implementation via GTM is required.
Prerequisites
Before starting, ensure you have:
- WordPress website with Contact Form 7 plugin installed
- Google Tag Manager container installed on your website
- GA4 property set up and connected to GTM
- GTM Edit access (to create tags and triggers)
- Basic familiarity with GTM interface
Estimated Implementation Time: 15-20 minutes
How Contact Form 7 Tracking Works
Contact Form 7 fires JavaScript events when forms are submitted. We’ll:
1. Configure CF7 to push submission data to the dataLayer
2. Create a GTM trigger that listens for CF7 submission events
3. Build a GA4 event tag that fires on successful submissions
4. Test the implementation
5. Verify data appears in GA4
This method tracks successful submissions only (not spam or failed submissions), ensuring clean conversion data.
Step 1: Enable Contact Form 7 DOM Events
Contact Form 7 fires DOM events on form submission. We need to capture these and push them to GTM’s dataLayer.
Add Custom Code to Your WordPress Theme
Option A: Using a Code Snippets Plugin (Recommended)
1. Install “Code Snippets” plugin from WordPress admin
2. Go to Snippets → Add New
3. Name it: “CF7 GTM Tracking”
4. Paste this code:
add_action('wp_footer', 'cf7_gtm_tracking');
function cf7_gtm_tracking() {
?>
4. Set to run on Frontend only
5. Click Save Changes and Activate
Option B: Add to Theme's functions.php
If you prefer to add directly to your theme (note: updates may overwrite this):
1. Go to Appearance → Theme File Editor
2. Select functions.php
3. Add the same code above at the bottom
4. Click Update File
What This Code Does:
- Listens for Contact Form 7's
wpcf7mailsentevent (fires only on successful submission) - Extracts form ID and submission details
- Pushes structured data to GTM's dataLayer
- Includes form location for analyzing which pages convert best
Step 2: Create a GTM Trigger for Form Submissions
Now we'll configure GTM to listen for the custom event we're pushing.
In Google Tag Manager:
1. Go to Triggers → New
2. Name: "CF7 - Form Submission"
3. Trigger Type: Custom Event
4. Event name: form_submission
5. This trigger fires on: All Custom Events
6. Click Save
Alternative (More Specific):
If you want to track only CF7 forms (useful if you have multiple form types):
1. Create a new Trigger Variable first:
- Variables → New → Data Layer Variable
- Data Layer Variable Name: formType
- Name: "Form Type"
2. In the trigger configuration:
- Set This trigger fires on: Some Custom Events
- Add condition: Form Type equals contact_form_7
Step 3: Create Data Layer Variables (Optional but Recommended)
To capture form details in GA4, create these variables:
1. Variables → New → Data Layer Variable
- Data Layer Variable Name: formId
- Variable Name: "Form ID"
- Click Save
2. Variables → New → Data Layer Variable
- Data Layer Variable Name: formName
- Variable Name: "Form Name"
- Click Save
3. Variables → New → Data Layer Variable
- Data Layer Variable Name: formLocation
- Variable Name: "Form Location"
- Click Save
These variables let you see which specific form was submitted and from which page.
Step 4: Create a GA4 Event Tag
Now we'll send the form submission data to Google Analytics 4.
In Google Tag Manager:
1. Go to Tags → New
2. Name: "GA4 - Contact Form Submission"
3. Tag Type: Google Analytics: GA4 Event
4. Configuration Tag: Select your GA4 Configuration tag
5. Event Name: form_submission
6. Event Parameters (click "Add Row" for each):
- Parameter Name: form_type | Value: {{Form Type}}
- Parameter Name: form_id | Value: {{Form ID}}
- Parameter Name: form_name | Value: {{Form Name}}
- Parameter Name: form_location | Value: {{Form Location}}
7. Triggering: Select "CF7 - Form Submission" trigger
8. Click Save
Why These Parameters Matter:
form_type: Distinguish CF7 from other form pluginsform_id: Track performance of specific formsform_name: Human-readable form identifierform_location: Identify which pages drive conversions
Step 5: Test Your Implementation
Before publishing, verify everything works correctly.
Using GTM Preview Mode:
1. In GTM, click Preview
2. Enter your website URL
3. In a new tab, your website loads with GTM debug panel
4. Navigate to a page with a Contact Form 7
5. Fill out and submit the form
6. In the GTM debug panel, check:
- "form_submission" event appears in the event stream
- Your GA4 tag fires on this event
- Variables populate correctly (Form ID, Form Name, etc.)
Check the Browser Console:
1. Open Developer Tools (F12)
2. Go to Console tab
3. Submit the form
4. Look for: CF7 form submitted: [form ID]
5. Check dataLayer: Type dataLayer in console and press Enter
6. Verify the form_submission object exists with correct data
Expected dataLayer Object:
{
event: "form_submission",
formType: "contact_form_7",
formId: "123",
formName: "cf7-form-123",
formLocation: "/contact/"
}
Step 6: Publish Your GTM Container
Once testing confirms everything works:
1. Click Submit in GTM (top right)
2. Add Version Name: "Added CF7 form tracking"
3. Add Description: "Implemented Contact Form 7 submission tracking for GA4"
4. Click Publish
Step 7: Verify Data in Google Analytics 4
After publishing, verify events reach GA4:
Real-Time Reports:
1. In GA4, go to Reports → Realtime
2. Submit a test form on your website
3. Within 30 seconds, you should see:
- Event count increase under "Event count by Event name"
- "form_submission" event listed
4. Click on the event to see parameters (form_id, form_name, etc.)
DebugView (Recommended):
1. Install Google Analytics Debugger Chrome extension
2. Enable it and refresh your website
3. In GA4, go to Configure → DebugView
4. Submit the form
5. See detailed event data including all parameters
Note: Standard GA4 reports take 24-48 hours to populate. Use Realtime or DebugView for immediate verification.
Step 8: Create Custom Reports and Conversions
Mark Form Submissions as Conversions:
1. In GA4, go to Configure → Events
2. Find form_submission in the event list
3. Toggle Mark as conversion to ON
4. This event now counts as a goal completion
Create Conversion Reports:
1. Go to Reports → Engagement → Conversions
2. See total form submissions by traffic source
3. Click into form_submission for detailed breakdown
Set Up Exploration for Advanced Analysis:
1. Explore → Create new exploration
2. Technique: Free form
3. Dimensions: Add Session source/medium, Page location, Form name
4. Metrics: Add Event count, Conversions
5. Rows: Session source/medium
6. Values: Event count (form_submission)
7. Filters: Event name = form_submission
This shows which traffic sources drive the most form submissions.
Common Pitfalls That Cost You Data
Mistake 1: Not Filtering Out Spam Submissions
Problem: Bots and spam submissions inflate your conversion data, making CPL calculations inaccurate.
Impact: You think you're getting 50 leads per month, but only 30 are real. Your actual CPL is 67% higher than reported.
Fix:
- Install a CF7 spam filter (reCAPTCHA, Akismet)
- Only track
wpcf7mailsentevent (already implemented above—this fires only on successful submissions) - Use honeypot fields to catch bots before they submit
Mistake 2: Not Tracking Form Location
Problem: You have contact forms on multiple pages but don't know which pages convert best.
Impact: You can't optimize page content or prioritize traffic to high-converting pages.
Fix: Already included in our implementation—formLocation parameter captures the page URL.
Mistake 3: Not Setting Up Conversions in Ad Platforms
Problem: Google Ads and Facebook can't optimize for form submissions if they don't receive the conversion data.
Impact: Your campaigns optimize for clicks instead of leads, wasting 30-40% of ad spend.
Fix:
- Import GA4 conversions to Google Ads
- Set up Facebook Conversions API to send server-side form submission events
- Configure TikTok pixel to track form submissions
Mistake 4: Not Testing After WordPress Updates
Problem: WordPress or CF7 plugin updates can break your tracking code.
Impact: You lose weeks of conversion data before noticing.
Fix:
- Add GTM monitoring alerts for sudden drop in form_submission events
- Test tracking after major WordPress updates
- Document your implementation for troubleshooting
Advanced: Send Conversions to Ad Platforms
Basic GA4 tracking is great for analysis, but ad platforms need real-time conversion signals for optimization.
Google Ads Enhanced Conversions:
1. In GTM, modify your GA4 tag
2. Enable Send user data to Google
3. Add email field data if collected in your form
4. Import GA4 conversions to Google Ads (in Google Ads UI)
Facebook Conversions API:
Set up server-side tracking to send CF7 submissions to Facebook:
1. Use Facebook's Conversions API
2. Send Lead event on form submission
3. Include user data (hashed email) for better matching
4. This bypasses iOS 14+ restrictions and improves attribution accuracy by 30-40%
This requires server-side implementation—see "When to Get Professional Help" below.
TikTok Pixel:
1. In GTM, create a new TikTok Pixel tag
2. Event Type: SubmitForm
3. Trigger: CF7 - Form Submission
4. This sends form submission events to TikTok for campaign optimization
When to Get Professional Help
DIY CF7 tracking works for basic implementations, but consider professional help when:
Complexity Indicators:
- Multiple form types (CF7 + Gravity Forms + WooCommerce checkout)
- Multi-step forms requiring step-by-step tracking
- High ad spend (>$10K/month) where tracking errors are costly
- Server-side tracking needed for Facebook CAPI or Google Enhanced Conversions
- Advanced attribution across multiple touchpoints
- Integration with CRMs (HubSpot, Salesforce) requiring custom webhooks
- GDPR/privacy compliance requiring consent-gated tracking
Professional Implementation Saves You:
- 20+ hours of troubleshooting and testing
- Costly tracking errors that inflate your CPL calculations
- Lost conversion data from improper setup
- Ad spend waste from platforms lacking conversion signals
Get Expert Form Tracking Implementation
DataLayer.Site Professional Services:
✓ Complete form tracking setup for Contact Form 7, Gravity Forms, WooCommerce
✓ Multi-platform conversion tracking (Google Ads, Facebook CAPI, TikTok)
✓ Server-side tracking for iOS 14+ attribution accuracy
✓ Lead attribution dashboards showing true cost per lead by channel
✓ CRM integration for closed-loop revenue tracking
✓ 30-day support included
Average Client Results:
- Cost per lead reduction: -25%
- Attribution accuracy: 95%+
- Setup time: 3 days vs 2+ weeks DIY
Investment: Starting at $1,800 for complete form tracking implementation
Get a free 30-minute consultation:
📅 Book a call: Schedule here
📧 Email: contact@datalayer.site
📞 Phone: [To be added]
Troubleshooting Common Issues
Problem: Events Not Appearing in GTM Preview
Check:
- Browser console for errors
- CF7 form successfully submits (you receive the email)
- Code snippet is active (check Snippets plugin or functions.php)
- Type
dataLayerin browser console—verify form_submission object exists
Solution:
- Clear browser cache
- Disable browser extensions (ad blockers can block GTM)
- Check CF7 JavaScript isn't blocked by security plugins
Problem: Events Fire in GTM but Not in GA4
Check:
- GA4 configuration tag fires before the event tag (check GTM Preview tag sequence)
- GA4 Measurement ID is correct in configuration tag
- Event name is valid (lowercase, no spaces)
Solution:
- Verify GA4 tag fires on "All Pages" before form submission
- Check GA4 DebugView instead of Realtime (more reliable)
- Wait 10-15 minutes and check again
Problem: Form Submissions Count Is Too High
Likely Cause: Spam submissions or multiple events firing
Solution:
- Verify you're using
wpcf7mailsentevent (notwpcf7submitwhich fires on all attempts) - Install spam protection (reCAPTCHA)
- Check GTM Preview—ensure tag fires only once per submission
Problem: Variables Are Empty in GA4
Check:
- Data Layer variables are configured correctly in GTM
- Variable names match exactly (case-sensitive)
- dataLayer object contains the expected values (check browser console)
Solution:
- In GTM Preview, click on the form_submission event → Variables tab
- Verify your Data Layer Variables populate
- Check spelling in your WordPress code snippet
Measuring Success: Key Metrics to Track
Once tracking is live, monitor these metrics weekly:
Conversion Metrics:
- Form submissions by source/medium – Which channels drive leads?
- Conversion rate by landing page – Which pages convert best?
- Form completion rate – How many visitors who see the form actually submit?
- Cost per lead (CPL) – Ad spend ÷ form submissions by channel
Optimization Opportunities:
- High-traffic, low-conversion pages – Improve form placement or page content
- High CPL channels – Reduce spend or improve targeting
- Best-performing traffic sources – Scale budget here
- Time to conversion – How long from first visit to form submission?
Set Up GA4 Custom Reports:
Create a dashboard showing:
1. Form submissions by traffic source (last 30 days)
2. Top converting pages
3. Form submission trend over time
4. Geographic breakdown of leads
Next Steps: Advanced Form Tracking
Once basic CF7 tracking is working, consider:
1. Multi-Step Form Tracking
Track each step of complex forms to identify drop-off points:
- Step 1 viewed
- Step 2 reached
- Step 3 completed
2. Form Field Interaction Tracking
See which fields cause users to abandon:
- Fields focused
- Fields completed
- Fields left blank
3. Form Abandonment Tracking
Retarget users who started but didn't complete forms:
- Create audience in GA4: "Form Started but Not Submitted"
- Use in Google Ads and Facebook retargeting
4. Revenue Attribution
Connect form submissions to closed deals:
- Integrate with CRM (HubSpot, Salesforce)
- Track Lead → Opportunity → Closed Won
- Calculate true marketing ROI, not just leads
Want help with advanced tracking? Contact us for custom implementation.
Conclusion
Accurate Contact Form 7 tracking is foundational for data-driven marketing. With this implementation, you now have:
✓ Complete visibility into which traffic sources drive form submissions
✓ Conversion data feeding back to ad platforms for optimization
✓ Cost per lead tracking by channel for budget allocation
✓ Page-level insights showing which content converts visitors into leads
This tracking enables you to reduce wasted ad spend, scale high-performing channels, and calculate true marketing ROI.
Key Takeaways:
1. CF7 doesn't track submissions automatically—manual GTM implementation required
2. Use wpcf7mailsent event for accurate, spam-free conversion data
3. Send conversion signals to ad platforms (Google Ads, Facebook) for campaign optimization
4. Monitor weekly to identify optimization opportunities
Ready for professional implementation? DataLayer.Site offers complete form tracking setup with server-side conversion tracking, attribution dashboards, and CRM integration. Schedule a free consultation to discuss your specific needs.
Need help with your implementation? Comment below with your questions or book a free 30-minute consultation to discuss your form tracking challenges.