How to Set Up the Meta Pixel and Conversions API on WordPress

A step-by-step guide to tracking leads and sales from Facebook and Instagram ads on a WordPress site: the Pixel, the Conversions API, deduplication, testing and the mistakes that break tracking.

How to Set Up the Meta Pixel and Conversions API on WordPress

Facebook and Instagram ads can only optimise for what they can measure. If Meta does not know which clicks became leads or sales, it cannot find more people like them. That is why tracking is the first thing we set up for any client, before a single ad goes live.

Key steps: How to Set Up the Meta Pixel and Conversions API on WordPress

This guide explains how to set up the Meta Pixel and the Conversions API on a WordPress site, in the order we use.

What the Pixel and the Conversions API do

The Meta Pixel is a small piece of code that runs in the visitor’s browser. It tells Meta when someone views a page, submits a form or buys something.

The Conversions API (often called CAPI) sends the same events from your server directly to Meta. Browsers increasingly block or limit tracking code, so server events fill the gaps that the Pixel misses.

Used together, with deduplication, they give Meta a much more complete picture.

Step 1: Prepare Business Manager

  • Make sure your business owns the Meta Business Manager, the ad account and the dataset (the Pixel). Agencies should be added as partners, not owners.
  • In Events Manager, create a dataset for the website if you do not have one.
  • Verify your domain in Business Manager under Brand safety, Domains. This is required for some event settings.

Step 2: Decide which events matter

Do not track everything. Track the actions that mean business:

  • Lead: a contact or quote form is submitted successfully.
  • Schedule: a consultation or appointment is booked.
  • Contact: a click on WhatsApp or the phone number.
  • Purchase: an order is completed, with value and currency.
  • ViewContent, AddToCart, InitiateCheckout: for online stores.

Fire a lead event only after the form is accepted, not when the button is clicked. Otherwise spam and failed submissions inflate your numbers.

Step 3: Install the Pixel

There are three common ways on WordPress:

  • Google Tag Manager: add the Pixel base code and event tags in GTM. This is the most flexible option and keeps tracking in one place.
  • An official integration: for WooCommerce stores, Meta’s own integration can send standard shop events.
  • Custom code: for custom themes and forms, a developer can push events to the data layer and let GTM send them.

Whichever you choose, install the Pixel once. Two installations mean every event is counted twice.

Step 4: Connect the Conversions API

You can send server events in several ways: through Meta’s partner integrations, through a server-side tag manager, or with custom code on your server. For many WordPress sites, the simplest route is the integration built into Events Manager for the platform you use.

Server events should include customer information that helps Meta match the event to a person, such as email and phone number. This data must be hashed before it is sent, and your privacy policy should explain it.

Step 5: Deduplicate browser and server events

When the same lead arrives from both the Pixel and the server, Meta needs to know it is one event. Send the same event name and the same event ID from both sides. Meta then keeps one and discards the duplicate.

Without deduplication your results look better than they are, and the algorithm learns from wrong numbers.

Step 6: Turn on advanced matching

Automatic advanced matching lets the Pixel send hashed details that a visitor enters in your forms. It improves how many events Meta can link to real accounts, which helps reporting and optimisation. Enable it in the dataset settings and mention it in your privacy policy.

Step 7: Test before you spend

  • Use Test events in Events Manager. Open your site, submit a test form and watch the browser and server events arrive.
  • Check that each event shows as deduplicated, not doubled.
  • Check the Event Match Quality score for your main events and improve it by sending more matching fields where you can.
  • Use the Meta Pixel Helper browser extension to confirm the Pixel loads once on every page.

Delete or exclude your test leads so they do not count as real results.

Common mistakes that break tracking

  • The Pixel installed twice, once in the theme and once in a plugin or GTM.
  • Lead events firing on button clicks instead of successful submissions.
  • Spam submissions counted as leads because the event fires before spam checks.
  • Thank-you pages that anyone can open directly, firing a lead every time.
  • Forgetting to update tracking after a website redesign.

Frequently asked questions

Do I still need the Pixel if I use the Conversions API? Yes. They work best together. The Pixel captures browser activity and the Conversions API fills in what browsers miss.

Is the Conversions API hard to set up? With a partner integration it can take an hour. Custom setups take longer but give you more control over which events and data are sent.

How do I know tracking is working? Events appear in Events Manager, the test tool shows them arriving, and the number of leads Meta reports is close to the number you actually received.

Want us to check your tracking? Book a free 30-minute consultation and we will review your Pixel, Conversions API and Google tracking with you.

Keep reading

Related articles

Chat on WhatsApp