On this page
Short answer: uninstalling a tracking app does not always remove its code. Shopify's own help page says some apps add code to your theme "that isn't automatically removed" when you uninstall them. If that old code still loads the Meta Pixel, every page view, add to cart and purchase can fire twice: once from the old code and once from your current setup. To find it, look in three places: your theme code (search for fbevents.js, fbq( and facebook.com/tr), Settings > Customer events (old custom pixels and app pixels), and any checkout scripts. Then open your store with Meta's browser extension and count how many pixels and Purchase events fire.
A store owner on the Shopify App Store left a 1-star review after removing a tracking app, because its code was left all over the theme. It happens a lot, and it is one of the quieter causes of Meta purchases not matching Shopify. This guide shows where leftover code hides, how to remove it safely, and how to confirm in 10 minutes that only one setup is sending events.
Why leftover code causes double counting
The Meta Pixel counts what the browser tells it. If two pieces of code load the pixel on the same page, Meta can receive the same event twice. Meta's own troubleshooting list for the pixel includes "Duplicate Pixel code" and says to make sure the code isn't duplicated on a single page.
Browser and server copies of the same event are a different story. Meta merges those when both carry the same event name and event ID (see Meta CAPI deduplication and event_id). Old app code rarely uses the same event IDs as your new setup, so its events don't get merged with anything. They just add up.
What you see in reports:
| Symptom | Likely leftover |
|---|---|
| Meta shows more purchases than Shopify has orders | Old pixel code firing Purchase on the thank-you page |
| Two pixel IDs on your store | An old pixel from a previous agency, app or Business Manager |
| PageView or AddToCart counts look about double | Base pixel code still in theme.liquid next to the app pixel |
| Events Manager warnings for a source you don't use any more | An old app pixel, custom pixel or server connector still sending |
Where leftover code hides in Shopify
1. Your theme code (theme.liquid and snippets)
This is the most common place. Shopify's help page on editing theme code gives the path: Online Store, then the three-dot menu next to your theme, then Edit code. It also says to duplicate your theme first, so you have a backup you can go back to. Do that before you change anything.
Open theme.liquid (in the Layout folder) and use the code editor's search for these strings. They all come from Meta's standard pixel base code:
fbevents.js(the script the pixel loads from connect.facebook.net)fbq('init'(the line that starts a pixel, followed by the pixel ID)fbq('track'(lines that send events like PageView or Purchase)facebook.com/tr?id=(the no-script image fallback)
Also check the Snippets folder. Apps often put their code in a snippet with the app's name and add one {% render 'snippet-name' %} line to theme.liquid. If the app is gone, both the snippet and the render line can stay.
Write down every pixel ID you find. If an ID is not the one in your current Meta dataset, that code is almost certainly a leftover.
2. Settings > Customer events (custom pixels and app pixels)
Shopify manages pixels from Settings > Customer events. There are two kinds:
- Custom pixels are code someone pasted in by hand. Shopify's help says disconnecting a custom pixel doesn't delete it, and deleting one can't be undone. If a custom pixel contains Meta code you no longer use, disconnect it first, test, then delete it.
- App pixels belong to installed apps. Shopify's page shows them in the same section with a "More options" menu and an activity log. If you see a pixel for an app you don't use, uninstall that app properly and check again.
Shopify's custom pixel docs also give a clear warning: before you add a pixel, remove or change any existing pixels "to ensure customer events aren't counted twice". The places they name are theme.liquid, checkout.liquid (Shopify Plus only) and the Additional scripts in your checkout settings.
3. Checkout scripts
Older stores often pasted Purchase tracking into the Additional scripts box in checkout settings, or into checkout.liquid on Shopify Plus. Shopify has been moving checkout and the thank-you page to the newer checkout editor and Customer events, so what you see here depends on your store. If you still have an Additional scripts box with Meta code in it, check whether that code is still running (the test below will tell you) and remove it if your current setup already sends Purchase.
4. Apps you still have
The leftover is not always from a removed app. Two installed apps can both send Meta events, for example Shopify's Facebook & Instagram app plus a separate tracking app. Pick one owner for Meta events and turn the other one off. If the Facebook & Instagram app itself is linked to the wrong business, see Shopify connecting the wrong Facebook account. The same goes for Google: an old gtag( snippet can keep sending to a Google Ads conversion action you no longer watch (see Google Ads missing conversions on Shopify).
How to remove it safely
- Duplicate your theme first (Online Store > three-dot menu > Duplicate). Shopify recommends this before any code edit.
- Decide what stays. Usually that is the Facebook & Instagram app (or one tracking app). Everything else that sends Meta events goes.
- Delete only the Meta code block. In theme.liquid, the base code runs from
<!-- Meta Pixel Code -->(or a script that loadsfbevents.js) to the closing</noscript>. Remove that block and any{% render %}line for the old app's snippet. Don't delete lines you can't identify. If you are not sure, ask the app developer, which is also what Shopify's uninstall page suggests. - Disconnect old custom pixels in Settings > Customer events. Leave them disconnected for a day before you delete them.
- Clean up checkout scripts if old Purchase code is there and your current setup already tracks Purchase.
- Save, then test (next section). If something breaks, publish the backup theme.
Test it in 10 minutes
- Install Meta Ads Data Advisor (this is the extension that used to be called Meta Pixel Helper). Meta describes it as a free extension for Chrome and Edge. Its side panel shows which pixels it finds on a page and whether they loaded.
- Open your home page and a product page. Count the pixels. You should see one pixel ID, the one in your current dataset. Two IDs, or the same ID listed twice, means there is still extra code.
- Add a product to the cart. One AddToCart event should fire, not two.
- Place a test order (a cheap product or a 100% discount code) and stay on the thank-you page. Data Advisor should show one Purchase. Then reload the page once and check that a second Purchase does not appear.
- Check Events Manager. In your dataset, open the Purchase event and look at how it is received (browser, server, and which integration). Every source listed there should be one you actually use. An integration you don't recognise is a leftover to track down.
- Compare for a week. Over the next 7 days, compare Meta purchases with Shopify orders for the same dates. The free purchase gap checker does the maths and tells you what a gap that size usually means.
If Meta still reports more purchases than you have orders after the cleanup, the next suspect is browser and server events without a shared event ID. The CAPI deduplication guide covers that, and the free 15-point tracking audit walks through every other common leak before Black Friday. For the full pre-BFCM list, see the BFCM tracking checklist.
Questions people ask
Does uninstalling a Shopify app remove its code?
Not always. Shopify's help page says some apps add code to your theme that isn't removed automatically when you uninstall them, and that you should check with the app developer whether there are extra uninstall steps. Check theme.liquid, your snippets and Settings > Customer events after you remove any tracking app.
How do I find old Facebook pixel code in my Shopify theme?
Go to Online Store, open the three-dot menu on your theme and click Edit code. Open theme.liquid and search for fbevents.js, fbq('init' and facebook.com/tr. Each fbq('init' line has a pixel ID next to it. Any ID that isn't your current pixel is old code. Duplicate the theme before you delete anything.
Can I have two Meta pixels on one Shopify store?
It is possible, but every pixel you load sends its own events, and two copies of the same pixel cause duplicates. Meta's own troubleshooting list includes duplicated pixel code on a page. For most stores the simple setup is one pixel, sent from one place, with the Conversions API on top.
Why does Meta show more purchases than Shopify after I switched tracking apps?
Usually because the old app's code still fires Purchase on the thank-you page next to the new one. The two copies don't share an event ID, so Meta counts both. Remove the old code, then place a test order and check that only one Purchase fires.
Is it safe to delete pixel code from theme.liquid?
Yes, if you only remove the Meta code block and you have a backup. Shopify recommends duplicating your theme before editing code, so you can go back if something breaks. If you can't tell where the app's code starts and ends, ask the app developer before deleting.
What is Meta Ads Data Advisor?
It is the new name of the Meta Pixel Helper, a free browser extension for Chrome and Edge. It shows which Meta pixels are on a page, which events fire and any setup warnings, which makes it the quickest way to spot a leftover pixel.
Sources
- Shopify Help Center: Uninstalling apps
- Shopify Help Center: Editing theme code
- Shopify Help Center: Pixels and Customer events
- Shopify Help Center: Managing custom pixels
- Shopify Help Center: App pixels
- Meta for Developers: Meta Pixel get started (base code)
- Meta for Developers: Meta Ads Data Advisor, formerly Meta Pixel Helper
Platform menus and defaults change often. This guide reflects them as of 27 Nov 2026. Nothing here promises results: they depend on your store, offer, budget and execution.