Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

How to Add a Meta (Facebook) Pixel to Your Website

Add your Meta (Facebook) Pixel to your AgentFire website, fix the 'tag not allowed' error, track leads on a thank-you page, and check that it works.

The Meta Pixel lets Facebook and Instagram ads see who visits your website and who becomes a lead. You get the code from Meta, then paste it into one box on your website.

Get your Pixel code from Meta

In Meta Events Manager, create a pixel (or open the one you already have) and choose to install the code manually. Copy the code Meta shows you. Meta's own steps are here: Set up a Meta Pixel.

Meta now groups pixels under Datasets. If you already have a pixel, use that one rather than making a new one.

Add the code to your website

1

Click the menu icon at the top left, then Site Settings > AgentFire Settings > Header/Footer Scripts & Metas.

2

Remove the noscript part

Meta's code ends with a part that starts <noscript> and ends </noscript>. Cut that part out, from <noscript> to </noscript>: the head box won't save with it in. If you want to keep it, paste it into Body before closing tag instead. It only matters for visitors who have JavaScript turned off.

3

Paste it into Head first

Paste the rest of the code into the Head first box (it used to be called Facebook Pixel Code). It should start with <!-- Meta Pixel Code --> and <script>.

The Head first box with the pixel code pasted in
4

Click Update

Click Update on the right. You'll see Options Updated. The pixel is now on every page of your website.

After you save, you may see a message asking whether to turn on the cookie banner. You can turn it on yourself: see How to Set Up the Cookie Banner. With the banner on, the pixel only runs for visitors who accept cookies.

The notice asking whether to turn on the cookie banner

Track leads on a thank-you page (optional)

If your form sends people to a thank-you page, you can tell Meta that each visit to that page is a lead. The pixel must already be on your site (above).

1

Open the page's WordPress settings

Open the thank-you page in the editor and click the WordPress Settings icon (the "Y") in the toolbar. The page's settings open in a new tab.

The WordPress Settings icon in the editor toolbar
2

Add the event

Scroll to Facebook Pixel Events. Set Insert Facebook Pixel Events code on this page to Yes, and paste the event code into the box. For a lead, that's fbq('track', 'Lead', {});. Then click Update in the Publish box on the right.

The Facebook Pixel Events panel

This box is only for event lines like the one above. Never paste your whole pixel code here.

Check that it works

Add Meta's free Meta Pixel Helper extension to Chrome. Open your website, accept cookies if a banner shows, and click the helper. It should show your pixel and a PageView. In Events Manager, it can take a while before Meta shows the pixel as active.

Common Questions

It says "This tag not allowed in <head>: <img>".

The <noscript> part of Meta's code is still in the box. Delete everything from <noscript> to </noscript> and click Update again.

The "This tag not allowed in head: img" error above the Head first box
Meta says my pixel isn't active.

Check your site with Meta Pixel Helper, after accepting cookies if your site shows a cookie banner. If the helper finds no pixel, check that the code is saved in Head first and the pixel ID matches the one in Events Manager.

Can I have the pixel on only one page?

The Head first box puts it on every page. To have it on one page only, email support@agentfire.com with the page.

Can you install it for me?

Yes. Email support@agentfire.com with your pixel code, or your pixel ID from Events Manager.

Do you set up Meta's Conversions API?

No. AgentFire supports the Meta Pixel on your website, not a server-side Conversions API connection.

Last updated