Gravity Forms and Meta Pixel: track each Lead once

To track Gravity Forms in the Meta Pixel (formerly Facebook Pixel) without duplicates, count the Lead when the form's confirmation is shown, which only happens after Gravity Forms has accepted the entry. The confirmation message is the most dependable signal, whether or not the form uses AJAX.

Why one submission must mean one Lead

Meta uses your Lead events to decide who to show your ads to. If one person who filled in your Gravity Forms form is counted twice, or a person whose submission failed is counted at all, the reports overstate your results and the delivery system learns from people who never became leads. The goal is simple: exactly one Lead for each submission that Gravity Forms actually accepted, and none for failed or repeated ones.

Three setups break that rule on almost every site:

  • Counting the button click. The visitor clicks Submit, a required field is empty, the form shows an error, and the Lead has already gone. A second click after fixing the field sends another.
  • Counting every load of a thank-you page. A reload, the back button or a bookmark sends the event again.
  • Two tools tracking the same form. A pixel plugin, a tag manager trigger and theme code can each send their own Lead for the same submission.

How Gravity Forms submits a form

Gravity Forms submits a form in one of two ways:

  • Without AJAX (the default), the page reloads after Submit. If the entry is accepted, Gravity Forms shows the confirmation you set up under Form Settings → Confirmations: a text message in place of the form, another page on your site, or a redirect. If it is rejected, the same form comes back with the errors marked.
  • With AJAX (enabled where the form is embedded, for example the block setting or ajax="true" in the shortcode), the page stays where it is and the confirmation replaces the form.

A text confirmation is shown in an element with the class gform_confirmation_message and the ID gform_confirmation_message_<form id>. For AJAX forms, Gravity Forms also triggers a jQuery event, gform_confirmation_loaded, on the document when that message is displayed; the handler receives the form ID. Gravity Forms documents that it fires for AJAX-enabled forms only, and it is not meant for redirect confirmations.

Gravity Forms' AJAX submission has not always used an ordinary background request that request-watching tools can read, which is one more reason to rely on the confirmation rather than the request.

Which signal to use

SignalWhat it tells youUse it for the Lead?
Click on the Submit buttonSomeone tried to send the formNo
gform_confirmation_loaded eventThe confirmation message appeared (AJAX forms)Yes (AJAX on)
Element #gform_confirmation_message_<id> appearsThe entry was accepted and the message replaced the formYes (either mode)
Confirmation page loadsAccepted, but reloads and bookmarks load it againOnly with once per session

Before you choose, look at what your own form does: open the browser's developer tools, go to the Network tab, submit the form once with a mistake and once correctly, and compare the two requests and their answers. Form plugins change between versions, and add-ons can change how a form submits.

Option 1: your own code

For an AJAX form, listen for gform_confirmation_loaded with jQuery; it is a jQuery event, so a plain addEventListener will not see it. Check the form ID if only one form should count.

jQuery(document).on('gform_confirmation_loaded', function (event, formId) {
  if (formId !== 3) return; // your form's ID
  var id = 'lead-' + Date.now() + '-' + Math.random().toString(36).slice(2);
  fbq('track', 'Lead', { content_name: 'Form ' + formId }, { eventID: id });
});

This works, but it needs a code snippet plugin or theme changes, and it still sends a second Lead if the same person submits twice. If you also send the event from your server with the Conversions API, give both copies the same event ID so Meta keeps one; see how Meta deduplicates with event_id.

Option 2: Pixelonce, without code

Pixelonce, a free WordPress plugin, tracks Gravity Forms forms with bindings: rules that turn something the site does into an event, without editing the theme or the form plugin. Add the binding under Pixelonce → Bindings, then on the page that holds the form add the Lead event with the trigger “When the site signals it”.

Use an appear binding on the confirmation message. It works for AJAX forms (the message replaces the form) and for page-reload forms with a text confirmation (the message is on the reloaded page). Use the form's own ID so other forms on the site don't count; replace 3 with yours.

{
  "type": "appear",
  "emit": "Lead",
  "selector": "#gform_confirmation_message_3"
}

To count any Gravity Forms form on the page, use the class instead. If your confirmation is set to “Page” or “Redirect”, skip the binding and add the Lead to the thank-you page with a once-per-session or once-per-visitor setting.

{
  "type": "appear",
  "emit": "Lead",
  "selector": ".gform_confirmation_message"
}

A binding only signals; the event's “how often” setting decides whether it fires. Set the Lead to once per visitor (or once per session) and a person who submits the form twice still counts as one lead. Every Lead gets one event ID, which the Conversions API copy reuses, so Meta pairs the browser and server copies instead of counting both.

Gravity Forms traps to avoid

  • Validation errors reload the form. Without AJAX, a rejected submission reloads the page with the form and its errors. Any rule tied to that page load counts failures; the confirmation message is never shown for them.
  • Multi-page forms. Moving to the next page of a multi-page form is not a submission. Only the final confirmation should count.
  • Add-ons that also send pixel events. If a Gravity Forms add-on or a tag manager already sends a Lead, remove one of them.
  • Payment forms. If the form takes a payment, consider counting a Purchase when the payment is confirmed rather than when the form is shown as accepted, and list that event under Events sent elsewhere if your payment add-on sends it from the server.

Test it before you trust it

  1. Remove any other Lead tracking for this form, so only one tool sends it.
  2. Open Events Manager → Test events, and open your form page from there.
  3. Submit the form with a required field empty: no Lead should arrive.
  4. Submit it correctly: exactly one Lead should arrive (two rows if you also use the Conversions API, marked as deduplicated).
  5. Reload the page and submit again: with once per visitor, nothing new should arrive.

With Pixelonce you can also add ?stepcount_debug=1 to the page address: the debug overlay shows each decision, including a submission that was ignored because Gravity Forms did not report success. If you still see doubled events, work through Meta Pixel firing twice on WordPress.

Pixelonce has no official integration with or endorsement from Gravity Forms. Bindings work from the page and its requests alone. Class names, actions and addresses here are what current versions use; confirm them on your own site before relying on them.