Meta Pixel (still widely called Facebook Pixel) is a JavaScript snippet you install on your website that tracks what visitors do after clicking your ads. Without it, you have no visibility into which campaigns drive actual conversions, no way to retarget visitors who did not convert, and no data for Meta’s algorithm to optimize against.
This guide covers creating your pixel, installing it on different platforms, setting up conversion events, verifying everything works, and the iOS 14 tracking changes most setup guides skip entirely.
What Meta Pixel Does
The pixel fires on each page load and records visitor actions: page views, product views, add-to-cart events, purchases, form submissions, and anything else you configure. That data flows back to Meta Events Manager, where it serves three main purposes.
Conversion tracking. You can see which specific ads drove actual purchases, leads, or sign-ups rather than just clicks.
Campaign optimization. Meta’s algorithm uses event data to identify which people in your target audience are most likely to convert. The more conversion events you feed it, the better this optimization works.
Retargeting and custom audiences. You can build audience segments from pixel data, everyone who visited a specific page, everyone who added to cart but did not purchase, everyone who completed a purchase in the last 30 days, and serve those audiences specific ads.
Meta Pixel vs. Conversions API
Since iOS 14, browser-based tracking alone is not sufficient for reliable conversion data. Ad blockers, browser privacy settings, and Apple’s App Tracking Transparency (ATT) framework all block or limit the pixel. The Conversions API (CAPI) solves this by sending event data directly from your server to Meta, bypassing browser restrictions entirely.
| Meta Pixel | Conversions API | |
|---|---|---|
| Where it runs | Browser (client side) | Your server (server side) |
| Data loss | Affected by ad blockers, iOS restrictions | Bypasses browser limitations |
| Setup difficulty | Simple | Requires developer or partner integration |
| Best for | Page views, engagement tracking | Purchase confirmation, sensitive conversions |
The current best practice is running both together. Pixel handles fast, browser-side signals. CAPI provides reliable server-side confirmation. When running both, use event deduplication (covered in the CAPI section) to prevent double-counting conversions.
This guide focuses on Pixel setup. CAPI typically requires a developer unless your platform (Shopify, WooCommerce) offers a native integration.
Before You Start
You need three things before creating a pixel:
Meta Business Manager account at business.facebook.com. Free to create. If you do not have one, go to business.facebook.com, click Create Account, enter your business name and email, and follow the verification steps.
Admin access to an ad account. You need ad account admin permissions to create and manage pixels.
Website access. You need to be able to edit your site’s header code, either directly or through your platform’s settings.
Step 1: Create Your Meta Pixel
- Log into Meta Business Suite at business.facebook.com
- Click the menu icon in the top left
- Select Events Manager
- Click Connect Data Sources (green button)
- Select Web as your data source
- Click Get Started
- Name your pixel. Use something descriptive: “ClientName Main Site” or “StoreName E-commerce” works well. Avoid campaign-specific names since this pixel will handle all tracking for the site. Click Create Pixel.
Your pixel is now created. You will see your Pixel ID, a string of numbers like 1234567890123456. Copy it somewhere accessible.
One pixel per website. Do not create a new pixel for each campaign or each ad account. Everything flows through a single pixel per domain.
Step 2: Verify Your Domain
Before setting up conversion events, verify your domain in Meta Business Manager. This became required after the iOS 14 changes to configure Aggregated Event Measurement, which controls how many conversion events you can prioritize per domain.
- In Business Manager, click Business Settings
- Go to Brand Safety and Suitability → Domains
- Click Add
- Enter your domain (e.g., yoursite.com)
- Meta offers three verification methods: DNS record, HTML file upload, or meta-tag. DNS is most reliable for most sites.
- Complete verification and wait for the green “Verified” status
Without domain verification, you cannot configure AEM and your conversion tracking for iOS users will be significantly limited.
Step 3: Choose Your Installation Method
Three options depending on your platform and technical setup.
Partner Integration (easiest). If you use Shopify, WooCommerce, BigCommerce, Wix, or Squarespace, native integrations handle pixel installation automatically and often include CAPI. No code editing required.
Manual code installation. For custom websites or platforms without native support. Requires editing your site’s <head> section. Takes about 15 minutes.
Google Tag Manager. Best if you manage multiple tracking tools or want to add events without touching code repeatedly. Requires GTM to already be installed on your site.
Step 4: Manual Installation
Get your pixel base code:
- In Events Manager, click your pixel
- Click Continue Pixel Setup or go to Settings
- Select Install code manually
- Click Copy Code
Install in your website header:
The code must go in the <head> section of every page. The correct placement is immediately before the closing </head> tag, not at the very start of <head>. This placement ensures other scripts have already loaded and reduces interference.
For WordPress without a plugin, go to Appearance → Theme Editor → header.php, find the </head> tag, and paste the pixel code immediately above it. Click Update File.
For HTML or custom sites, open your main template file, find </head>, paste the code above it, save, and upload.
For Webflow, go to Project Settings → Custom Code, paste in the Head Code section, save, and publish.
The base pixel code:
<!-- Meta Pixel Code --><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><noscript><img height="1" width="1" style="display:none"src="https://www.facebook.com/tr?id=YOUR_PIXEL_ID&ev=PageView&noscript=1"/></noscript><!-- End Meta Pixel Code -->
Replace YOUR_PIXEL_ID with your actual pixel ID in both places.
If your site has a Content Security Policy (CSP): Add https://connect.facebook.net to your allowed script sources. Without this, the pixel will be blocked by your own security headers even after correct installation.
Step 5: Installation via Google Tag Manager
GTM centralizes all your tracking scripts in one place and lets you add or modify events without touching site code.
Add the Meta Pixel tag:
- Log into Google Tag Manager and open your container
- Click Tags → New
- Click the tag configuration area and search for Meta Pixel (official template)
- Enter your Pixel ID
- Under Triggering, select All Pages
- Name the tag “Meta Pixel – All Pages” and save
Publish the container: Click Submit, add a version name like “Meta Pixel Installation,” and click Publish. Tags do not go live until published.
Verify: Visit your site and check the Meta Pixel Helper Chrome extension. Your pixel should appear on all pages.
Step 6: Platform-Specific Setup
WordPress – Install the official “Facebook for WordPress” plugin. Go to Settings → Facebook for WordPress, connect your Facebook account, enter your Pixel ID, and save. The plugin installs the pixel across your entire site and tracks standard e-commerce events automatically.
Alternatively, use the “Insert Headers and Footers” plugin, paste your pixel code in the Scripts in Header section, and save.
Shopify – Go to Online Store → Preferences, scroll to Facebook Pixel, paste your Pixel ID, and save. Shopify automatically installs the pixel and tracks ViewContent, AddToCart, InitiateCheckout, and Purchase events. For more complete tracking including CAPI, use the Facebook & Instagram sales channel app from Shopify’s app store.
For Facebook Shop setup alongside pixel tracking, our guide on <a href=”https://businessho.com/how-to-start-a-facebook-shop/” target=”_blank” rel=”noopener”>how to start a Facebook Shop</a> covers the full channel configuration.
Wix – Settings → Tracking and Analytics → New Tool → Custom. Paste pixel code, set to load on All Pages, apply changes, and publish.
Squarespace – Settings → Advanced → Code Injection → Header. Paste pixel code and save.
Step 7: Configure Conversion Events
Events tell Meta which actions matter to your business. Without at least one conversion event set up and receiving data, campaign optimization is severely limited.
Standard events should be your default. Meta defines 17 standard events that the algorithm treats with priority. Always use standard events when the action fits. The most important ones:
| Event Name | When to Fire |
|---|---|
| Purchase | Transaction completed, order confirmation page |
| Lead | Form submitted, contact info captured |
| InitiateCheckout | Checkout process started |
| AddToCart | Item added to cart |
| ViewContent | Product or key service page viewed |
| CompleteRegistration | Account signup completed |
| Search | Site search used |
Using the Event Setup Tool (no code):
- In Events Manager, click your pixel
- Click Event Setup Tool
- Enter your website URL and click Open Website
- Click buttons, links, or pages you want to track
- Select the event type from the dropdown
- Click Finish Setup
The tool generates tracking code automatically and is sufficient for most standard page-based events. It struggles with dynamic content, single-page applications, and complex JavaScript interactions. For those, manual event code or GTM triggers are more reliable.
Adding events manually:
Place event code on the specific page where the action occurs:
javascript
fbq('track', 'Purchase', {
value: 29.99,
currency: 'USD',
content_type: 'product',
content_ids: ['SKU_123'],
content_name: 'Blue Running Shoes'
});
For Purchase events, always pass value and currency. These parameters are required for revenue reporting and value-based optimization.
Step 8: iOS 14 and Aggregated Event Measurement
This is the section most setup guides skip, and it is one of the most practically important things to get right.
After Apple’s iOS 14.5 update and the App Tracking Transparency framework, Meta can no longer reliably track conversions from users who opt out of tracking on iOS. To maintain attribution for these users, Meta introduced Aggregated Event Measurement (AEM), which relies on statistical modeling rather than direct event tracking.
AEM limits each verified domain to a maximum of 8 prioritized conversion events. Only these 8 events can be used for campaign optimization. Events outside your priority list will still be recorded but cannot be used to optimize ad delivery.
Setting up AEM event priority:
- In Events Manager, click Aggregated Event Measurement
- Click Configure Web Events
- Select your domain
- Set up to 8 events in priority order
Recommended priority order for e-commerce:
- Purchase
- InitiateCheckout
- AddToCart
- ViewContent
- Search
- Lead
- CompleteRegistration
- Your highest-value custom event
For lead generation businesses, reorder with Lead at the top. The events you optimize most often should sit highest on the list.
Changes to your AEM event priority take 72 hours to apply and temporarily pause optimization for affected campaigns. Plan changes carefully and avoid making them mid-campaign.
Step 9: Verify Your Pixel
Always verify before running ads. Spending money against an unverified pixel setup means paying for data you cannot use.
Meta Pixel Helper Chrome extension is the fastest check. Install it from the Chrome Web Store, visit your website, and click the extension icon. A green checkmark confirms the pixel is firing. The extension shows your Pixel ID and which events are triggering on each page.
Important: Disable any ad blockers or privacy extensions before testing. Ad blockers prevent the pixel from loading, which means the Pixel Helper will show no pixel even when your installation is correct. Test in a browser profile with all extensions disabled except Pixel Helper.
Test Events in Events Manager:
- Go to Events Manager → click your pixel
- Click the Test Events tab
- Enter your website URL and click Open Website
- Browse your site, add items to cart, complete a test purchase
- Watch events appear in real-time in the Test Events panel
Confirm that event names are correct (case-sensitive: Purchase not purchase), parameters are passing (value, currency, content_ids), and no duplicate events are firing.
Live Activity tab in Events Manager shows a graph of events received in the last 20 minutes. Once your pixel is live with real traffic, this should show steady activity matching your expected visit volume.
Common Errors and Fixes
Pixel not found: Code is either missing or in the wrong section. Confirm the pixel code is in <head>, not <body>. Check that no caching plugin is serving an old version of the page. Clear cache and retest.
Duplicate pixel firing: Multiple installations are active simultaneously (e.g., plugin and manual code both present). Search your page source for multiple fbq('init') calls. Remove all but one installation method.
Events not firing: Event code is missing from the correct page, event name is misspelled (case-sensitive), or the trigger condition is not met. Use Test Events to debug in real-time and check the event name spelling against Meta’s standard event list.
Missing parameters: Purchase event is firing without value or currency. Add these parameters to the event code. Meta’s algorithm uses them for value-based optimization and revenue reporting.
Event count seems too high: You are likely double-counting because both Pixel and CAPI are firing without event deduplication. Add a unique eventID to both the pixel event and the CAPI payload. Meta uses matching event IDs to deduplicate and count the conversion only once.
javascript
fbq('track', 'Purchase', {value: 29.99, currency: 'USD'}, {eventID: 'order_12345'});
Advanced Features
Advanced Matching sends hashed customer data (email, phone, name) with events to improve attribution rates. Enable it in Events Manager → your pixel → Settings → Advanced Matching. When implementing in code, hash all customer data with SHA-256 before sending:
javascript
fbq('init', 'YOUR_PIXEL_ID', {
em: 'sha256_hashed_email',
ph: 'sha256_hashed_phone'
});
Never send unhashed personal data to Meta. Privacy regulations in most jurisdictions require hashing before transmission.
Custom Conversions let you define conversions based on URL rules rather than event code. Useful when you cannot modify page code but want to optimize for a specific thank-you page. Go to Events Manager → Custom Conversions → Create Custom Conversion, define the URL rule, and associate it with a standard event type.
Website Custom Audiences are built from pixel data. Go to Audiences in Business Manager → Create Audience → Custom Audience → Website. Define rules using your pixel (all visitors, specific page visitors, people who fired AddToCart but not Purchase) and use these for retargeting campaigns or as seeds for Lookalike Audiences.
Frequently Asked Questions
Your Pixel ID is the unique numeric identifier for your pixel, a string like 1234567890123456. Find it in Events Manager by clicking your pixel name. It appears at the top of the Overview tab and in Settings. You need it for manual code installation and GTM setup.
Open Events Manager at business.facebook.com, click Connect Data Sources, select Web, click Get Started, name your pixel, and click Create Pixel. The pixel generates instantly.
Yes. Meta runs Facebook and Instagram ads through the same system. One pixel tracks conversions from both platforms simultaneously.
No. Create a separate pixel for each website. One pixel across multiple domains causes data mixing and breaks AEM domain verification, which is required for reliable iOS conversion tracking.
Real-time data appears in Test Events immediately during testing. Live campaign data appears in Events Manager within 20 to 30 minutes of events firing. Attribution reporting in Ads Manager can have a delay of several hours due to Meta’s processing and aggregation.
This is expected behavior after iOS 14.5. Verify your domain, configure AEM event priority, and implement the Conversions API alongside the pixel. The combination of CAPI and AEM provides the most complete conversion picture available under current iOS restrictions.
Alex Bennett is an entrepreneur whose practical tips have helped thousands improve their careers and grow with confidence.