To set up Meta Pixel, create a pixel in Meta Events Manager, install its base code on every page of your site directly, through Google Tag Manager or with your platform’s built-in integration, then configure events such as Lead or Purchase and check them with the Test Events tool. The pixel sends visitor actions to your Meta ad account for retargeting, conversion measurement and optimization.

Without a pixel, Meta’s ad account knows how many people clicked an ad but not what they did on your site. This guide walks through creating and installing the pixel, setting up events, pairing it with the Conversions API and checking that data actually arrives.

What the Meta Pixel is

The Meta Pixel is a small piece of JavaScript that a site owner adds to the pages. When a visitor opens a page or takes an action, the code sends a record of it to Meta. The ad system can match the visit to a user profile where that person is logged in and has not opted out, and uses the data for advertising on Instagram, Facebook and other Meta placements.

The word “pixel” is a leftover from the days when such trackers worked through a transparent one-pixel image. Today it is a script, but the name stuck. Facebook Pixel and Meta Pixel are the same thing: the product was renamed along with the company.

The pixel belongs to an ad account setup, so it is created in the business account you run ads from. For how we run campaigns around it, see our paid social services.

Why you need a pixel on your site

With no pixel, an ad account knows only how many people clicked an ad. With one, you get several abilities.

  • Retargeting. You can build an audience of people who visited the site, viewed certain pages or added a product to the cart, and show them ads again.
  • Conversion measurement. The account receives data about target actions such as leads and purchases, so you can see which ads lead to them.
  • Optimization for goals. Campaigns can be optimized for a conversion event instead of clicks, and the system shows ads to people more likely to take that action.
  • Lookalike and expanded audiences. A collected audience can serve as a seed for finding similar people.

How to create and install the pixel

Meta changes its interface often, so check section names against the current Meta Business Help Center.

  1. Create the pixel in Events Manager. In Meta Events Manager, connect a new data source, choose the web option and give the pixel a name. It becomes part of your business account. If a pixel already exists, you can be granted access to it instead of creating a second one.
  2. Get the code or the pixel ID. Events Manager shows the base code and the pixel ID. The code goes into your site, while the ID is what you paste into a tag manager or a platform integration that supports it.
  3. Install it on every page. Place the base code in the head section or deploy it through Google Tag Manager on all pages. That way the pixel sees the visitor’s whole path, not just the landing page.
  4. Set up events. The base code records PageView. For leads, purchases and other actions, add standard events and tie them to buttons, forms or thank-you pages.
  5. Test it. Open your site, walk through the customer path and watch the events appear in the Test Events tab of Events Manager. If nothing arrives, the code is missing, broken or blocked.
  6. Build audiences. After the pixel has collected data, create custom audiences by visits and events and use them in campaigns.

Ways to install the pixel

The method depends on what the site is built on. If you have access to the code, paste the script into the page template. With a tag manager, add the pixel as a custom HTML tag or through its Meta template and set a trigger for all pages.

Most platforms have a built-in way to do it. Shopify has a Meta channel and a field for the pixel ID. WooCommerce and WordPress sites usually use Meta’s official plugin or a script-injection plugin, and builders such as Wix and Squarespace offer an integration or a header code field. Check the platform’s help pages for the current steps. For platform-specific search work, see our pages on Wix and WordPress sites.

If your site has several domains or subdomains, make sure the pixel is on each of them and that data isn’t lost when a visitor moves between them.

How to check that the pixel works

Test right after installation and after every change to the site.

  • ✓ The Meta Pixel Helper browser extension detects the pixel on each page and shows no errors.
  • ✓ Test Events in Events Manager shows PageView and the other events when you visit the site.
  • ✓ Events fire on real actions: submit a test inquiry and confirm it shows up.
  • ✓ The code is present on all pages, including the thank-you page.
  • ✓ You have checked that only one pixel with the same ID fires on a page, so events are not counted twice.
  • ✓ Ad blockers and cookie settings don’t break the setup, but accept that part of your visitors will still not be counted.
  • ✓ The numbers in Ads Manager are compared with the goals in Google Analytics 4: some difference is normal, but a large one needs a reason.

Events and conversions

