The simplest way to add the Meta Pixel to Shopify is the Facebook & Instagram sales channel: open its data sharing settings, turn data sharing on, choose a level and connect or create your pixel. To add the pixel manually, paste Meta's pixel code as a custom pixel under Settings > Customer events, not into your theme.
TL;DR
- Use the Facebook & Instagram sales channel unless you have a reason not to. It connects the pixel without code.
- Choose the Enhanced or Maximum data sharing level to add the Conversions API. Standard uses the browser pixel only.
- To add the pixel manually, go to Settings > Customer events and add a custom pixel.
- Use one method only. Remove old pixel code from theme.liquid and checkout Additional scripts, or events count twice.
- Check the pixel with Test events in Events Manager before you spend on ads.
- Custom pixels track checkout and post-purchase pages without theme edits, but they need JavaScript knowledge.
Which method should I use?
| Method | Best for | Conversions API | Effort |
|---|---|---|---|
| Facebook & Instagram sales channel | Most stores | Yes, at the Enhanced or Maximum level | Low, no code |
| Custom pixel in Customer events | Stores that need custom events or can't use the channel | Not included; server events need a separate setup | Medium, JavaScript |
| Code pasted into theme.liquid | Old setups only | No | Shopify says to remove it before using either method above |
How do I add the Meta Pixel with the Facebook & Instagram sales channel?
First set up the Facebook & Instagram by Meta sales channel and connect a Facebook ad account. Then follow Shopify's steps for connecting a Meta pixel:
- In your Shopify admin, go to Sales channels > Facebook & Instagram.
- Click Settings, then open the data sharing settings.
- In the Customer data-sharing section, turn on the Enable data-sharing toggle.
- Choose a data-sharing level.
- Select your pixel. Click Connect for an existing pixel, or Create new for a new one.
- Click Confirm.
If you pasted pixel code into your theme in the past, remove it now. Shopify notes that the old code sits between the head tags in theme.liquid and would duplicate your data. Data appears only once customers visit your store, so test it straight away with your own visit. If you aren't sure which pixel to pick, here is how to find your pixel ID.
Let Madgicx's AI do the work
Its AI marketer finds what's working and prepares the next move. You approve.
Try for Free ($0 Trial)Which data sharing level should I choose?
Shopify offers three data sharing levels for Meta:
- Standard uses only the Meta pixel in the browser. Shopify warns that a browser ad blocker can stop it from sharing data.
- Enhanced adds the Conversions API and sends purchase events from server to server. It shares customer details such as name, location, email and phone, so Meta can match buyers to accounts.
- Maximum uses the pixel and the Conversions API, and Shopify says it is updated with Meta's latest advertising technology. It shares the same customer details as Enhanced.
For most stores that run Meta ads, Enhanced or Maximum is the better choice. Shopify says server-to-server data can't be blocked by browser ad blockers, so fewer purchases go missing. Data sharing is your choice: Shopify asks merchants to disclose it to customers and keep their privacy policy current. Read more about the Conversions API.
How do I add the Facebook Pixel to Shopify manually?
Adding the pixel manually means creating a custom pixel. Shopify's custom pixel steps are:
- Remove or change any existing pixels first, including code in theme.liquid and checkout Additional scripts. If the Facebook & Instagram channel already shares data with the same pixel, don't send the same events from both.
- In your Shopify admin, go to Settings > Customer events.
- Enter a unique name for the pixel, then click Add pixel to open the editor.
- Optional: in Customer privacy, set Permission to Required or Not required.
- Paste your code into the Code window.
- Click Save, then click Connect pixel to start tracking.
Your code needs Meta's pixel base code plus the standard events you want, such as Purchase. Meta's pixel setup guide says the base code sends a PageView each time a page loads.
Custom pixels can track more of your store, including checkout and post-purchase pages, without editing your theme. They run in a restricted sandbox, so some standard pixel code needs changes. Shopify doesn't support custom pixel code itself and suggests a Shopify Partner if you need help. If you manage tags in Google Tag Manager, see our guide to adding a pixel through Google Tag Manager.
How do I check that the pixel works?
- In Meta Events Manager, open your dataset and choose Test events.
- Open your store, view a product, add it to the cart and place a test order.
- Confirm each event shows once. The purchase should carry a value and a currency.
- If one page view shows twice, an old copy of the code is still running. Remove it.
- After a week of traffic, compare purchases in Ads Manager with your store orders. Our answer on why Ads Manager results differ from revenue explains a normal gap.
Should I add the Conversions API as well?
Yes, for most stores. Meta recommends a redundant setup of the pixel plus the Conversions API, and removes duplicates when the event name and event ID match. On Shopify, the Enhanced and Maximum levels add the Conversions API for you. With a custom pixel, server events need their own setup, with the same event ID as the browser event. Our Conversions API setup guide covers the options.
Where Madgicx fits
Madgicx gives your conversion data a second route to Meta. Madgicx tracking sends conversions to Meta from a server, so purchases still arrive when a browser blocks the pixel. Once events flow, its AI chat reads your Meta ad account, explains what changed and finds wasted spend. Any change it suggests, such as pausing an ad or moving budget, waits for your approval.
FAQ
Can I add the Facebook Pixel to Shopify without an app?
Yes, you can add the Facebook Pixel to Shopify without an app by creating a custom pixel under Settings > Customer events. Paste Meta's pixel code there, click Save and then Connect pixel.
Where do I put the Facebook Pixel code in Shopify?
The Facebook Pixel code goes in a custom pixel under Settings > Customer events, not in theme.liquid. Shopify asks you to remove pixel code from the theme first, so events aren't counted twice.
Why is my Facebook Pixel not tracking purchases on Shopify?
A Facebook Pixel on Shopify usually misses purchases because data sharing is off, an ad blocker stops the browser pixel, or two setups conflict. Check the data sharing level, then place a test order with Test events open.
Which Shopify data sharing level should I use for Meta ads?
The Enhanced or Maximum level suits most Shopify stores that run Meta ads, because both add the Conversions API to the pixel. The Standard level sends browser events only, which ad blockers can stop.
Do I need the Conversions API if I have the Meta Pixel on Shopify?
Yes, the Conversions API is worth adding next to the Meta Pixel on Shopify. Meta recommends running both, and Shopify's Enhanced and Maximum levels add it without code.
Can I use the Facebook & Instagram channel and a custom pixel together?
No, the Facebook & Instagram channel and a custom pixel should not send the same Meta events. Shopify says to remove or change existing pixels before adding a custom one, because two setups count events twice.
Related
- How to add a Facebook pixel to your Shopify store, in depth
- Meta Pixel events and how they work
- Glossary: Meta Pixel, Conversions API
More on data quality: how to raise Event Match Quality and the server-side tracking glossary entry.
Sources
- Meta pixel setup in Facebook & Instagram by Meta, Shopify Help Center
- Meta data sharing levels, Shopify Help Center
- Custom pixels, Shopify Help Center
- Managing custom pixels, Shopify Help Center
- Get started with the Meta Pixel, Meta for Developers
- Handling duplicate Pixel and Conversions API events, Meta for Developers