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
- Datasets replaced the standalone pixel. In Events Manager your pixel is now a dataset that can receive web, app and offline events together. The ID is the same thing it always was.
- Conversions API became easy to turn on. Since April 2026 Meta offers a free one-click Conversions API setup inside Events Manager that mirrors your pixel events server-side with automatic deduplication. It is a good baseline; server-side GTM remains the option when you need control.
- Attribution windows shrank. Meta retired the 7-day and 28-day view-through windows in January 2026. Your reports now rely more heavily on click-through attribution, which makes complete, well-matched events more important, not less.
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:
- The theme or template code for
fbq(andconnect.facebook.net. - Plugins: Facebook for WooCommerce, PixelYourSite, the Shopify Facebook and Instagram channel, Wix and Squarespace marketing integrations.
- Existing GTM tags.
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:
- Pixel ID: your dataset ID.
- Event name: PageView.
- Advanced Matching: enabled. Map email, phone, first name, last name, city, postcode and country to Data Layer Variables where you have them. The template normalises and hashes the values in the browser.
- Consent settings: under Advanced Settings, require additional consent for
ad_storage. - Trigger: All Pages, plus your consent platform's update event so the pixel fires immediately after a visitor accepts without a reload.
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:
- Event name: Purchase
- value:
{{dlv - ecommerce.value}} - currency:
{{dlv - ecommerce.currency}} - content_ids: a Custom JavaScript variable that maps
ecommerce.itemsto an array ofitem_id - content_type:
product - num_items: sum of item quantities
- Event ID:
{{dlv - ecommerce.transaction_id}} - Trigger: Custom Event
purchase
Lead example, driven by the form_submit_success event from the form tool guides:
- Event name: Lead
- content_name:
{{dlv - form_name}} - Event ID: a unique per-submission value
- Trigger: Custom Event
form_submit_success
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
- Open GTM Preview and browse the site. The base pixel should fire once per page view, only after consent where a banner exists.
- Complete each conversion action. Confirm the event tag fires once, with parameters populated.
- Use Pixel Helper to check that no event shows warnings about missing parameters and that Advanced Matching fields are present, hashed.
- In Events Manager, open Test Events, enter your browser session, and watch events arrive with parameters. Open each event to see matched keys.
- Check Diagnostics the next day for duplicate event warnings or missing value warnings.
Common Mistakes
- Two pixels, two of everything.
- Purchase without value and currency, so ROAS is blank.
- AddToCart on button click rather than on the cart API response, counting failed adds.
- Lead on button click, counting failed validations.
- No consent requirement, so the pixel fires for visitors who declined.
- Pixel installed, never tested after the last site redesign.
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.
