← All Guides

Meta Pixel Setup with Google Tag Manager in 2026: Dataset, Base Code, Standard Events, Advanced Matching and Testing

The complete, current way to install Meta Pixel through Google Tag Manager: create the dataset in Events Manager, load the base pixel, fire the right standard events with parameters, add Advanced Matching, respect consent, and verify everything in Test Events.

Atiqul Islam
Written by Atiqul Islam

Tracking & analytics specialist. 278+ GTM, GA4 and server-side tracking projects for clients in the US, UK and Australia.

Rather not do this yourself? I set this up for clients every week. Free 15-minute audit, no obligation.

Book a Free Audit

Meta Pixel is the oldest tracking tag most businesses have and the one most often broken. Installed three times by three different people, firing Purchase with no value, counting AddToCart twice, and never tested after the theme was changed. This guide is the clean 2026 setup through Google Tag Manager, from creating the dataset to verifying events, written for people who want their Meta reporting to match their actual sales and leads.

What Changed Recently

Step 1: Create or Find Your Dataset

In Meta Events Manager, open Data sources. If a pixel already exists for the business, use it; creating a second one splits your history. If not, choose Connect data, then Web, name the dataset after the website, and copy the ID.

Assign the dataset to the right ad account under Business settings, then Data sources, then Datasets, then Connected assets. A pixel that is not connected to the ad account cannot be used for optimisation.

Step 2: Remove Every Other Pixel Installation

Before adding anything, audit. Open the site with the Meta Pixel Helper extension and a tag debugger such as the Insighter Debugger. Count how many pixel IDs load and how many times each loads. Then search:

Decide that GTM is the single source and disable the rest. Duplicate pixels are the most common reason Meta reports more purchases than the store took.

Step 3: Base Pixel Tag in GTM

Use the official template from the Community Template Gallery. In GTM, create a new tag, search the gallery for the Facebook Pixel template published by facebookincubator, and add it.

Configure it:

If you prefer the raw snippet instead of the template, use a Custom HTML tag:

<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_DATASET_ID', {
  em: {{dlv - user_email}},
  ph: {{dlv - user_phone}},
  fn: {{dlv - user_first_name}},
  ln: {{dlv - user_last_name}}
});
fbq('track', 'PageView');
</script>

The template is easier to maintain and handles event IDs and parameters without hand-written code, so I recommend it for almost everyone.

Step 4: Choose Your Standard Events

Meta recognises a fixed list of standard events. Use them rather than custom names wherever one fits, because Meta can optimise and report on them directly.

Business Standard events to fire Required or important parameters
Ecommerce ViewContent, AddToCart, InitiateCheckout, AddPaymentInfo, Purchase value, currency, content_ids, content_type, num_items
Lead generation Lead, Contact, Schedule, SubmitApplication content_name, value (optional)
SaaS and subscriptions CompleteRegistration, StartTrial, Subscribe, Purchase value, currency, predicted_ltv
Local and services Contact, Schedule, FindLocation, Lead content_name
Content and community Search, ViewContent, Subscribe, Donate search_string, content_name, value

Full list of standard events: AddPaymentInfo, AddToCart, AddToWishlist, CompleteRegistration, Contact, CustomizeProduct, Donate, FindLocation, InitiateCheckout, Lead, Purchase, Schedule, Search, StartTrial, SubmitApplication, Subscribe, ViewContent, plus PageView. Anything else is a custom event, which you can still track and turn into a custom conversion.

Step 5: Event Tags Driven by the Data Layer

Each event tag uses the same template, with the event name set and parameters mapped from Data Layer Variables. Trigger them from dataLayer events pushed by your site or form tool, never from raw clicks.

Purchase example, assuming the ecommerce dataLayer described in the Shopify, WooCommerce and Stripe guides on this site:

Lead example, driven by the form_submit_success event from the form tool guides:

The Event ID is what lets the Conversions API send the same event server-side without doubling your numbers. Set it on every event you plan to mirror.

Step 6: Advanced Matching Everywhere You Have Data

The pixel can only match an event to a person if it has something to match on. Push customer data to the dataLayer wherever it exists: on login, on the checkout page as fields are completed, on the order confirmation page, and on form submission. Map those variables in the base pixel and again on the Purchase and Lead events.

The Event Match Quality guide on this site goes deeper, including the fbp and fbc cookies and external_id.

Step 7: Test Before Trusting

  1. Open GTM Preview and browse the site. The base pixel should fire once per page view, only after consent where a banner exists.
  2. Complete each conversion action. Confirm the event tag fires once, with parameters populated.
  3. Use Pixel Helper to check that no event shows warnings about missing parameters and that Advanced Matching fields are present, hashed.
  4. In Events Manager, open Test Events, enter your browser session, and watch events arrive with parameters. Open each event to see matched keys.
  5. Check Diagnostics the next day for duplicate event warnings or missing value warnings.

Common Mistakes

What Good Looks Like

One pixel, standard events that match your real funnel, every event carrying value and identifiers, an Event ID ready for the Conversions API, and Events Manager showing a clean diagnostic page. That is the foundation. The next two guides, Conversions API and Event Match Quality, build on it.

Frequently Asked Questions

Pixel or dataset, which is it now?

Both words refer to the same thing. Meta folded the Pixel into a dataset in Events Manager, so the ID you paste into GTM is the dataset ID, and web, app and offline events for the same business can live in one dataset. Older documentation and most tools still say Pixel ID.

Should I install the pixel through GTM or through my platform's Meta integration?

One or the other, never both. Platform integrations on Shopify, WordPress and others are fast and include the Conversions API. GTM gives you control over every event and parameter and keeps Meta alongside your GA4 and Google Ads tags. For a business that spends real money on Meta ads, GTM control pays for itself in cleaner data.

How many standard events should I use?

Only the ones that mean something for your business. An ecommerce store needs ViewContent, AddToCart, InitiateCheckout and Purchase. A lead generation site needs Lead, maybe Contact and Schedule. Every extra event you fire without a clear use adds noise and no value.

What does the pixel do if the visitor declines cookies?

Nothing, if you set it up correctly. Meta Pixel does not support Google Consent Mode, so you add a consent requirement in GTM that holds the pixel until the visitor grants advertising consent. The Consent Mode guide on this site covers the exact settings.

Do I still need the Conversions API if the pixel is working?

Yes. The pixel misses iOS users with tracking protection, ad-blocked visitors and anyone who declined consent in the browser. The Conversions API sends the same events from your server and is deduplicated against the pixel. In 2026 Meta offers a free one-click version, and server-side GTM gives you the full-control version. See the Conversions API guide.

Want This Done Right the First Time?

Book a free 15-minute audit call. I'll review your setup, show you what is broken, and tell you exactly what it takes to fix it.

Chat Now