How to set up the Meta Pixel with Google Tag Manager

GuideKovumoUpdated 2026-11-267 min read

Short answer

To set up the Meta Pixel, create a pixel (dataset) in Events Manager, add its base code to every page through Google Tag Manager after marketing consent, and fire a Lead event when a form is submitted successfully. Check it with Test Events, verify your domain in Business Settings, and add the Conversions API later if you need to recover leads the browser pixel misses.

  1. Create the pixel
  2. Install it with Google Tag Manager
  3. Track leads
  4. Test the setup
  5. Conversions API: when you need it
  6. FAQ

Create the pixel

  1. Open Events Manager in Meta Business Suite and choose Connect data sources → Web.
  2. Name the pixel (Meta now also calls it a dataset) and copy the pixel ID.
  3. Choose to install the code manually: you will add it through GTM.

Install it with Google Tag Manager

GTM has no built-in Meta tag, so use a Custom HTML tag or a community template from the gallery. With Custom HTML, the base code is:

<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', 'YOUR_PIXEL_ID');
fbq('track', 'PageView');
</script>

Track leads

Add a second Custom HTML tag that runs on the trigger for a successful form submission, the same one as your GA4 generate_lead event:

<script>fbq('track', 'Lead');</script>

Use tag sequencing so the base code runs first, and fire the event once per lead. In Ads Manager, optimise lead campaigns for the Lead event, not for landing page views.

Tag Meta ad links with UTMs too (utm_source=facebook&utm_medium=paid_social), so GA4 shows Meta as Paid Social. The UTM builder has a Meta preset.

Test the setup

  1. In Events Manager, open the pixel and go to Test events. Enter your site URL and open it from there.
  2. Accept marketing cookies. A PageView should appear within seconds.
  3. Submit a test form. A Lead event should appear once.
  4. Decline cookies in a new private window and check that nothing is sent.
  5. Verify your domain in Business Settings → Brand safety → Domains, so Meta accepts events from it for your ads.

Conversions API: when you need it

The Conversions API sends events from your server or CRM instead of the browser, so ad blockers and browser restrictions do not remove them. If you run both, send the same event_id from the pixel and the server so Meta removes duplicates. For a B2B site with modest Meta spend, the browser pixel with a clean Lead event is usually enough to start; add the Conversions API when Meta becomes a real lead source.

FAQ

Is the Meta Pixel the same as the Facebook Pixel?

Yes. Facebook Pixel is the old name. The code and setup are the same.

Do I need the Meta Pixel on a B2B site?

Only if you advertise on Facebook or Instagram, or plan to. Without ads it adds tracking and consent work for no benefit.

Why does Meta show more leads than my CRM?

Meta counts view-through conversions and leads within its attribution window, and a misconfigured trigger can fire on page views or failed submissions. Compare the Lead count in Test Events with real submissions.

Should I send email addresses to Meta?

Advanced matching sends hashed customer data to improve matching. Turn it on only if your privacy notice and consent cover it.

Rather not set this up yourself?

We set up GA4, GTM and ad platform conversions on existing sites: GA4 setup from $450, each ad platform $200–$400.

See GA4 + GTM setup

Related

All guides