Meta Pixel is a JavaScript tracking code that sends visitor actions from your website to Meta's ad platform. Combined with Google Tag Manager (GTM), it can be installed and updated without touching your site's source code.
What is Meta Pixel?
Meta Pixel (formerly Facebook Pixel) tracks user actions β page views, add-to-cart events, purchases, and form submissions β and reports them back to Meta Ads Manager. This data drives conversion reporting, audience building, and automatic bidding optimization.
Why use GTM instead of direct installation?
Installing Pixel code directly into your HTML ties tracking logic to your codebase. Every change needs a developer. GTM separates tracking from code: once the GTM container snippet is on your site, all tag changes happen inside GTM's interface.
Step-by-step setup
Step 1 β Get your Pixel ID
In Meta Events Manager, go to Data Sources β your Pixel β copy the Pixel ID.
Step 2 β Create a tag in GTM
In GTM, go to Tags β New β Tag Configuration β search the Community Template Gallery for Meta Pixel β enter your Pixel ID β set trigger to All Pages β save.
Step 3 β Add conversion events
Create separate tags for key events: Purchase, AddToCart, Lead. Use Custom HTML tags with fbq('track', 'EventName', {...}). Trigger each only on the relevant page or action.
Step 4 β Test in Preview mode
Use GTM Preview mode to confirm tags fire on the right events before publishing.
Step 5 β Publish and verify
Publish the GTM container. Open Meta Events Manager β Test Events tab β confirm events arrive.
Why you also need Meta CAPI
Meta Pixel runs in the browser and loses 20β30% of conversions to ad blockers and iOS privacy settings. Meta CAPI sends the same data server-side, recovering those lost conversions.