How to use the pixel code generator
- Find your Pixel ID in Meta Events Manager › Data sources. It is a long number.
- Paste it in, then copy the base code into the <head> of every page (or into a header plugin on WordPress).
- Choose the event you want to track, such as Lead for form submissions, and whether it fires on page load or on a button click.
- Add the event code to the right page and test it with the Meta Pixel Helper extension or the Test Events tab.
Which event should I use?
- Lead: someone submits a contact or quote form.
- Contact: someone calls, emails or messages you on WhatsApp.
- Schedule: someone books an appointment.
- Purchase: someone completes an order (always include value and currency).
- AddToCart, InitiateCheckout, ViewContent: steps in an online shop.
- CompleteRegistration: someone signs up for an account or webinar.
Important: also set up the Conversions API
Browsers and ad blockers block some pixel events. Meta recommends adding the Conversions API, which sends events from your server. On WordPress and Shopify, the official Meta integrations can set this up for you. Use the same event names in both, and Meta removes duplicates automatically.
Track your ad results with our Meta Ads Calculator.
Frequently Asked Questions
Where do I find my Meta Pixel ID?
In Meta Events Manager, open Data sources and select your pixel (dataset). The ID is the long number shown under its name.
Where do I put the pixel code on WordPress?
Use the official Meta for WordPress plugin, or paste the base code into a header code plugin so it loads on every page.
How do I test my pixel?
Install the Meta Pixel Helper Chrome extension, or open the Test Events tab in Events Manager and visit your site.
Do I need the Conversions API?
It is strongly recommended. It recovers events that browsers and ad blockers miss, which improves ad optimisation.