Meta Pixel Event Code Generator

Create your Facebook (Meta) Pixel base code and standard event snippets, ready to copy into your website.

Bilal KhizriFree tool by Bilal Khizri · No sign-up · Works on mobile
💡 In simple words: The Meta Pixel is a small piece of code on your website that tells Facebook when someone buys something or fills in a form. This helps your ads find more people like your customers. Pick what you want to track and this tool writes the code for you.

1. Base code (add once, inside <head> on every page)

2. Event code

How to use the pixel code generator

  1. Find your Pixel ID in Meta Events Manager › Data sources. It is a long number.
  2. Paste it in, then copy the base code into the <head> of every page (or into a header plugin on WordPress).
  3. 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.
  4. 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?

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.

Related Free Tools