To set up the Meta Pixel on Shopify (many people still call it the Facebook Pixel), the quickest route is the free Facebook & Instagram app: connect your Meta business account, open Data sharing settings, choose the Enhanced or Maximum level and connect your pixel. If you want more control, you can instead add the pixel yourself as a custom pixel under Settings > Customer events. Whether you searched for how to add Meta Pixel to Shopify or a Shopify Facebook Pixel setup guide, the steps are the same. This guide walks through both methods step by step, the ViewContent, AddToCart and Purchase events you need, and how to test that it all works.

Why it matters: if you're running Facebook or Instagram ads without a properly configured Meta Pixel, you're burning money. The pixel is how Meta's ad platform learns what happens after someone clicks your ad: which products they view, what they add to cart and whether they buy. Without it, Meta can't optimise your campaigns, build useful audiences or report an accurate return on ad spend (ROAS). And since Apple's iOS 14.5 privacy changes in 2021, browser tracking alone misses conversions, which is why the Conversions API (CAPI) is now part of any serious Shopify Facebook Pixel setup.

If you're setting up Google Analytics at the same time, my GA4 Shopify setup guide uses the same Customer events system, so it's worth doing the two together.

What the Meta Pixel actually does

The Meta Pixel is a piece of JavaScript that fires events when visitors take actions on your store. These events feed back to Meta for three purposes:

  • Conversion tracking: knowing which ads and audiences drive actual purchases, not just clicks
  • Audience building: custom audiences based on behaviour (viewed a product but didn't buy, added to cart, past purchasers)
  • Ad optimisation: Meta's delivery system uses conversion data to show your ads to the people most likely to buy. Better data means better optimisation and a lower cost per acquisition

The Shopify Meta Pixel events: ViewContent, AddToCart, Purchase and more

These are the standard Meta events an online shop needs, and the Shopify customer event each one corresponds to:

Meta eventWhen it firesShopify customer event
PageViewEvery page loadpage_viewed
ViewContentA product page is viewedproduct_viewed
SearchA shopper uses site searchsearch_submitted
AddToCartA product is added to the cartproduct_added_to_cart
InitiateCheckoutCheckout beginscheckout_started
AddPaymentInfoPayment details are submittedpayment_info_submitted
PurchaseAn order is completed (with value, currency and product IDs)checkout_completed

If you only get three right, make them ViewContent, AddToCart and Purchase. They power retargeting, dynamic product ads and purchase optimisation.

Method 1: how to set up Meta Pixel on Shopify with the Facebook & Instagram app

The Facebook & Instagram app (Meta's own sales channel for Shopify) is the easiest way to install the Meta Pixel on Shopify and switch on the Conversions API. If you're asking how to install Meta Pixel on Shopify with no code at all, this is the answer, and it's the Shopify pixel app most stores should start with.

Install the channel

  1. In your Shopify admin, go to Settings > Sales channels.
  2. Click Shopify App Store and search for Facebook.
  3. Click Add channel (or Add app).
  4. Click Start set up, then Connect account, sign in to Facebook and connect your business assets.
  5. Accept the terms and click Finish setup.

Connect the pixel and choose a data-sharing level

  1. Go to Sales channels > Facebook & Instagram and click Settings.
  2. Click Data sharing settings.
  3. In the Customer data sharing section, turn customer data sharing on.
  4. Under Choose level, pick a level (see below).
  5. If no pixel is connected yet, click Connect on the pixel you want to use.
LevelWhat it does
StandardThe Meta Pixel collects browsing behaviour in your online store. Browser only, so ad blockers can stop it.
EnhancedAdds Meta's Conversions API alongside the pixel. The purchase event is sent server to server, and customer details (name, location, email, phone) are shared to match visitors to Meta users.
MaximumWorks like Enhanced (pixel plus Conversions API) and, in Shopify's words, is updated with Facebook's latest advertising technology.

For most stores I recommend Enhanced or Maximum, because both add the Conversions API. Make sure your privacy policy and cookie banner cover the customer data you're sharing.

Method 2: Meta Pixel setup using Customer events on Shopify

If you need full control over which events fire and what data they carry, you can add the pixel as a custom pixel. This is the "Meta Pixel setup using Customer events" route, and it's how a developer would set up Meta Pixel tracking for Shopify when the app's defaults don't fit. Shopify doesn't support the code inside custom pixels for you, so it suits stores with a developer on hand.

How to add the Meta Pixel to your Shopify website as a custom pixel

  1. First, remove any other copy of the Meta Pixel: old code in theme.liquid, a pixel connected in the Facebook & Instagram app, or another pixel app. Two copies means every event counts twice.
  2. In your Shopify admin, go to Settings > Customer events.
  3. Click Add custom pixel (top right), enter a name for the pixel (for example "Meta Pixel") and click Add pixel.
  4. In Customer privacy, set the Permission and Data sale options to match your consent set-up.
  5. Paste your code into the Code window: Meta's base pixel code from Events Manager, followed by the event mapping below.
  6. Click Save, then Connect pixel.
Shopify Add custom pixel dialog with the pixel name Meta Pixel entered and the Add pixel button
Settings > Customer events > Add custom pixel. Shopify reminds you to check for an app first, and that custom pixel code is your responsibility.

Mapping Shopify customer events to Meta events

After the base code (which defines fbq and calls fbq('init', 'YOUR_PIXEL_ID')), subscribe to Shopify's standard events and fire the matching Meta events. A simplified example:

analytics.subscribe('page_viewed', () => {
  fbq('track', 'PageView');
});

analytics.subscribe('product_viewed', (event) => {
  const v = event.data.productVariant;
  fbq('track', 'ViewContent', {
    content_ids: [v.id],
    content_type: 'product',
    value: v.price.amount,
    currency: v.price.currencyCode
  });
});

analytics.subscribe('product_added_to_cart', (event) => {
  const line = event.data.cartLine;
  if (!line) return;
  fbq('track', 'AddToCart', {
    content_ids: [line.merchandise.id],
    content_type: 'product',
    value: line.cost.totalAmount.amount,
    currency: line.cost.totalAmount.currencyCode
  });
});

analytics.subscribe('checkout_completed', (event) => {
  const c = event.data.checkout;
  fbq('track', 'Purchase', {
    content_ids: c.lineItems.map((i) => i.variant?.id),
    content_type: 'product',
    value: c.totalPrice?.amount,
    currency: c.totalPrice?.currencyCode
  });
});

Check that the IDs you send match the IDs in your Meta product catalogue (variant IDs versus product IDs; more on that below). A custom pixel is browser-side only, so on its own it doesn't give you the Conversions API. If you need both full control and CAPI, you'll need a server-side solution as well.

Understanding the Conversions API (CAPI)

The Conversions API is Meta's server-side tracking. Instead of relying only on JavaScript in the shopper's browser (which ad blockers, privacy browsers and iOS restrictions can stop), CAPI sends event data from a server to Meta's servers.

  • Ad blockers can block the pixel script. Server events aren't affected by them.
  • iOS and browser privacy features, such as Safari's Intelligent Tracking Prevention and Firefox's Enhanced Tracking Protection, limit cookies and tracking scripts.
  • Better matching: server events can include hashed customer details that help Meta match events to people.

Running the pixel and CAPI together: event deduplication

The recommended set-up is to run both the browser pixel and CAPI. To stop Meta counting every conversion twice, both copies of an event carry the same event_id; when Meta receives two events with the same ID and name, it keeps one. When you use the Facebook & Instagram app at Enhanced or Maximum, the integration handles the pixel and the server events together, which is one more reason to use it unless you have a specific need for custom code.

How to manage pixels for Meta on Shopify

Over time, stores collect pixels: one from the Facebook app, one a previous developer pasted into the theme, one from a tracking app. Here's how to manage pixels for Meta on Shopify so your Shopify pixel setup has exactly one source:

  1. Open Settings > Customer events. The list shows app pixels (added by apps such as Facebook & Instagram) and custom pixels. Disconnect or delete any custom pixels you don't use. App pixels can't be removed here: uninstall the app (or remove the sales channel) that added them, or change the pixel in that app's own settings.
  2. Open your theme code (Online Store, then the ... menu next to your theme > Edit code) and search theme.liquid and your snippets for fbq( or connect.facebook.net. Old hard-coded pixels are a common cause of duplicates.
  3. Check other apps (reviews, upsells, tracking suites) for their own Meta settings.
  4. In Meta Events Manager, compare event counts with your Shopify reports. If ViewContent is roughly double your product page views, something is still firing twice.
Shopify Customer events page listing app pixels from Google and YouTube and Microsoft Clarity
Customer events lists every pixel. These two were added by apps, so they're changed or removed in the app that added them, not here.

Duplicate pixels don't just double-count: every extra tracking script is more code for the browser to load. I cover how to find the apps and scripts slowing a store down in your Shopify apps are slowing down your store.

Shopify's Thank you and Order status pages have also moved to the new checkout system (26 August 2026 was the final deadline to upgrade), so old purchase tracking pasted into checkout "Additional scripts" is no longer the way to track orders. Purchase tracking now belongs in the Facebook & Instagram app or in a pixel subscribed to checkout_completed.

Testing your Meta Pixel

Meta Events Manager: Test events

In Meta Events Manager, open your pixel and go to Test events. Enter your store's URL, open the site, then browse, add products to the cart and start checkout. Events should appear in real time.

Meta Ads Data Advisor (formerly Meta Pixel Helper)

Meta's free Meta Ads Data Advisor extension for Chrome and Edge (it used to be called the Meta Pixel Helper, and existing installs update automatically) shows which pixel events fire on a page and flags errors. Check that:

  • PageView fires on every page
  • ViewContent fires on product pages with the right product ID, value and currency
  • AddToCart fires when you add a product, with the right product data and value
  • Purchase fires once per order with the correct order value and currency

Note that custom pixels run in a sandbox on Shopify, so a browser extension may not see them the way it sees theme code. To check a custom pixel, open it under Settings > Customer events and click Test, which opens Shopify's own Pixel Helper on your store. Events Manager's Test events view is the other reliable check.

Test a real purchase

The only way to fully verify purchase tracking is to place a test order, for example with Shopify's Test payment gateway (search for "Bogus" under Settings > Payments) or Shopify Payments' test mode, then check Events Manager for one Purchase event with the right value.

Common Meta Pixel and Shopify problems

Duplicate events

The most common problem. It happens when the Facebook & Instagram app and a custom pixel (or old theme code) fire the same events. Choose one method and remove the others, using the checklist above.

Missing Purchase events

Usually caused by purchase tracking that still relies on old checkout scripts, or a custom pixel that doesn't subscribe to checkout_completed. Server-side events through the Conversions API also make purchases far less likely to go missing.

Incorrect product IDs

Your pixel's product IDs must match the IDs in your Meta product catalogue. If the pixel sends Shopify variant IDs but the catalogue uses product IDs (or the other way round), Meta can't match purchases to products. That breaks dynamic product ads and catalogue-based audiences.

Currency mismatches

If you sell in several currencies with Shopify Markets, make sure events send the currency the customer actually paid in. A £50 purchase reported as 50 USD distorts your ROAS.

Using your pixel data for better ads

  • Custom audiences: retarget people who viewed products, added to cart but didn't buy, or bought (for cross-sell)
  • Lookalike audiences: find new customers who resemble your buyers. The more purchase data, the better they work
  • Advantage+ sales campaigns: Meta's automated sales campaigns lean heavily on pixel data
  • Dynamic product ads: show the right products to the right people. Needs correct ViewContent and AddToCart events with matching catalogue IDs

Dynamic product ads use your product photos, so the pictures matter as much as the data. See my Shopify product image size guide for sizes and formats, and how AI product photography works if you need more on-model or lifestyle images to test in your ads.

Tracking is only half of it: the store still has to convert the traffic you pay for. My guide to fixing a low Shopify conversion rate covers that side, and if you also use Google Analytics, see how to set up GA4 on Shopify.

The bottom line

A properly configured Meta Pixel with the Conversions API isn't optional for Shopify stores running Facebook or Instagram ads. Without accurate conversion data, Meta can't optimise your campaigns, your ROAS reporting is wrong and your audiences are weaker. Set it up once, test it properly, then get back to making great ads and products.

If your tracking is double-counting, missing purchases or you'd simply rather someone else did it, I set up and fix GA4 and Meta Pixel tracking for Shopify stores. Get in touch for a quote, or read what a Shopify developer costs first.

Meta Pixel on Shopify: frequently asked questions

How do I add the Meta Pixel to my Shopify website?

Install the Facebook & Instagram sales channel, connect your Meta account, then go to Sales channels > Facebook & Instagram > Settings > Data sharing settings, turn on customer data sharing, choose a level and connect your pixel. Alternatively, add it as a custom pixel under Settings > Customer events.

What is the best Shopify pixel app for Meta?

For most stores, the free Facebook & Instagram app. It connects the pixel and, at the Enhanced or Maximum data-sharing level, adds Meta's Conversions API without any code.

How do I set up the Meta Pixel using Customer events?

Go to Settings > Customer events, name a new pixel, click Add pixel, set the customer privacy options, paste Meta's base code plus code that subscribes to Shopify events (such as product_viewed and checkout_completed) and fires the matching Meta events, then Save and Connect pixel.

Which Meta Pixel events should a Shopify store track?

At minimum PageView, ViewContent, AddToCart, InitiateCheckout and Purchase. ViewContent, AddToCart and Purchase matter most for retargeting and purchase optimisation.

Which data-sharing level should I choose?

Enhanced or Maximum. Standard uses the browser pixel only; Enhanced and Maximum add the Conversions API, which sends the purchase event server to server so ad blockers can't stop it.

Why is my Meta Pixel counting purchases twice?

Usually two copies of the pixel are running, such as the Facebook & Instagram app and a custom pixel or old theme code. Keep one, remove the others and check Settings > Customer events and theme.liquid.

Developer-Guy
Written by Richie, Developer-Guy

Shopify Partner since 2020 and the developer behind Intellify, SmartTrade Pro, Schema Clinic and PosesWith. Hire me for your Shopify project.

All posts Talk to a Shopify developer