Track Contact Form 7, WPForms and other form submissions once in Meta Pixel
To track a form in the Meta Pixel (formerly Facebook Pixel) correctly, send the Lead event when the submission actually succeeded: when the form plugin's server accepted it. Do not send it when the button is clicked or every time the thank-you page loads. For forms that submit in the background, that means reading the server's answer, because it often says “OK” even when the form was rejected.
What a “lead” should mean
One Lead event should equal one person who sent you their details. The pixel is used to optimise your ads, so every extra Lead teaches Meta to find more people like the ones who did not convert. Three common setups break this rule:
- Firing on the button click. The visitor clicks Submit, a required field is empty, the form shows an error, and a Lead has already been sent. If they fix the field and click again, a second Lead is sent.
- Firing on every load of the thank-you page. A reload, the back button or a bookmark sends the event again.
- Firing on any background response. The form's request completes, so the event is sent, even though the server refused the submission.
Why “HTTP 200” does not mean the form was sent
Most modern WordPress form plugins submit in the background (with AJAX or fetch) and stay on the same page. Their server usually answers with HTTP status 200, which means “the request was received”, not “the form was accepted”. The real result is inside the response.
Contact Form 7 submits to its REST endpoint and answers with a status field. Only one value is a successful submission:
| status | Meaning | Count as a lead? |
|---|---|---|
mail_sent | The form was accepted and the email was sent | Yes |
validation_failed | A field was missing or invalid | No |
mail_failed | The form was valid but the email could not be sent | Your choice; usually no |
spam | The submission was treated as spam | No |
WordPress admin-ajax handlers, used by many form plugins (WPForms, for example, when its AJAX submission option is on), answer with an envelope such as {"success":true,"data":{…}} or {"success":false,"data":{…}}. Both normally come with HTTP 200. Only success: true is a submission.
To see what your own form sends, open the browser's developer tools, go to the Network tab, submit the form once with an error and once correctly, and compare the two responses.
Three ways to count a submission once
1. A thank-you page with a once-per-session event
Send visitors to a separate thank-you page after a successful submission, and fire the Lead there. This only works well if the event is limited to once per session (or once per visitor), so reloads and bookmarks do not count again. It also depends on the form plugin redirecting only on success, which most do. It is the simplest approach, but you lose the event if the visitor closes the page before the redirect finishes.
2. Listen for the form plugin's success event
Many form plugins announce a successful submission in the page with a JavaScript event. Contact Form 7, for example, documents DOM events including wpcf7mailsent (the email was sent) and wpcf7submit (any submission, successful or not). Listening for the success event, not the general one, is a reliable signal:
document.addEventListener('wpcf7mailsent', function () {
fbq('track', 'Lead', {}, { eventID: 'lead-' + Date.now() + '-' + Math.random().toString(36).slice(2) });
});This needs code in your theme or a snippet plugin, a different event name for each form plugin, and it still fires again if the same visitor submits twice. If you also send the event from your server, use the same ID on both sides; see how Meta deduplicates with event_id.
3. Check the response of the background request
The most general approach is to watch the form's request and read its answer: fire only when the response says success (status is mail_sent, or success is true). This works for any plugin that submits in the background, including ones that announce nothing in the page. Doing it by hand means wrapping the browser's request functions, which is easy to get wrong; a tracking tool should do it for you.
Steps to set it up correctly
- Remove any other Lead tracking for this form: a pixel option in the form plugin, a tag manager trigger or theme code.
- Submit the form with an error and check the network response, then submit it correctly and compare.
- Choose the signal: the success response, the plugin's success event, or a thank-you page.
- Limit the event to once per visitor or once per session, so a repeat does not count twice.
- Test in Events Manager → Test events: one failed submission should send nothing, one successful submission should send one Lead.
If you still see two Leads, go through the causes in Meta Pixel firing twice on WordPress.
How Pixelonce handles this
Pixelonce, a free WordPress plugin, does this with bindings: rules that fire an event from what the site does, without editing the theme or the form plugin.
- Background submits that succeed. An ajax binding matches a WordPress admin-ajax request by its
actionname, or any request (REST orfetch) by part of its URL. It fires only when the response reports success. You can require specific fields withsuccess_when, for examplestatus = mail_sent. - A thank-you message that appears. An appear binding fires when an element, such as the confirmation panel a form shows after sending, becomes visible.
- Still once. The binding only signals. The event's “how often” setting decides whether it fires, so a visitor who submits twice can still count as one Lead.
- You can see every decision. The debug overlay (
?stepcount_debug=1) shows when a binding was suppressed because the request did not report success, and the trigger health check flags a binding that stopped matching after a form or theme update.
A binding for a Contact Form 7 form looks like this:
{
"type": "ajax",
"emit": "Lead",
"url": "contact-form-7/v1/contact-forms/",
"require_success": true,
"success_when": { "status": "mail_sent" }
}Check the request address your form actually uses in the Network tab before you copy this. Pixelonce has no official integration with or endorsement from any form plugin; bindings work from the request and response alone.
