On this page
What this issue is
The Meta Pixel is a small script that reports visits and actions on your site to Meta (Facebook and Instagram). It starts with a call named fbq('init', 'YOUR_PIXEL_ID'). That call tells the script which Pixel, and so which ad account data set, should receive the events.
fbq('init', '');
fbq('init', undefined);
fbq('init', 'YOUR_PIXEL_ID');
fbq('init', '{{pixel_id}}');
fbq('init', '12345 67890');Why it costs you leads or sales
- Visitor landsPage loads normally
- Pixel script loadsfbevents.js is requested
- fbq('init') with bad IDEmpty, undefined or invalid
- Events sent to MetaNo valid hit leaves the browser
- Ads optimisationNo conversions, no audiences
The page loads fine, but the Pixel never identifies itself, so Meta sees nothing.
Example: the same campaign with a valid Pixel ID versus an invalid one. Numbers are illustrative.
How to check if your site has it
View the page source
Open your landing page, right-click and choose View page source. Search for
fbq('init'. Read the value inside the quotes.Use the Meta Pixel Helper
Install the Meta Pixel Helper Chrome extension and reload the page. It shows an error if the Pixel is found but has no valid ID, or says no Pixel was found.
Watch the network tab
Open DevTools, go to Network, filter by
facebook.com/tr. Reload. You should see a request withid=followed by your Pixel ID. If there is no request, orid=is empty orundefined, the init is broken.Compare with Events Manager
In Meta Events Manager, open Data sources and copy the Pixel ID. It must match the ID in your code exactly.
How to fix it
Find who adds the Pixel
It may be a plugin (for example Meta's Facebook for WordPress, PixelYourSite, or a header and footer plugin) or code in your theme. Search the page source to see which.
Correct the ID in the plugin settings
Open the plugin's settings and paste the numeric ID from Events Manager. Remove spaces and any quotes. Save and clear your cache plugin.
If pasted into the theme
Edit the snippet under Appearance, Theme File Editor, or in your header scripts plugin, and replace the placeholder with the real ID.
Open the Meta channel or Customer events
In Admin, go to Settings, Apps and sales channels (Facebook & Instagram) or Settings, Customer events, and check the Pixel ID saved there.
Fix hard-coded code
If an older install sits in theme.liquid, search for
fbq('init'and fix the ID or remove it if the sales channel already adds the Pixel. Avoid running two.
Open the Meta Pixel tag
In your container, open the Custom HTML tag or the template tag that holds the Pixel base code.
Replace the ID or fix the variable
If it uses a variable such as {{Meta Pixel ID}}, open Variables and make sure it has a value (a Constant variable with the numeric ID works well).
Preview, then publish
Use Preview mode, check the request to facebook.com/tr, then Submit the new version.
Open custom code
Go to Site settings, Custom code, Head code (and check page-level custom code in Page settings).
Fix the init line
Replace the placeholder with the real ID, then Save and Publish the site. Changes do not appear until you publish.
Check funnel and site tracking code
Open the funnel or website, go to Settings, Tracking code (Head). Also check the Facebook Pixel ID field in the funnel settings if present.
Correct and save
Enter the numeric ID, save, and republish each affected page.
Open Marketing integrations
In the dashboard go to Marketing, Marketing integrations, Facebook Pixel, and check the saved ID.
Or fix custom code
If you used Settings, Custom code, edit the snippet so the ID is a valid number, then apply it to All pages.
Check the built-in setting
Go to Settings, Advanced, External API Keys (or Marketing, Pixels) and verify the Facebook Pixel ID.
Check code injection
Under Settings, Advanced, Code Injection, search the Header for
fbq('init'and fix any bad value.
Fix the template variable
If the ID comes from an environment variable or config, make sure it is set in production and is rendered before the script runs.
Hard-code a test
Temporarily write the literal ID to confirm the Pixel works, then restore the variable once it is filled in.
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '1234567890123456');
fbq('track', 'PageView');
</script>How to confirm it's fixed
- The page source shows
fbq('init', 'followed by your numeric Pixel ID, with no spaces or placeholders. - Meta Pixel Helper shows your Pixel with a green tick and a PageView event.
- The Network tab shows a
facebook.com/trrequest withid=set to your Pixel ID. - Events Manager, Test events (using your page URL) shows the PageView arriving.
- The same check passes on landing, form and thank-you pages.
How to prevent it happening again
- Store the Pixel ID in a single variable or setting, not copied into many snippets.
- After every theme, plugin or container change, reload a key page and check the Pixel Helper.
- Make sure staging environment variables are replaced with production values at launch.
- Write the Pixel ID in your launch checklist so it can be compared with Events Manager.
- Run a scheduled check on your key pages so a broken init is caught within a day.
How FunnelGuard handles this
Questions people ask
Why is my Meta Pixel not sending any events?
A common cause is a broken init call, where fbq('init') has an empty, undefined or placeholder ID. Without a valid numeric Pixel ID, no hit reaches Meta. View the page source, find the init line and compare the ID with the one in Events Manager.
What does a valid Meta Pixel ID look like?
It is a number, usually 15 or 16 digits, with no letters or spaces. You find it in Meta Events Manager under Data sources, next to your Pixel's name. It is different from your ad account ID and Business Manager ID.
Why does Meta Pixel Helper say no pixel found?
Either the Pixel script is not on the page, or it loads but the init call fails. Check the page source for fbq('init' and for the fbevents.js script. Also check that a cache, consent tool or tag trigger is not stopping it from loading.
How do I fix fbq('init') showing undefined?
The variable feeding the ID has no value when the script runs. Set the variable (for example a GTM Constant, a plugin field or an environment variable) to your numeric Pixel ID, or temporarily hard-code the ID, then publish and retest.
Can I have the Pixel working in Events Manager but still have an invalid init?
Yes, if two installs exist on the page. One may have a valid ID and the other an empty one, so some events arrive while the broken call does nothing. Search the source for every fbq('init' and keep one correct call.
Does a bad Pixel ID affect the Conversions API?
The browser Pixel and the Conversions API are set up separately, so a bad browser init does not change server events. However, server events then have no browser events to match with, which can affect deduplication and reporting.
How can I find out quickly when my Pixel ID breaks?
Check key pages with the Pixel Helper after every change, or use a scheduled monitor that loads your pages and looks for the Meta hit. FunnelGuard does this and alerts you when the expected hit is missing.
Related issues
- TRK-166Meta Pixel missing on funnel pageFix guide
- TRK-167Wrong Pixel ID (old business manager pixel)Fix guide
- TRK-168Two Pixel IDs firing, events splitFix guide
- TRK-171Lead event missing on submitFix guide
- TRK-189Test event code left on production pixelFix guide
- TRK-190Domain not verified in Business ManagerFix guide