Free guide · Tracking · 8 min read

Is your pixel lying to you?

Removed a tracking app? How to find leftover Facebook pixel code in Shopify

Uninstalling a tracking app can leave pixel code in your Shopify theme. Where to look (theme.liquid, Customer events, checkout settings), what to search for, and a 10-minute test.

  • Why leftover code causes double counting
  • Where leftover code hides in Shopify
  • How to remove it safely

Get the free PDF that goes with this guide:

  • Free. No card, no sales call.
  • Short. Use it the same day.
  • No spam. A few useful emails, unsubscribe in one click. Privacy

or read the guide first

Free PDF that goes with this guide:
Is Your Pixel Lying?

On this page
  1. Why leftover code causes double counting
  2. Where leftover code hides in Shopify
  3. How to remove it safely
  4. Test it in 10 minutes
  5. Questions people ask
  6. Sources

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

  1. Duplicate your theme first (Online Store > three-dot menu > Duplicate). Shopify recommends this before any code edit.
  2. Decide what stays. Usually that is the Facebook & Instagram app (or one tracking app). Everything else that sends Meta events goes.
  3. Delete only the Meta code block. In theme.liquid, the base code runs from <!-- Meta Pixel Code --> (or a script that loads fbevents.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.
  4. Disconnect old custom pixels in Settings > Customer events. Leave them disconnected for a day before you delete them.
  5. Clean up checkout scripts if old Purchase code is there and your current setup already tracks Purchase.
  6. Save, then test (next section). If something breaks, publish the backup theme.

Test it in 10 minutes

  1. 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.
  2. 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.
  3. Add a product to the cart. One AddToCart event should fire, not two.
  4. 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.
  5. 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.
  6. 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

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.

Free PDF

Find where your tracking breaks

Ads Manager says 40 purchases. Shopify says 61. Or the other way round. This checklist finds where your Meta, Google and TikTok tracking breaks, in about 30 minutes.

  • Free. No card, no sales call.
  • Short. Use it the same day.
  • No spam. A few useful emails, unsubscribe in one click. Privacy

Free PDF

Is your pixel lying to you?

Ads Manager says 40 purchases. Shopify says 61. Or the other way round. This checklist finds where your Meta, Google and TikTok tracking breaks, in about 30 minutes.

  • Free. No card, no sales call.
  • Short. Use it the same day.
  • No spam. A few useful emails, unsubscribe in one click. Privacy

Keep reading

More free guides

TrackingWhy Meta purchases don't match your Shopify orders (and how to fix it)A gap between Ads Manager and Shopify is normal. A big one means duplicate pixels, broken dedup or no server events. How to tell which, and fix it.Ad creativeHow to test ad creative on Meta: hook rate, hold rate and a simple hook testAn ad creative testing guide for Meta ads: what to test first, the same-body new-hook method, a spend limit set in advance, and how to read hook rate, hold rate and cost per purchase.Client workFacebook ads client onboarding checklist: every access you need, without passwordsA Facebook ads client onboarding checklist for media buyers: Meta partner access, Google and TikTok links, the numbers to agree and the ground rules, before launch.Ad creativeHook rate in Meta Ads: how to add it (and hold rate) as a custom metricHook rate in Meta ads = 3-second video plays / impressions. How to build hook rate and hold rate as custom metrics in Ads Manager in 5 minutes, what each number means, and how to read them.TrackingCheck your tracking before Black Friday: a 30-minute pre-flight checklistA BFCM tracker checklist for Shopify and WooCommerce on Meta: a 30-minute Black Friday and Cyber Monday tracking check. Test a real order, check dedup, values, apps and consent.TrackingMeta Pixel and Conversions API deduplication: how event_id worksFacebook CAPI events deduplication for server-side tracking: why Meta counts some purchases twice when you run the Pixel and Conversions API, how event_id and event_name deduplicate them, and how to test it in 10 minutes.TrackingMeta Event Match Quality: what the score means and how to raise itHow to improve event match quality on Facebook and Meta CAPI: what the EMQ score out of 10 measures, which customer parameters raise it, how to hash them, and a 10-minute check.Tracking"Event_source_url is missing" in Meta Events Manager: what it means and how to fix itevent_source_url in Meta CAPI: why Events Manager says it is missing, which server events need it, the action_source mistake behind most warnings, and a 10-minute test.TrackingGoogle Ads missing conversions on Shopify? 7 checks before BFCMGoogle Ads conversion tracking problems on Shopify? Fewer purchases than orders: check click-date reporting, conversion status, primary actions, duplicate tags, consent and enhanced conversions.TrackingShopify keeps connecting the wrong Facebook account? How to fix itWhy the Shopify Facebook & Instagram app picks your personal profile or the wrong business, what Shopify and Meta require, and the clean reconnect steps from their own help pages.TrackingShopify data sharing levels: Standard vs Enhanced vs Maximum for MetaWhat each Shopify customer data sharing level sends to Meta, why Standard is pixel only, where to change it in the Facebook & Instagram app, and a 10-minute test after you switch.TrackingGA4 counting duplicate purchases? How transaction_id fixes itGA4 showing more purchases than orders? Why duplicate purchase events happen, how GA4 deduplicates by transaction_id, the empty-string trap, and a 10-minute check you can run today.TrackingPayPal and Stripe showing as referrals in GA4? Here's the fixpaypal.com or checkout.stripe.com showing as a referral in GA4 and taking credit for your sales? Add them to List unwanted referrals in 5 minutes, then test it with one order.TrackingMeta pixel not tracking purchases on Shopify? 8 checks in orderFacebook pixel not tracking purchases on Shopify? Check the app connection, data sharing level, consent, upsell apps, disconnected pixels and the Purchase value, then run a 10-minute test order.