← All Guides

WPForms Conversion Tracking with Google Tag Manager: GA4, Google Ads and Meta Setup

How to track WPForms submissions with Google Tag Manager using the wpformsAjaxSubmitSuccess event, pass the lead email for Enhanced Conversions, and fire GA4, Google Ads and Meta only on real submissions.

Atiqul Islam
Written by Atiqul Islam

Tracking & analytics specialist. 278+ GTM, GA4 and server-side tracking projects for clients in the US, UK and Australia.

Rather not do this yourself? I set this up for clients every week. Free 15-minute audit, no obligation.

Book a Free Audit

WPForms is designed for simplicity, which is great for site owners and awkward for tracking: the form submits in the background and the page never changes. Most sites end up tracking the submit button, which counts every failed attempt.

WPForms fires a JavaScript event called wpformsAjaxSubmitSuccess when the server accepts a submission. This guide shows how to listen for it in Google Tag Manager and send the lead to GA4, Google Ads and Meta.

Prerequisites

Step 1: The Listener

Create a Custom HTML tag named Listener - WPForms Success and fire it on All Pages:

<script>
(function () {
  if (!window.jQuery) { return; }
  jQuery(document).on('wpformsAjaxSubmitSuccess', function (event, json, formId, $form) {
    var form = ($form && $form[0]) || event.target;
    var email = form ? form.querySelector('input[type="email"]') : null;
    var phone = form ? form.querySelector('input[type="tel"]') : null;

    window.dataLayer = window.dataLayer || [];
    window.dataLayer.push({
      event: 'form_submit_success',
      form_tool: 'wpforms',
      form_id: String(formId || (form && form.getAttribute('data-formid')) || ''),
      user_email: email && email.value ? email.value.trim().toLowerCase() : undefined,
      user_phone: phone && phone.value ? phone.value.trim() : undefined
    });
  });
})();
</script>

Note the handler reads the fields from the form object passed with the event. WPForms clears the form after success, so reading from the page afterwards is unreliable.

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, optionally with a condition on form_id.

Step 3: Tags

GA4 Event. Event name generate_lead, parameters form_id and form_tool. Mark generate_lead as a key event in GA4.

Google Ads Conversion. Conversion ID and label from the Google Ads conversion action, with a Conversion Linker tag on All Pages. For Enhanced Conversions, create a User-Provided Data variable from user_email and user_phone, attach it to the conversion tag, and turn Enhanced Conversions on in Google Ads.

Meta Lead. Fire the Lead event with email and phone as advanced matching parameters. If you use server-side GTM with the Conversions API, send the same event with a shared event ID.

Step 4: If AJAX Is Off

When AJAX is disabled, WPForms reloads the page and shows the confirmation message or redirects. Options:

Step 5: Test

  1. GTM Preview, submit the form with test data. Confirm form_submit_success appears with the right form_id and that email and phone are populated.
  2. Confirm GA4, Google Ads and Meta tags fired once.
  3. Inspect the Google Ads request in a tag debugger such as the Insighter Debugger extension. You should see the conversion label and hashed user data.
  4. Submit with a missing required field. Nothing should fire.
  5. In GA4 DebugView, confirm generate_lead arrives with its parameters.

Common Problems

Result

One event, fired once, only when WPForms has accepted the submission, with the contact details available for Enhanced Conversions and Advanced Matching. That gives Google Ads and Meta the strongest possible signal from the smallest amount of code.

Frequently Asked Questions

Which WPForms setting does this depend on?

The form must have AJAX form submission enabled under Settings, then General, in the form builder. It is on by default in current versions. If it is off, the page reloads on submit and you need the confirmation page method.

WPForms Lite or Pro?

Both fire the AJAX success event. Pro adds conditional logic and payment fields but the tracking method is the same.

Can I use the WPForms Google Analytics addon instead?

You can, but it only covers GA4 and does not give you Google Ads Enhanced Conversions or Meta. Tracking through GTM covers all three from one event and keeps all your tags in one place.

How do I track only one of my forms?

The event provides the form ID. Add a trigger condition where form_id equals the ID shown in the WPForms admin list.

Why is my conversion count higher than my entries?

You are probably also tracking a thank-you page or a button click. Remove the other trigger. One dataLayer event per successful submission is the goal.

Want This Done Right the First Time?

Book a free 15-minute audit call. I'll review your setup, show you what is broken, and tell you exactly what it takes to fix it.

Chat Now