On WordPress you have three realistic routes to the Conversions API: a plugin that already sends server events (Meta’s own WordPress plugin, or a form plugin with a Meta integration), a server-side Google Tag Manager container, or a small custom hook that posts the Lead from your own PHP the moment a form is submitted. Whichever you choose, the event that matters is a Lead sent from your server with the same event_id as the browser Pixel, a hashed email and phone, and the fbc and fbp values from the visit.
What the Conversions API has to do on a WordPress site
Meta lists four setup options: the Meta-enabled option, partner integrations, the Conversions API Gateway and a direct integration. On WordPress, the partner route is a plugin, the Gateway route is a cloud container you host, and the direct route is your own code. The Meta-enabled option is worth switching on in Events Manager anyway, but it only shares what the Pixel already shares, so it does nothing for a visitor whose browser blocked the Pixel.
The test for any WordPress route is the same: does the Lead reach Meta from a server that saw the form submission? A form plugin that only fires fbq(‘track’, ‘Lead’) in the browser does not pass. A plugin or hook that posts to graph.facebook.com from PHP does. For what server events fix and what they cannot fix, read server-side tracking for Facebook ads.
Pick your route
| Route on WordPress | What it takes | Sends the Lead when the Pixel is blocked |
|---|---|---|
| Meta’s WordPress plugin or a form plugin’s Meta integration | install, connect the Pixel, map the form to Lead | yes, if the plugin posts from the server; confirm in Test events |
| Server-side Google Tag Manager container | a cloud container, a Meta tag, a data layer push on submit | yes |
| Custom hook in a small plugin | PHP on the form’s submission action, POST to the Graph API | yes |
| Meta-enabled option only | one click in Events Manager | no |
If your forms post to a backend you control, the custom hook gives you the most control and the fewest surprises. If a plugin already runs the integration, use it and spend your time on verification instead of code.
Step by step: connect WordPress to the Conversions API
- Get the Pixel ID and an access token. In Events Manager open Data sources, choose the Pixel, open Settings, find the Conversions API section and click Generate access token under Set up manually. The link only appears for users with developer privileges on the business. Keep the token in wp-config.php or an environment variable, never in theme or plugin JavaScript.
- Decide where the Lead is created. That is the hook your code listens to: the form plugin’s after-submission action, the order-created hook in WooCommerce, or a REST endpoint your form posts to.
- Capture the click identifiers on the visit. Read fbclid from the landing page URL, keep it with the session, and build fbc from it when the _fbc cookie is missing. Store _fbp as it is.
- Create one event_id per lead at submit time. Pass it to the browser Pixel as eventID and to your server code along with the form fields.
- Post the event. Send a POST to https://graph.facebook.com/{API_VERSION}/{PIXEL_ID}/events?access_token={TOKEN} with a data array holding one Lead: event_name, event_time in Unix seconds GMT, event_id, action_source set to website, event_source_url, and user_data with em and ph hashed with SHA-256, fbc and fbp in clear, client_ip_address and client_user_agent.
- Read the visitor’s IP and user agent, not the server’s. Behind Cloudflare or another proxy, take them from the forwarded headers on the request that submitted the form.
- Send immediately, and retry with the same event_id if the call fails. Meta rejects a request when any event in it is more than 7 days old, and keeps only the first copy of an event_name and event_id pair, so a retry cannot create a second lead.
The field-level rules for the payload, including which fields to hash, are in how to set up the Meta Conversions API for lead generation.
The event_id is what stops double counting
Meta pairs a browser event and a server event when the Pixel’s eventID matches the server’s event_id and the event names match, within 48 hours. Inside that window it keeps the first copy it received, and when the two arrive within 5 minutes of each other it favours the browser copy. Outside the window you get two leads for one form submission, which flatters your cost per lead and misleads budget decisions.
The usual WordPress failure is generating the ID twice: the Pixel creates one in JavaScript and the PHP code creates another. Generate it once, on submit, and pass the same string to both sides. Where the pairing breaks and how the fbp fallback behaves is covered in Facebook pixel event deduplication with the Conversions API.
Test it before you trust the numbers
Open Events Manager, go to Data sources, choose the Pixel and open the Test events tab. Copy the test code, add it as test_event_code at the top level of your request body next to data, then submit the form on your live landing page with your own email and phone. Check that the server Lead arrives with the parameters you expect and that its browser copy shows as deduplicated, then remove test_event_code before you go live.
One detail catches people out: events sent with a test code are not dropped. They flow into Events Manager and are used for targeting and measurement, so keep the number of tests small.
WordPress mistakes that break attribution
- The access token sitting in theme JavaScript or a public repository.
- Hashing fbc, fbp, the IP or the user agent, which Meta expects in clear.
- Sending the server’s IP and user agent when the site sits behind a CDN.
- Generating a separate ID in the Pixel and in PHP.
- Firing the Lead on page load instead of on form submission.
- Losing fbclid in a redirect chain before the landing page loads, so fbc can never be built.
- Sending a Lead whose customer information is only a weak combination, which Meta treats as invalid.
Once the server event is live, compare the leads Meta reports with the rows in your own database for a few days. If your landing pages run outside WordPress on DropCPL, the click is logged first-party on your domain and the Lead is sent server-side with an event_id, fbc and fbp, so the WordPress side only has to keep the form and the Pixel consistent. More on match quality and attribution sits in Meta Pixel, Conversions API and attribution.