Page views give a general picture, but optimization needs events: the actions you run ads for. For a service site that is a lead, a call or a booking; for a store, add to cart, initiate checkout and purchase. Meta provides standard events for these, such as Lead, AddToCart, InitiateCheckout and Purchase, and custom events for anything else.

Keep the setup simple: fewer events, each one meaningful. If you have goals in Google Analytics 4, track the same actions so the data can be compared. We describe how to tie ads to sales in our marketing attribution service.

Don’t mark a click as a conversion if it doesn’t lead to revenue. If ads are optimized for a weak event, the system will bring in people who perform exactly that event.

Pairing the pixel with the Conversions API

The browser pixel depends on the visitor’s browser, and part of that traffic is blocked by privacy settings and extensions. The Conversions API sends the same events from your server straight to Meta, so they don’t depend on the browser.

Meta recommends using both: the pixel and the Conversions API together, with the same events sent through each. To avoid double counting, the two copies of an event carry a shared event ID so Meta can deduplicate them. You can connect the API through your platform’s partner integration, through Google Tag Manager’s server-side container or through a direct server integration.

Send only data you have the right to send, and agree the setup with whoever is responsible for privacy on your side.

The pixel and other tracking tools

The pixel complements analytics rather than replacing it.

ToolWhat it is forHow it differs
Meta PixelAudiences and conversions for Instagram and Facebook adsData flows into the ad account; runs in the browser
Conversions APIThe same events, sent from your serverDoesn’t depend on browser blocking; needs a server-side setup
Google Analytics 4Site and goal analytics, visitor behaviorA single view across all sources, including other ad platforms
Google Tag ManagerManaging tags without editing the siteCollects nothing itself; deploys pixels and counters

Visitor data, consent and the law

The pixel collects data about what visitors do, so tell them about it. The information normally belongs in your privacy policy and in a cookie notice. In the EU and the UK, data protection and e-privacy rules generally require consent before such trackers run, so the pixel should be loaded through a consent management platform and only after the visitor agrees. In California, privacy law gives residents rights over the sale and sharing of personal data. Agree the wording with a lawyer: the requirements depend on what you collect and how you use it.

Ads built on audiences follow the platform’s own policies and general advertising rules. Disclosure obligations for sponsored content are covered in influencer disclosure rules.

Common pixel mistakes

  • The code isn’t on every page. Audiences come out incomplete, and the customer path breaks off.
  • No events. Ads optimize only for clicks, although the pixel could report leads.
  • Duplicate code. Two identical pixels on a page distort the data, and so does a pixel plus an API without deduplication.
  • An audience that is too small. Retargeting needs enough visitors, otherwise the campaign doesn’t launch or performs poorly.
  • No testing after changes. A new site version or a theme change can remove the code.
  • Running before consent. In regions that require it, the pixel fires before the visitor has agreed.

How to use the pixel for retargeting

The most common scenario is to bring back people who visited the site but didn’t leave an inquiry. In Meta you create a custom audience by condition: visitors to certain pages over a chosen period, or people who completed one event but not the next. For example, they viewed a service page but didn’t fill in the form.

Different groups need different ads. Show an offer and answers to objections to those who studied pricing, and a reminder to those who added a product to the cart. It also helps to exclude people who already bought, so the budget isn’t spent on those who don’t need the ad.

Retargeting works on an audience that has already reached the site, so you need traffic first, from Google Ads, search or social. How we combine channels is described on our page about paid social vs Google Ads.

What the pixel doesn’t do

The pixel doesn’t bring people to your site and doesn’t make ads effective by itself: it only collects data. If the site doesn’t persuade and the offer is weak, the pixel will show it in the numbers but won’t fix it.

It also doesn’t replace full analytics and a CRM. The pixel knows about actions on the site, but not what happened after the inquiry: whether sales reps reached the person or the deal closed. To see the full chain, connect the data to your CRM. More on this in our guide to the CRM sales pipeline.

Remember the limits: some visitors won’t appear in the data because of blockers and browser settings, so the numbers in Ads Manager and in other systems will never match exactly.

Finally, the pixel needs care when the site changes. If you move to a new platform or change the template, carry over the code and the events and run the tests again. Otherwise the data stops and the audiences stop filling, and you will have to build them up from scratch.

Related services: Paid Social, Social Media Marketing, PPC Management.

More on the blog: Paid social advertising cost, Telegram ads cost, Telegram bot cost.