Manage your WordPress site

How to add the Meta Pixel to WordPress

The Meta Pixel tells Facebook and Instagram which ad visitors became leads or customers. Add it once, with Meta’s own plugin or by pasting the code.

  • Time: About 10 minutes
  • You need: A WordPress administrator login and access to Meta Events Manager
  • Updated:

Meta now calls the pixel a dataset in Events Manager, but it’s the same thing. Choose one method. Installing it twice (plugin plus pasted code, or code plus Tag Manager) counts every visit twice and confuses your ad results.

Before you start

  • A pixel in Meta Events Manager (opens in a new tab). To create one: Connect data > Web > Connect, name it and click Create pixel.
  • A WordPress administrator login.
  • If your site uses Google Tag Manager, add the pixel inside Tag Manager instead.
  1. Step 1: Option A: install Meta’s plugin

    Go to Plugins > Add Plugin and search for Meta pixel for WordPress.

  2. Step 2: Install and activate the plugin by Facebook

    Find the plugin whose author is By Facebook, click Install Now, then Activate.

    WordPress plugin search results with Install Now on the Meta pixel for WordPress plugin circled
    WordPress 7.1: the official Meta pixel plugin in the plugin search.
  3. Step 3: Connect it to your Meta account

    Open the plugin’s settings page, click Get Started and log in to Facebook. Choose your business portfolio and your pixel, and agree to the connection. The plugin then adds the pixel to every page.

    Running a WooCommerce shop? Use Meta for WooCommerce instead. It adds the pixel and keeps your products in sync with your Facebook and Instagram shop.

  4. Step 4: Option B: copy the base code

    In Events Manager, open your pixel and choose Install code manually (the exact path depends on Meta’s setup screens: Meta Pixel only > Install code manually). Copy the base code.

    Events Manager install code window with Copy code circled
    Illustration: Events Manager, Install code manually, Copy code.
  5. Step 5: Paste it into Header and save

    In WordPress, go to Code Snippets > Header & Footer, paste the code into Header and click Save Changes.

    WPCode Header box with the Meta Pixel base code and Save Changes circled
    WordPress 7.1 with WPCode: the pixel code in Header, then Save Changes.
  6. Step 6: Test it

    In Events Manager, open your pixel and use Test events: enter your website address, browse a page, and a PageView should appear within a minute.

Quick answers

Plugin or pasted code?

The plugin is easier and can also send events through Meta’s Conversions API, which Meta recommends. Pasted code is lighter and fine for tracking page views and simple leads.

Do I need to tell visitors about the pixel?

Yes. Your privacy policy should mention it, and visitors in some places need to agree first. Ask me if you’re unsure what your site needs.

Official help pages

Checked against these pages on November 3, 2026.