Blog

How to Track Gravity Forms – Advanced Setup With Meta Pixel (CAPI) + GA4 + Server-Side Tracking via GTM

🧲 How to Track Gravity Forms – Advanced Setup With Meta Pixel (CAPI) + GA4 + Server-Side Tracking via GTM

Are your Gravity Forms submissions invisible to your analytics and ad platforms?

If you’re using WordPress + Gravity Forms and want to track leads in GA4, Meta Pixel (Facebook), or other platforms like TikTok, LinkedIn, or Google Ads, this newsletter shows you exactly how to implement a professional-grade tracking setup using Google Tag Manager (GTM) and Server-Side Tracking.

Let’s break it down 👇


🎯 What We’re Going to Track:

  • ✅ Meta Pixel (CAPI) Events: PageView, ScrollDepth, Contact, Lead
  • ✅ Google Analytics 4 (GA4) Events: form_submission, scroll_tracking, contact_us, engaged_time (30 sec & 1 min)
  • ✅ All events routed via GTM — both client-side and server-side
  • ✅ Higher Event Match Quality using a custom domain with Stape.io

🧪 Step 1: Add a Gravity Forms Listener Script

Paste this code into your site’s footer or in a Custom HTML Tag inside GTM (fired on All Pages):

<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': 'formSubmission',
        'formID': formID
      });
    });
  });
</script>

✅ This pushes a formSubmission event to the dataLayer every time a Gravity Form is successfully submitted.


🎯 Step 2: Create a GTM Trigger for Form Submissions

In GTM:

  1. Go to Triggers > New
  2. Type: Custom Event
  3. Event Name: formSubmission
  4. Trigger on: All Custom Events

You can refine it with a formID condition if you want to track only specific forms.


🧰 Step 3: Send Event to Google Analytics 4 (GA4)

In GTM:

  1. New Tag → Type: GA4 Event
  2. Configuration Tag: Your existing GA4 Config
  3. Event Name: form_submission
  4. Add optional parameters:
  5. Trigger: formSubmission trigger

💡 Step 4: Send Event to Facebook via Meta Pixel + CAPI

Use Two Tags for Meta Lead Event:

A) Meta Pixel (Browser Side)

  • Tag Type: Custom HTML
  • Paste Meta Pixel fbq script firing the Lead event
  • Trigger: formSubmission

B) Meta Conversion API (Server-Side)

Set this up inside GTM Server-Side container with:

  • Event Name: Lead
  • Event Source URL, User IP, User Agent, FBC/FBC
  • Route data to Facebook via Stape.io or manual CAPI integration

Make sure you’re sending user identifiers like email, phone, name hashed for compliance.

Article content

🌐 Step 5: Use a Custom Domain for First-Party Data

Why? Using a branded subdomain (e.g., sst.yourdomain.com) via Stape.io helps:

  • Avoid ITP/browser restrictions
  • Improve event match quality
  • Keep data collection first-party

This ensures high-quality conversions for Meta and GA4.


🧠 Bonus: Track Engagement Events Too

Also set up GTM triggers for:

  • Scroll Depth (e.g., 50%, 75%)
  • Time on Page (e.g., after 30s and 60s)

Use these for both GA4 (scroll_tracking, time_on_page) and Meta Pixel (ScrollDepth).


📊 Business Benefits of This Setup:

  • 🎯 Accurate lead tracking without relying on Thank You pages
  • 🔐 More complete data despite browser restrictions
  • 🚀 Higher match rates for Meta Ads (CAPI via Server-Side Tagging)
  • 💰 Less wasted ad spend + better optimization

🧩 Tools Used:

  • ✅ Google Tag Manager (Web + Server-Side)
  • ✅ GA4 (Google Analytics 4)
  • ✅ Meta Pixel + CAPI
  • ✅ Stape.io (for custom domain & server infrastructure)
  • ✅ Gravity Forms (WordPress)

💼 Need Help?

If you’re running ads or tracking leads and still using only client-side tracking, you’re likely missing out on critical data.

As a Tracking & Analytics Specialist, I help businesses set up:

  • ✅ Bulletproof form + conversion tracking
  • ✅ Meta Pixel + GA4 + TikTok + LinkedIn tracking
  • ✅ GTM Server-Side Tagging
  • ✅ Custom Domain & Consent Mode V2

👉 Comment “TRACK” or DM me for a Free Tracking Audit Let’s fix your tracking once and for all.


🔖 Hashtags:

#GravityForms #GA4 #MetaPixel #ServerSideTracking #GoogleTagManager #FacebookCAPI #WebAnalytics #WordPress #ConversionTracking #TrackingExpert #DigitalMarketing #MarketingAttribution #Shopify

Direct Implementation White-Label for Agencies

Need this implemented, audited, or white-labeled?

Whether you are an eCommerce brand owner fixing signal loss or a digital marketing agency needing a senior analytics engineer under strict NDA, I deliver 24–48h SLA turnaround with 8.5+ EMQ match rates.

✓ 24–48h Emergency SLA ✓ Strict Non-Solicitation & NDA ✓ 8.5+ Event Match Quality
Jobair Mahmud

Jobair Mahmud

AI-Driven Performance Marketing & Web Analytics Consultant

Helping eCommerce brands and marketing agencies trust their ads data, scale Smart Bidding, and eliminate wasted ad spend through bulletproof server-side tracking and PPC management.