Meta Pixel Code Generator

The base code, the events you tick, in the wrapper you paste.

FREE · NO SIGN-UP · RUNS ON YOUR DEVICE

Built in your tab, sent nowhere

  • 8standard events
  • 4ways to paste
  • 15–16digit ID check
  • 0requests sent
In practice

What you can count on

  • 0sent anywhere
    • The ID stays in this tab
    • No request leaves the page
  • 8standard events
    • The set Meta lists for the web pixel
    • Empty boxes never become empty parameters
  • 4paste formats
    • HTML, Tag Manager, WordPress and Shopify
    • Each wrapped the way that place expects
Specification

Meta Pixel Code Generator at a glance

What you type
A 15–16 digit dataset ID
Output format
HTML, PHP or Liquid, plus a .txt
Standard events
All 8 web standard events
Event parameters
Only filled boxes are emitted
Purchase rule
currency and value required
ID validation
Format checked, existence not
Uploads
Nothing leaves your device
Price
Free
Account required
No
Where it runs
On your device
How to

How to use Meta Pixel Code Generator

  1. 1

    Paste the dataset ID

    Copy it from Events Manager under Data sources and paste it in. The format check runs as you type.

  2. 2

    Tick the events

    Add the actions the site should report and fill only the boxes you know — value and currency for Purchase.

  3. 3

    Copy in your format

    Pick HTML, Tag Manager, WordPress or Shopify, then copy the block or download it as a .txt file.

Questions

Frequently asked questions

Do I paste the whole block into <head>?

For plain HTML, yes — the whole block, just before the closing head tag, on every page you want measured. The Tag Manager version goes into a Custom HTML tag instead, with the trigger set to All Pages.

Events Manager only shows me a dataset — is the pixel gone?

No. Meta now files the pixel inside a dataset, and the dataset ID is the same number as the pixel ID. The base code is unchanged and still calls fbq.

Where do I find the dataset ID?

Events Manager → Data sources. The number sits under the dataset name, 15 or 16 digits long. That number is what goes into the box above.

Why is Purchase missing from my generated code?

Purchase needs both currency and value; Meta refuses the event without them. Fill both boxes and the call appears in the code.

Does this page check that my ID really exists?

No — it checks the shape only, 15 or 16 digits. Test the installed pixel with the Test events tab in Events Manager, or the Meta Pixel Helper extension.

Should I install it in the theme and Tag Manager at the same time?

Pick one. Two copies of the base code fire two PageViews per visit and double-count everything. If you already run Tag Manager, keep the pixel there.

What is the noscript image for?

A browser with JavaScript off never runs fbq, so a one-pixel image reports the PageView instead. It is part of the standard snippet; Tag Manager does not need it.

Background

Getting the Pixel Live Without Double Counting

Type the dataset ID from Events Manager, tick the events the site should report, and pick how you will paste it — plain HTML, Tag Manager, WordPress or Shopify. The code updates as you type.

  • Install the base code once per site — in the theme or in Tag Manager, never both.
  • Move each event call onto the page or click it measures; PageView is the only call that belongs everywhere.
  • Check the install with the Test events tab in Events Manager before trusting any number it reports.
  • An ad blocker on your own browser can hide the pixel from you while it fires for everyone else.

Full specification

Specification of the Meta Pixel Code Generator tool
What you typeA dataset ID of 15 or 16 digits — the same number as the pixel ID.
Output formatHTML, Tag Manager, WordPress PHP or Shopify Liquid text, shown on the page and downloadable as a .txt file.
Standard eventsViewContent, AddToCart, InitiateCheckout, Purchase, Lead, CompleteRegistration, Contact and Subscribe, each optional.
Event parametersvalue, currency, content_name and content_ids per event. A box left empty is left out of the call.
Purchase ruleMeta requires currency and value on Purchase, so the call is held back until both are filled.
ID validationFormat only: 15 or 16 digits. Whether that ID exists is something only Events Manager can say.
UploadsNone. The ID and the code never leave your device and no request is made to Meta.
PriceFree
Account requiredNo
Where it runsIn your browser tab.
Next step

Keep going with the same files

All developer tools: Developer tools on SPOTTOOLS