Contact
E-commerceNov 24, 2026ยท26 min read

Shopify App Bloat: Where App Scripts Come From on 40 Stores

KT
Keplaris TeamNov 24, 2026
Illustration of a dark storefront wired to frosted app boxes by blue and green cables on its roof, with grey cables running to cloudy boxes, two of them plugged into its side

Shopify apps do slow stores down, and most of the app code we measured came through theme app extensions, the channel Shopify removes when you uninstall. On the 37 of 40 Shopify example stores that loaded any app scripts, those scripts added a median 354 KB of compressed JavaScript (1,148 KB decoded) and 326 ms of main-thread script time, a median 22% of each store's JavaScript.

This post covers Shopify app bloat only; for images, themes and fonts, see the full order of speed fixes. We are Keplaris, a New York product engineering studio, and we do app audits as part of our Shopify e-commerce work.

There is also a deadline: Shopify stops injecting script tags on March 1, 2027, and 78.7% of the 2,761 open storefronts in our census still load at least one.

Everything below is a lab test of homepages from one machine on 2026-11-24, not real-user data. The limits are listed in full near the end, and the scripts and anonymised data are at the bottom. If you are reading this during Black Friday week, take the inventory now and make cuts after Cyber Monday, November 30.

Do Shopify Apps Slow Down Your Store?

Yes, some do, and the cost depends on the channel. Apps add JavaScript through four channels: theme app extensions (app blocks and embeds), script tags, web pixels, and code pasted into the theme. The first two carried most of the app weight we measured, and Shopify removes both on uninstall. Pasted code stays until someone deletes it.

Shopify documents the uninstall rules plainly:

  • Script tags: "When an app is uninstalled from a shop, all of the script tags that it created are automatically removed along with it" (shopify.dev, ScriptTag).
  • Theme app extensions: on uninstall, "blocks associated with the apps are automatically and entirely removed from online store themes" (shopify.dev, theme app extension UX).
  • Pasted code: "Some apps add code to your online store theme that isn't automatically removed when you uninstall the app" (Shopify Help Center).

Across our 40 stores, theme app extensions were 18.4% of all JavaScript bytes and script tags 9.4%, against 7.0% for hard-coded third-party scripts. Shopify's own platform code was the largest single line at 49.7%, and that is not app code.

Four Ways an App Puts Code on Your Storefront

Each channel shows up differently in page source and comes off differently.

ChannelWhere it shows in page sourceRemoved on uninstall?How to switch it offAfter March 1, 2027
App block (theme app extension, placed in a section)Between <!-- BEGIN app block: shopify://apps/<handle>/... --> and <!-- END app block --> inside a sectionYes (shopify.dev)Remove the block in the theme editorNo change
App embed (theme app extension, injected before </head> or </body>)The same comments, near the end of the head or bodyYes (shopify.dev)Theme editor, App embeds, toggle off (per theme)No change; it is a replacement for script tags
Script tag (ScriptTag API)A URL in the urls array of the asyncLoad function in Shopify's header codeYes (shopify.dev)Uninstall the app, or ask its developer to move to an embedShopify stops injecting it
Web pixelShopify's web pixels manager code; the pixel itself runs elsewhere. App pixels run "in a strict sandbox environment using web workers"; custom pixels run in an iframe with allow-scripts and allow-forms (shopify.dev)Not stated in the pages we citeCustom pixels: Settings > Customer eventsNo change; it is a replacement for script tags
Pasted theme code<script> or <script src> in theme.liquid, snippets or sections, outside app block commentsNo (Help Center)Edit the theme code, on a duplicate theme firstNo change

App embeds are off by default: "By default, app embed blocks are deactivated after an app is installed," and "Shopify renders and injects app embed blocks before HTML </head> and </body> closing tags" (shopify.dev, configuration).

Admin-created custom apps cannot use theme app extensions, so Shopify's script tag deprecation page says the script has to move into the theme (a custom Liquid block where possible) if you or your agency maintain the app, and that a third-party service that had you paste in a token needs to release a real app.

What We Measured on 40 Shopify Stores

We loaded the homepage of every store on Shopify's examples page (42 listed, 40 measured in both runs) and labelled each script by the channel that put it there. Theme app extensions were the heaviest app channel by bytes and by main-thread time; script tags were present on more stores but lighter per store.

Labels, in plain words:

  • Theme app extension (app blocks and embeds): inside a BEGIN app block comment, or served from cdn.shopify.com/extensions/.
  • Script tag: listed in the asyncLoad urls array, with blocked.invalid entries excluded.
  • Hard-coded third party (pasted): a third-party script whose URL is written in the theme HTML outside app blocks, as a <script src> or as a URL inside inline code, and is not a Shopify host or the store's own domain. An uninstall will not remove it. It is not the same as leftover code: it also holds deliberate includes such as a library from a public CDN.
  • Theme: the theme's own files and the store's own domain. Shopify platform: Shopify's hosts, including shopifycloud.com. Web pixel: scripts in Shopify's sandboxed pixel iframes, plus any other iframe script we could not trace.
  • A script whose URL is not in the HTML takes the label of whatever loaded it. Third-party scripts built by inline code outside app blocks, or with no traceable initiator, get their own row. That row is not app-free, so every app figure here is a floor.

We report blocking time, defined as "the sum of long-task time over 50 ms, from first contentful paint to 10 s after load, main frame only." It is not Lighthouse's Total Blocking Time, which stops at Time to Interactive, so don't compare it with Lighthouse or PageSpeed Insights numbers.

JavaScript bytes by channel

Per store, we took the mean of the two runs; medians are over the stores where the channel is present.

ChannelStores (n of 40)Median KB, compressedp90 KB, compressedMedian KB, decodedMedian requestsShare of all JS bytes
Theme app extension (app blocks and embeds)313321,0221,1062818.4%
Script tag3310946835369.4%
Hard-coded third party (pasted)255757730827.0%
Third-party scripts whose URL is not in the HTML (built by inline code, or no traceable initiator)191501,00045178.3%
Theme397526926155.7%
Shopify platform408321,3712,8594249.7%
Web pixel (sandbox iframes; worker time not measured)21537914721.6%

The median store loaded 1,474 KB of compressed JavaScript (p90 3,166 KB), 4,994 KB once decoded. On the 37 stores with any app script, the app channels together came to a median 354 KB compressed (p90 1,462 KB).

Main-thread time by channel

Same 40 homepages, lab test with a 4x CPU throttle, mean of two runs per store; medians are over the stores where the channel is present.

ChannelStores (n of 40)Median main-thread script time, msShare of all script time
Theme app extension (app blocks and embeds)3123918.8%
Script tag33797.5%
Hard-coded third party (pasted)251517.5%
Third-party scripts whose URL is not in the HTML (built by inline code, or no traceable initiator)19568.2%
Theme3912511.1%
Shopify platform4062837.6%
Web pixel (sandbox iframes; worker time not measured)21240.7%
Inline code outside app blocks (theme, pasted snippets, Shopify header code), plus unattributed samplesn/an/a8.6%

App scripts took a median 326 ms of main-thread script time on stores with apps (p90 1,850 ms), a median 18% of each store's script time. The numbers come from a CPU sampling profile at a 200 microsecond interval, so very short functions can be missed and time is credited to the script at the top of each sample, not to whoever called it. App pixels run in web workers, which this profile does not record.

Two readings stand out. Hard-coded third-party scripts had a lower byte median than script tags but a higher median main-thread time (151 ms against 79 ms), so bytes alone undersell them. And because extension code is served from cdn.shopify.com, tools that sort scripts by domain, such as Lighthouse's third-party summary or the Treemap grouped by origin, file it under Shopify and make apps look smaller than they are. The cdn.shopify.com/extensions/<uuid>/<handle>-<version>/ path we use to spot it is something we observed, not a contract Shopify documents.

What blocking app scripts changed

We then reloaded each store once with its theme app extension and script tag URLs blocked, plus hosts that only apps used.

Blocked mode, one run (approximate: can over- or understate)Result
Stores with app requests blocked37 of 40
Requests blocked per storemedian 6
Blocking time, normal (mean of 2 runs) vs app scripts blockedmedian 466 ms vs 304 ms
Per-store change in blocking timemedian -60 ms; range -1,072 to +75 ms; fell on 32 of 37
Total JavaScript, compressed, normal vs app scripts blockedmedian 1,550 KB vs 1,138 KB
Per-store change in JavaScriptmedian -431 KB

Read the timing as rough. This is one blocked run, and blocking time moved by a median 41 ms between two normal runs of the same store, so the -60 ms median change is not far above that noise. The direction is clearer than the size: blocking time fell on 32 of 37 stores.

Does the number of apps predict blocking time?

In this sample it did, roughly. We counted "app sources" per store: each theme app extension handle and each script-tag host that loaded JavaScript counts as one, so a vendor that uses both channels counts twice. One extension can also count twice when its block handle and its file folder name differ (S19's cookie banner counts as two), so the counts run high. The median was 4, the maximum 16.

40 homepages, lab blocking time and compressed JavaScript, mean of two runs per store:

App sources per storeStoresMedian blocking timeMedian total JS, compressed
03163 ms854 KB
1 to 28183 ms922 KB
3 to 514375 ms1,365 KB
6+15799 ms2,616 KB

Total JavaScript climbs with the count, the groups are small (3 stores have no app sources), and nothing else is held equal: bigger brands may simply run bigger themes and more apps. Use a high count as a reason to measure, not as a verdict on any single app.

How we ran it

  • Sample: every store linked from Shopify's examples page, a curated showcase. All 42 hosts appear in that page's source; 40 were measured in both runs. The other 2 failed in both runs (one returned 403, one failed our Shopify storefront check) and were dropped. The browser script loads only these public homepages; the census script (next section) checks robots.txt first.
  • Runs: two runs on 2026-11-24, finished at 05:37 and 05:54 UTC; the blocked-mode run finished at 06:11 UTC and used the second run's script lists.
  • Browser: headless Chrome 158.0.8127.88, driven by puppeteer-core 24.10.0 (pinned) on Node v24.20.0, on an Apple Silicon Mac. The script's user-agent string says Chrome 142; the browser was 158.
  • Conditions: mobile viewport (412 by 823 at 2x), 4x CPU throttle on top of the Mac, no network throttling, cache disabled, homepage only, recorded until 10 s after the load event. One network location (the runner is on Pakistan time, UTC+5), so latency to each store's servers differs from what your visitors see.
  • Stability: the same app list in 38 of 40 stores across the two runs; app JavaScript bytes differed by a median 0.1% and blocking time by a median 41 ms.
  • Parser fix: our first runs found no script tags because the asyncLoad pattern was wrong. We fixed it on 2026-11-24 and discarded every run made before the fix.

One store traced: S27

Store S27 is one of the stores on Shopify's examples page. We don't name it, and every host below is replaced with a letter: script-tag paths carry the store's name, and we don't single out vendors. Here is how its app code got onto the homepage, read from page source on 2026-11-24.

1. The script tags. Shopify's header code holds the asyncLoad function. Paths and queries are cut to ...:

<script>(function() {
  var isLoaded = false;
  function asyncLoad() {
    if (isLoaded) return;
    isLoaded = true;
    var urls = ["\/\/[host A]\/...","https:\/\/[host B]\/...","https:\/\/[host C]\/...","\/\/[host D]\/...","https:\/\/[host E]\/...","https:\/\/[host F]\/..."];

Six script tags from six hosts. One of them did not load any JavaScript in either of our runs.

2. The app block comments. Four comments from three apps, one app with two blocks:

<!-- BEGIN app block: shopify://apps/[app 1]/blocks/[block]/[id] -->
<!-- BEGIN app block: shopify://apps/[app 1]/blocks/[block]/[id] -->
<!-- BEGIN app block: shopify://apps/[app 2]/blocks/[block]/[id] -->
<!-- BEGIN app block: shopify://apps/[app 3]/blocks/[block]/[id] -->

3. The hard-coded scripts. Outside any app block, the theme has <script src> tags for two hosts, one of them a public CDN, plus an inline snippet left by a subscription app that loads its own copy of jQuery from another public CDN:

<!-- [app name] ... End Liquid Code -->
<script type="text/javascript" defer src='//[host G]/' id="..." ...></script>

4. What each channel cost (mean of two runs, from the per-store CSV at the end):

S27 channelKB, compressedMain-thread ms
Theme app extension6281,218
Script tag468377
Hard-coded third party41770
Loaded by inline code or untraceable296not split out
Theme344not split out
Shopify platform243not split out
Total JavaScript2,018

The hard-coded row is the surprise: 41 KB of JavaScript, 770 ms of main-thread time.

5. Blocked mode. With 11 app requests blocked, blocking time went from 901 ms and 866 ms in the normal runs to 696 ms, and JavaScript from 2,018 KB to 767 KB. The JavaScript drop is larger than the two app rows add up to: some theme JavaScript did not load in the blocked run either, which is the follow-on effect that makes this mode approximate.

6. What an uninstall would remove. Uninstalling all of these apps would take out the six script tags and the four app blocks. It would leave the two hard-coded <script src> tags and the subscription snippet with its jQuery, which account for the whole hard-coded row above (including its 770 ms of main-thread time) and part of the inline row. The subscription app shows the split in one vendor: one of the six script tags is on its host, so that part goes on uninstall, while its pasted snippet stays. From outside we can't tell which apps are still installed, so "hard-coded" here means hard-coded, not abandoned.

One more detail from S27 shows why the hard-coded row is a floor. The public-CDN <script src> in its HTML redirects to a versioned file, and our script matches the final URL against the HTML, so it filed that script in the "loaded by inline code or untraceable" row instead.

Shopify Script Tags Stop on March 1, 2027: How Many Stores Still Use Them

Most stores still do: 2,172 of 2,761 open Shopify storefronts (78.7%) in our census load at least one script tag, three months before Shopify stops injecting them. Shopify's deprecation page sets two dates:

  • October 1, 2026: "You can't create or update script tags. Existing script tags keep running."
  • March 1, 2027: "Shopify will stop injecting script tags into storefront pages."

"Pinning to an older API version won't defer it," and "Read and delete operations keep working," so apps can still list and clean up the tags they made. The replacements are app embed blocks and web pixels. On the Order status page this already happened: "They already stopped working on the Order status page" (see our checkout extensibility post).

How we counted: we took the Tranco list 8PW6V (30 days, 2026-10-24 to 2026-11-22), kept the top 200,000 domains whose A record (apex or www) points into Shopify's 23.227.38.0/24 range, and fetched each homepage once, HTML only.

Census, 2026-11-24Result
Tranco top 200,000 domains with A records on Shopify's range2,867
Skipped: blocked or errored (status 403: 52, fetch errors: 33, robots.txt: 6, status 404: 3, statuses 401, 430 and 500: 1 each)97
Skipped: not a Shopify storefront, or a password page9
Open Shopify storefronts measured2,761
At least one live script tag2,172 (78.7%)
Script tags per store, among stores that have themmedian 3, p90 9, max 102
blocked.invalid entries in the script tag list0 (0.0%)
Theme app extension blocks (BEGIN app block)2,532 (91.7%); median 4 apps per store across all 2,761, p90 9
Both script tags and app blocks2,096 (75.9%)
Script tags only / app blocks only / neither76 / 436 / 153
Hard-coded third-party <script src>2,229 (80.7%); median 2 hosts per store
Double-load candidates (lower bound)395 (14.3%)
Shopify web pixels manager present2,675 (96.9%)

Across those stores we saw 1,053 distinct app handles and 876 distinct script-tag hosts, 35 of which appear on at least 2% of stores. We report hosts as counts only.

Double-load candidates are stores where the same non-Shopify host shows up both as a script tag and inside an app block. Shopify warns that "a script tag and its replacement running at the same time will load your script twice." Our 14.3% is a lower bound: the check reads HTML only, so a vendor whose embed loads its script at runtime is missed.

blocked.invalid is a placeholder host that sometimes appears in the script tag list and never loads. Our browser test found 8 such entries on 1 of the 40 example stores. The census found none on the 2,761 storefronts. The census parser does count them: we ran it on the one lab store that has them, which is not in the census sample, and it found all 8. We don't know why they appear and don't guess.

In the lab sample, 35 of the 40 example stores had at least one live script tag URL, and script tags loaded JavaScript on 33.

What to check now: open your homepage source, search for asyncLoad, and list the hosts in its urls array (the snippet in the next section does this). For each host, find the app and ask its developer when their app embed or web pixel ships, and whether they remove the old script tag at the same time.

How to Find Which App Slows Your Store

List what loads, then measure one app at a time on a duplicate theme. In order:

  1. List your installed apps in Settings > Apps, so you can match handles and hosts to names.
  2. Run the console snippet below on your storefront homepage, then on a product and a collection page.
  3. Open the Lighthouse Treemap to see bytes per script. Remember that extension code is listed under Shopify's CDN, not under the app.
  4. Block one app at a time with DevTools network request blocking, using that app's script domains. Shopify's third-party script audit guide recommends exactly this: "Use Network Request Blocking to measure the cost of a specific third-party script before deciding whether to remove it." Run each test several times and compare medians: for repeated Lighthouse audits, Shopify advises using the median "because individual runs vary."
  5. Compare main-thread time and transferred bytes with and without the app (the Performance panel's Bottom-Up tab grouped by URL shows main-thread time per script).
  6. Confirm in the field with Shopify's web performance reports. They use "real user data from the past 30 days," mark "changes made to your online store, such as app installations, theme updates, and new code," and "might be delayed by up to 36 hours."

The snippet reads the raw HTML of the page you are on with fetch(location.href), so its output matches page source. Paste it into the DevTools console:

fetch(location.href).then(r => r.text()).then(html => {
  const m = html.match(/function asyncLoad\(\)\s*\{[\s\S]{0,300}?var urls = (\[[^\]]*\])/);
  const urls = m ? JSON.parse(m[1]).map(u => new URL(u, location.href)) : [];
  const live = urls.filter(u => u.hostname !== "blocked.invalid");
  console.log(`Script tags (asyncLoad): ${live.length} live, ${urls.length - live.length} blocked.invalid`);
  console.log([...new Set(live.map(u => u.hostname))].join("\n") || "none");
  const handles = [...html.matchAll(/<!-- BEGIN app block: shopify:\/\/apps\/([^/]+)\//g)].map(b => b[1]);
  console.log(`App block handles: ${[...new Set(handles)].join(", ") || "none"}`);
  const outside = html.replace(/<!-- BEGIN app block[\s\S]*?<!-- END app block -->/g, "");
  const shopify = /(^|\.)(shopify\.com|shop\.app|shopifycdn\.net|shopifysvc\.com|shopifycloud\.com|myshopify\.com)$/;
  const own = location.hostname.split(".").slice(-2).join(".");
  const pasted = [...outside.matchAll(/<script\b[^>]*\ssrc=["']([^"']+)["']/gi)]
    .map(s => new URL(s[1], location.href).hostname)
    .filter(h => !shopify.test(h) && !h.endsWith(own));
  console.log(`Third-party <script src> outside app blocks:\n${[...new Set(pasted)].join("\n") || "none"}`);
});

Its real output on S27, run in Chrome 158 on 2026-11-24, with every host and handle replaced by a letter or number (on your own store it prints the real names):

Script tags (asyncLoad): 6 live, 0 blocked.invalid
[host A]
[host B]
[host C]
[host D]
[host E]
[host F]
App block handles: [app 1], [app 2], [app 3]
Third-party <script src> outside app blocks:
[public CDN host]
[host G]

On S19, the one example store with blocked.invalid entries, the first line read Script tags (asyncLoad): 3 live, 8 blocked.invalid. The snippet only sees <script src> tags written in the HTML, so a library loaded by inline code, like S27's jQuery copy, won't appear in its third list.

Turn app embeds off one at a time

Embeds are the cheapest thing to test, because switching one off doesn't uninstall anything. In the theme editor, "click the App embeds icon" on the sidebar (Help Center), and do it on a duplicate theme, not the live one. Embeds are set per theme: when you publish a new theme, Shopify says "you'll need to re-activate those apps in your new theme."

When you switch an embed off, Shopify keeps it in settings_data.json with disabled set to true (shopify.dev). Shopify doesn't say in those pages whether a disabled embed still renders, so check the preview's page source: its BEGIN app block comment should be gone. If it is still there, the embed is still being rendered.

Measure one app's cost: bytes, blocking time and INP

Lab tests like ours find the cause; real visits decide whether it mattered. Measure each app in the lab (bytes, main-thread time, blocking time, median of several runs), then watch INP in Shopify's reports for a week or more after you change something. Google counts INP as good at 200 ms or less at the 75th percentile (web.dev); our speed guide covers the Core Web Vitals targets and lab vs field data.

How to Remove Leftover App Code After Uninstalling

After an uninstall, only pasted code is left to remove; script tags and app blocks are already gone (see the channel table above). Work on a copy:

  1. Duplicate the live theme in Online Store > Themes and make every change on the copy.
  2. Ask the app's developer first. Shopify's Help Center points you to Settings > Apps > Get support; the developer knows which files their app changed.
  3. Search the theme code for the app's name and its script domains in layout/theme.liquid, the snippets/ and sections/ folders, and any Custom Liquid blocks. Also search for render and include tags that call a snippet the app added.
  4. Remove the code on the duplicate, then preview the homepage, a product page, the cart and checkout. Watch the console for errors from code that expected the old script.
  5. Run Theme Check with Shopify CLI. ParserBlockingScript (an error) flags scripts that block HTML parsing, and RemoteAsset (a warning) flags assets loaded from third-party domains.
  6. Publish the duplicate once the pages work, and keep the old theme for a quick rollback.

Shopify's script tag deprecation page warns that "editing theme code takes the theme off its automatic upgrade path." Manual theme updates still work: the Help Center on updating themes says the new version shows "Theme added: code edits successfully included" when your edits carry over, or "Theme added: code edits could not be included", in which case "you need to copy them to the new version of your theme."

These steps follow Shopify's documented rules. We have not run an install/uninstall diff yet, so we can't tell you which apps leave code behind.

Which Apps to Cut, Replace or Consolidate

Keep an app when what it earns on the pages it loads on is worth what it costs there; cut or replace it when it isn't. Measure first, then decide by these rules:

  • Value against cost, per template. A reviews app earns its keep on product pages; the same script on the homepage and blog is mostly cost. Ask the vendor whether it can load only on the templates that use it.
  • Overlapping categories. Two apps that both do reviews, analytics, popups or upsells load two sets of code for one job. Pick one.
  • Rule apps. Apps that apply discount, shipping or payment rules with storefront scripts can often be replaced by Shopify Functions, which run on Shopify's servers, not in the shopper's browser.
  • Tracking. Move tags into web pixels, as covered in our checkout extensibility guide. Remember that we couldn't measure worker time.
  • Cleaner apps. After an uninstall, the pasted channel is the only one left to clean, so that is the only place a cleaner can help. Pay for one only if you have pasted code you can't find yourself.
  • Timing. Take the inventory this week and make cuts after Cyber Monday, November 30. Theme edits during a Black Friday code freeze are a bad trade.

What the Built for Shopify badge tells you about speed

The badge means the app passed a lab test of storefront speed, not that it is free on your store. Built for Shopify requirement 2.2.1 reads: "Your app must not reduce the storefront Lighthouse performance score by more than ten points" (requirements). The storefront performance page weights the score Home 17%, Product details 40% and Collection 43%, and compares it "before and after the app is installed and configured." Your theme, your other apps and your visitors' phones are not part of that test.

What This Measurement Does Not Show

This is a lab test of 40 homepages, so read every number as a floor for app cost on those pages and as one sample, not as what your store will see.

  • Lab, not field. Blocking time is a lab proxy. Real-user INP needs CrUX or Shopify's web performance reports; our speed guide has how Shopify stores do in field data.
  • Homepage only, no interaction. Product and collection pages often load more app code, such as reviews and upsells, and scripts that load on a tap (a chat widget, a cart drawer) are not counted.
  • No worker time. App pixels run in web workers, so their execution is not in our numbers.
  • One setup. One location, one machine, headless Chrome, two runs; details under How we ran it.
  • Sample bias. The example stores are Shopify's curated showcase and are likely leaner than average. The census misses stores behind other proxies or CDNs, since it only keeps domains that resolve to Shopify's range.
  • Blocked mode is approximate. It is one run, and it can overstate app cost (blocking breaks code and skips follow-on work) or understate it (inline <script> inside app blocks still runs, and some app-loaded scripts are not blocked).
  • Attribution misses. Inline-injected, untraceable and redirected scripts land in their own row, and we can't see which apps a store has installed, so app figures are a floor and "hard-coded" never means "abandoned".
  • Not tested: an install/uninstall diff on a development store. The uninstall facts above are Shopify's documentation, quoted, not our test.

Shopify App Audit Checklist

Copy this into your team's tracker and run it every quarter, or before any big sale:

  • Export the installed app list (Settings > Apps) with owner and monthly cost
  • Run the console snippet on home, product and collection pages; save the output
  • Map every script-tag host and app block handle to an installed app
  • Flag script-tag apps and ask each vendor for its embed or pixel date (cutoff March 1, 2027)
  • Flag hosts that appear both as a script tag and inside an app block (double load)
  • On a duplicate theme, switch app embeds off one at a time; confirm the BEGIN app block comment is gone
  • Block each app's script domains in DevTools; record median main-thread time and bytes
  • Search theme files for code from apps you no longer use; remove it on the duplicate
  • Run Theme Check; preview cart and checkout; publish outside any code freeze
  • Two weeks later, compare INP in Shopify's web performance reports

Method, Scripts and Raw Data

Everything above comes from four data files made on 2026-11-24 with the fixed parser: run-3.json and run-4.json (the two browser runs), blocked-1.json (the blocked-mode run, built from run-4.json) and census-2.json. The sample is the store list on shopify.com/examples and the census starts from Tranco list 8PW6V. The example list is public, so anyone can reproduce the sample; we publish the rows without names.

The commands we ran:

npm install puppeteer-core@24.10.0
node app-weight.mjs stores.txt > run-3.json
node app-weight.mjs stores.txt > run-4.json
BLOCK=run-4.json node app-weight.mjs stores.txt > blocked-1.json
node analyze.mjs run-3.json run-4.json blocked-1.json
node census.mjs top-1m.csv 200000 > census-2.json
node census-analyze.mjs census-2.json
node export-csv.mjs run-3.json run-4.json blocked-1.json > stores.csv

app-weight.mjs points at a local Chrome install (macOS path); change CHROME for your machine. stores.txt is the 42 store URLs, one per line. census.mjs caches its DNS step in candidates.txt and needs the Tranco CSV.

app-weight.mjs

// app-weight.mjs: how much JavaScript do apps add to a Shopify storefront, and how did it get there?
// Loads each store's homepage once in Chrome (mobile viewport, 4x CPU throttle, no network throttle),
// records every script request and a CPU profile, and labels each script by how it entered the page:
// Bytes: jsBytes is compressed transfer size, jsDecoded is uncompressed size.
//   app embed   inside a Shopify "BEGIN app block" comment, or served from cdn.shopify.com/extensions/
//   ScriptTag   listed in Shopify's asyncLoad() urls array (the ScriptTag API)
//   pasted      a third-party <script src> in the theme HTML outside any app block (survives uninstall)
//   theme       the theme's own assets (/cdn/shop/t/...)
//   shopify     Shopify's platform scripts (shopifycloud, shop.app, checkout preloads, web pixels manager)
//   web pixel   scripts running inside Shopify's sandboxed web pixel frames
// A script loaded at runtime inherits the label of the script (or inline HTML block) that requested it.
// Blocked mode: BLOCK=run-4.json node app-weight.mjs stores.txt > blocked-1.json reloads each store with
// every script that run labelled app embed or ScriptTag (and hosts only apps loaded) blocked.
// Usage: npm install puppeteer-core@24.10.0, node app-weight.mjs stores.txt > run-3.json
import { readFileSync } from "node:fs";
import puppeteer from "puppeteer-core";

const CHROME = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome";
const WAIT_AFTER_LOAD_MS = 10_000;
const BLOCK = process.env.BLOCK ? new Map(JSON.parse(readFileSync(process.env.BLOCK, "utf8")).results.filter(r => r.appScripts).map(r => [r.store, r])) : null;
const noQuery = u => u.split("?")[0];
const stores = readFileSync(process.argv[2], "utf8").split("\n").map(s => s.trim()).filter(Boolean);

const SHOPIFY = /(^|\.)(shopify\.com|shop\.app|shopifycdn\.net|shopifysvc\.com|myshopify\.com|shopifycloud\.com)$/;
const base = h => h.split(".").slice(-2).join(".");
const isShopifyPath = p => /^\/(cdn\/shopifycloud|checkouts\/internal|cdn\/wpm|wpm@|web-pixels)/.test(p);

function regions(html) {
  // [startLine, endLine, app] for every app block / app embed in the HTML
  const lines = html.split("\n"), out = [], stack = [];
  lines.forEach((l, i) => {
    for (const m of l.matchAll(/<!-- (BEGIN|END) app block(?:: shopify:\/\/apps\/([^/]+)\/)?/g)) {
      if (m[1] === "BEGIN") stack.push([i, m[2]]); else if (stack.length) { const [s, app] = stack.pop(); out.push([s, i, app]); }
    }
  });
  return out;
}
const appAtLine = (regs, line) => regs.filter(([s, e]) => line >= s && line <= e).map(r => r[2]).pop();

function scriptTagUrls(html) {
  const m = html.match(/function asyncLoad\(\)\s*\{[\s\S]{0,300}?var urls = (\[[^\]]*\])/);
  if (!m) return [];
  try { return JSON.parse(m[1]).map(u => new URL(u.startsWith("//") ? "https:" + u : u).href).filter(u => !u.includes("blocked.invalid")); } catch { return []; }
}

async function measure(browser, store) {
  const page = await browser.newPage();
  const cdp = await page.createCDPSession();
  await page.setViewport({ width: 412, height: 823, deviceScaleFactor: 2, isMobile: true, hasTouch: true });
  await page.setUserAgent("Mozilla/5.0 (Linux; Android 11; moto g power (2022)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Mobile Safari/537.36");
  await cdp.send("Emulation.setCPUThrottlingRate", { rate: 4 });
  await cdp.send("Network.enable");
  await cdp.send("Network.setCacheDisabled", { cacheDisabled: true });
  await cdp.send("Profiler.enable");
  await cdp.send("Profiler.setSamplingInterval", { interval: 200 });
  await page.evaluateOnNewDocument(() => {
    window.__lt = [];
    new PerformanceObserver(l => l.getEntries().forEach(e => window.__lt.push([e.startTime, e.duration]))).observe({ type: "longtask", buffered: true });
  });

  const req = new Map();   // requestId -> {url, type, initiator, frameId, bytes}
  let docId = null, mainFrame = null;
  cdp.on("Network.requestWillBeSent", e => {
    if (e.type === "Document" && !docId) { docId = e.requestId; mainFrame = e.frameId; }
    req.set(e.requestId, { url: e.request.url, type: e.type, initiator: e.initiator, frameId: e.frameId, bytes: 0, decoded: 0 });
  });
  cdp.on("Network.dataReceived", e => { const r = req.get(e.requestId); if (r) r.decoded += e.dataLength; });
  cdp.on("Network.loadingFinished", e => { const r = req.get(e.requestId); if (r) r.bytes = e.encodedDataLength; });

  const blk = BLOCK?.get(store);
  let blocked = 0;
  if (blk) {
    const urls = new Set(blk.appScripts.map(noQuery)), hosts = new Set(blk.appOnlyHosts);
    await page.setRequestInterception(true);
    page.on("request", r => {
      const u = r.url(); let h = ""; try { h = new URL(u).hostname; } catch {}
      if (urls.has(noQuery(u)) || hosts.has(h)) { blocked++; r.abort("blockedbyclient"); } else r.continue();
    });
  }
  await cdp.send("Profiler.start");
  let status = 0;
  try {
    const res = await page.goto(store, { waitUntil: "load", timeout: 60_000 });
    status = res?.status() ?? 0;
  } catch (e) { await page.close(); return { store, error: String(e.message).slice(0, 80) }; }
  await new Promise(r => setTimeout(r, WAIT_AFTER_LOAD_MS));
  const { profile } = await cdp.send("Profiler.stop");
  const lt = await page.evaluate(() => window.__lt);
  const fcp = await page.evaluate(() => performance.getEntriesByName("first-contentful-paint")[0]?.startTime ?? 0);
  const docUrl = page.url();
  let html = "";
  try { html = (await cdp.send("Network.getResponseBody", { requestId: docId })).body; } catch { html = await page.content(); }
  await page.close();

  const isShopifyStore = /cdn\.shopify\.com|Shopify\.shop|\/cdn\/shop\//.test(html);
  const regs = regions(html);
  const tags = new Set(scriptTagUrls(html));
  const blockedInvalid = (html.match(/blocked\.invalid/g) ?? []).length;
  const tagHosts = new Set([...tags].map(u => new URL(u).hostname));
  const host = new URL(docUrl).hostname.replace(/^www\./, "");

  // label one URL from where it sits, without looking at who loaded it
  const memo = new Map();
  function own(url, line) {
    let u; try { u = new URL(url); } catch { return null; }
    if (url === docUrl || u.href.split("#")[0] === docUrl.split("#")[0]) {
      const app = line != null ? appAtLine(regs, line) : undefined;
      return app ? `app embed:${app}` : null;            // inline code outside app blocks: resolve by initiator
    }
    const inHtml = html.indexOf(u.href.replace(/^https?:/, ""));
    if (inHtml >= 0) { const app = appAtLine(regs, html.slice(0, inHtml).split("\n").length - 1); if (app) return `app embed:${app}`; }
    if (/\/extensions\/[0-9a-f-]{36}\/([^/]+)\//.test(u.pathname)) return `app embed:${u.pathname.match(/\/extensions\/[0-9a-f-]{36}\/([^/]+)\//)[1].replace(/-\d+$/, "")}`;
    if (tags.has(u.href)) return `scripttag:${u.hostname}`;
    if (isShopifyPath(u.pathname) || (SHOPIFY.test(u.hostname) && !/\/s\/files\/.*\/t\/\d+\//.test(u.pathname))) return "shopify";
    if (/^\/cdn\/shop\/t\/\d+\//.test(u.pathname) || /\/s\/files\/.*\/t\/\d+\//.test(u.pathname)) return "theme";
    const idx = html.indexOf(u.href.replace(/^https?:/, ""));
    if (idx >= 0) {
      const line = html.slice(0, idx).split("\n").length - 1;
      const app = appAtLine(regs, line);
      if (app) return `app embed:${app}`;
      if (base(u.hostname) === base(new URL(docUrl).hostname)) return "theme";   // the store's own non-theme files
      return `pasted:${u.hostname}`;
    }
    return null;                                          // loaded at runtime: resolve by initiator
  }
  function label(id, depth = 0) {
    if (memo.has(id)) return memo.get(id);
    const r = req.get(id);
    let l = null;
    if (r.frameId && r.frameId !== mainFrame && /web-pixel|wpm/.test(r.url + JSON.stringify(r.initiator?.url ?? ""))) l = "web pixel";
    l ??= own(r.url);
    if (!l && depth < 20) {
      const frames = [];
      for (let s = r.initiator?.stack; s; s = s.parent) frames.push(...s.callFrames);
      const top = frames.length ? frames[frames.length - 1] : { url: r.initiator?.url, lineNumber: r.initiator?.lineNumber };
      const src = top?.url;
      if (src) {
        l = own(src, top.lineNumber);
        if (!l) { const parent = [...req.entries()].find(([, x]) => x.url === src); if (parent && parent[0] !== id) l = label(parent[0], depth + 1); }
      }
    }
    if (r.frameId && r.frameId !== mainFrame && !l) l = "web pixel";
    l ??= /^\/(cdn\/shop|cdn\/shopifycloud)/.test(new URL(r.url).pathname) ? "shopify" : `runtime third party:${new URL(r.url).hostname}`;
    memo.set(id, l);
    return l;
  }

  const scripts = [...req.entries()].filter(([, r]) => r.type === "Script");
  const byUrl = new Map();
  for (const [id, r] of scripts) byUrl.set(r.url, label(id));

  // CPU: self time per script URL from the sampling profile
  const nodes = new Map(profile.nodes.map(n => [n.id, n]));
  const self = new Map();
  profile.samples.forEach((s, i) => {
    const n = nodes.get(s); const dt = (profile.timeDeltas[i + 1] ?? 0) / 1000;
    const k = n.callFrame.url ? n.callFrame.url + (n.callFrame.url === docUrl ? `#L${n.callFrame.lineNumber}` : "") : "(none)";
    self.set(k, (self.get(k) ?? 0) + dt);
  });
  const cpu = {};
  for (const [k, ms] of self) {
    if (k === "(none)") continue;
    let l;
    if (k.includes("#L")) { const [u, ln] = k.split("#L"); l = own(u, +ln) ?? "inline theme"; }
    else l = byUrl.get(k) ?? own(k) ?? "unattributed";
    const cat = l.split(":")[0];
    cpu[cat] = (cpu[cat] ?? 0) + ms;
  }

  const bytes = {}, decoded = {}, count = {}, apps = new Set();
  for (const [, r] of scripts) {
    const l = byUrl.get(r.url), cat = l.split(":")[0];
    bytes[cat] = (bytes[cat] ?? 0) + r.bytes; decoded[cat] = (decoded[cat] ?? 0) + r.decoded; count[cat] = (count[cat] ?? 0) + 1;
    if (/^(app embed|scripttag)/.test(cat)) apps.add(l);
  }
  const isApp = l => /^(app embed|scripttag)/.test(l);
  const appScripts = [...byUrl].filter(([, l]) => isApp(l)).map(([u]) => u);
  const hostLabels = new Map();
  for (const [u, l] of byUrl) { const h = new URL(u).hostname; (hostLabels.get(h) ?? hostLabels.set(h, new Set()).get(h)).add(isApp(l)); }
  const appOnlyHosts = [...hostLabels].filter(([h, v]) => v.size === 1 && v.has(true) && !SHOPIFY.test(h) && h !== new URL(docUrl).hostname).map(([h]) => h);
  const pasted = [...new Set([...byUrl.values()].filter(l => l.startsWith("pasted:")).map(l => l.slice(7)))];
  const tbt = lt.filter(([s]) => s >= fcp).reduce((a, [, d]) => a + Math.max(0, d - 50), 0);
  return {
    store, host, status, isShopifyStore, fcp: Math.round(fcp), tbt: Math.round(tbt),
    blockedInvalid, scriptTagCount: tags.size,
    appBlocks: [...new Set(regs.map(r => r[2]).filter(Boolean))], scriptTagHosts: [...tagHosts], pasted,
    apps: [...apps].sort(),
    jsBytes: Object.fromEntries(Object.entries(bytes).map(([k, v]) => [k, Math.round(v)])),
    jsDecoded: Object.fromEntries(Object.entries(decoded).map(([k, v]) => [k, Math.round(v)])),
    jsRequests: count,
    appScripts, appOnlyHosts, blockedRequests: blocked,
    cpuMs: Object.fromEntries(Object.entries(cpu).map(([k, v]) => [k, Math.round(v)])),
  };
}

const browser = await puppeteer.launch({ executablePath: CHROME, headless: "new", args: ["--no-first-run", "--disable-extensions"] });
const ver = await browser.version();
const results = [];
for (const s of stores) {
  const r = await measure(browser, s).catch(e => ({ store: s, error: String(e.message).slice(0, 80) }));
  results.push(r);
  process.stderr.write(`${s} ${r.error ?? `apps=${r.apps.length} tbt=${r.tbt}`}\n`);
}
await browser.close();
console.log(JSON.stringify({ ran: new Date().toISOString(), chrome: ver, node: process.version, puppeteer: "24.10.0", results }, null, 1));

analyze.mjs

// analyze.mjs: every number the post quotes from the browser runs.
// node analyze.mjs run-3.json run-4.json blocked-1.json
// Per store, runs 3 and 4 are combined by taking the mean of the two (bytes barely move; timings do).
import { readFileSync } from "node:fs";
const [r3, r4, blk] = process.argv.slice(2).map(f => JSON.parse(readFileSync(f, "utf8")));
const med = a => { const s = [...a].sort((x, y) => x - y); const n = s.length; return n ? (n % 2 ? s[(n - 1) / 2] : (s[n / 2 - 1] + s[n / 2]) / 2) : 0; };
const p90 = a => { const s = [...a].sort((x, y) => x - y); return s.length ? s[Math.min(s.length - 1, Math.ceil(0.9 * s.length) - 1)] : 0; };
const kb = b => Math.round(b / 1024);
const CH = { "theme app extension": ["app embed"], "script tag": ["scripttag"], "hard-coded third party": ["pasted"],
  "loaded by inline code": ["runtime third party"], theme: ["theme"], shopify: ["shopify"], "web pixel frames": ["web pixel"] };
const APP = ["app embed", "scripttag"];
const good = d => new Map(d.results.filter(r => !r.error && r.isShopifyStore && r.status === 200).map(r => [r.store, r]));
const A = good(r3), B = good(r4);
const stores = [...A.keys()].filter(k => B.has(k));
const sum = (o, keys) => keys.reduce((s, k) => s + (o?.[k] ?? 0), 0);
const avg = (k, f) => (f(A.get(k)) + f(B.get(k))) / 2;

console.log(`runs: ${r3.ran} and ${r4.ran}, ${r3.chrome}, Node ${r3.node}`);
console.log(`listed ${r3.results.length}; measured in both runs ${stores.length}; run-3 errors ${r3.results.filter(r => r.error).length}, not Shopify ${r3.results.filter(r => !r.error && !r.isShopifyStore).length}; run-4 errors ${r4.results.filter(r => r.error).length}`);
const sameApps = stores.filter(k => A.get(k).apps.join() === B.get(k).apps.join()).length;
const appBytes = r => sum(r.jsBytes, APP);
const drift = stores.map(k => Math.abs(appBytes(A.get(k)) - appBytes(B.get(k))) / Math.max(1, appBytes(A.get(k))));
console.log(`stability: same app list in ${sameApps}/${stores.length}; app JS bytes differ run to run by median ${(100 * med(drift)).toFixed(1)}%; blocking time differs by median ${med(stores.map(k => Math.abs(A.get(k).tbt - B.get(k).tbt)))} ms`);

const apps = k => new Set([...A.get(k).apps, ...B.get(k).apps]);
const withApps = stores.filter(k => apps(k).size);
const st = k => A.get(k).scriptTagCount ?? 0;
console.log(`\nstores with any app script: ${withApps.length}/${stores.length}; apps per store median ${med(stores.map(k => apps(k).size))}, max ${Math.max(...stores.map(k => apps(k).size))}`);
console.log(`stores with >=1 live script tag: ${stores.filter(k => st(k) > 0).length}; script tag URLs per store median ${med(stores.map(st))}, total ${stores.reduce((s, k) => s + st(k), 0)}; blocked.invalid entries total ${stores.reduce((s, k) => s + (A.get(k).blockedInvalid ?? 0), 0)} on ${stores.filter(k => A.get(k).blockedInvalid).length} stores`);
console.log(`stores with theme app extension scripts: ${stores.filter(k => [...apps(k)].some(a => a.startsWith("app embed"))).length}; with hard-coded third-party scripts: ${stores.filter(k => A.get(k).pasted.length).length}`);
const total = r => Object.values(r.jsBytes).reduce((a, b) => a + b, 0);
const totalD = r => Object.values(r.jsDecoded).reduce((a, b) => a + b, 0);
console.log(`total JS per store: median ${kb(med(stores.map(k => avg(k, total))))} KB compressed (p90 ${kb(p90(stores.map(k => avg(k, total))))}), ${kb(med(stores.map(k => avg(k, totalD))))} KB decoded`);
console.log(`app JS (extension + script tag) on stores with apps: median ${kb(med(withApps.map(k => avg(k, appBytes))))} KB compressed (p90 ${kb(p90(withApps.map(k => avg(k, appBytes))))}), ${kb(med(withApps.map(k => avg(k, r => sum(r.jsDecoded, APP)))))} KB decoded; share of the store's JS median ${Math.round(100 * med(withApps.map(k => avg(k, appBytes) / avg(k, total))))}%`);
const cpuT = r => Object.values(r.cpuMs).reduce((a, b) => a + b, 0);
console.log(`app main-thread script time on stores with apps: median ${Math.round(med(withApps.map(k => avg(k, r => sum(r.cpuMs, APP)))))} ms (p90 ${Math.round(p90(withApps.map(k => avg(k, r => sum(r.cpuMs, APP)))))}), share median ${Math.round(100 * med(withApps.map(k => avg(k, r => sum(r.cpuMs, APP)) / Math.max(1, avg(k, cpuT)))))}%`);

console.log(`\nTable 1, per channel (mean of two runs per store; medians over stores that have the channel):`);
console.log(`channel | stores | median KB compressed | p90 KB | median KB decoded | median requests | median main-thread ms | share of all JS bytes | share of all script time`);
const allB = stores.reduce((s, k) => s + avg(k, total), 0), allC = stores.reduce((s, k) => s + avg(k, cpuT), 0);
for (const [name, keys] of Object.entries(CH)) {
  const has = stores.filter(k => sum(A.get(k).jsBytes, keys) + sum(B.get(k).jsBytes, keys) + sum(A.get(k).cpuMs, keys) > 0);
  const b = has.map(k => avg(k, r => sum(r.jsBytes, keys)));
  const shareB = stores.reduce((s, k) => s + avg(k, r => sum(r.jsBytes, keys)), 0) / allB;
  const shareC = stores.reduce((s, k) => s + avg(k, r => sum(r.cpuMs, keys)), 0) / allC;
  console.log(`${name} | ${has.length} | ${kb(med(b))} | ${kb(p90(b))} | ${kb(med(has.map(k => avg(k, r => sum(r.jsDecoded, keys)))))} | ${med(has.map(k => avg(k, r => sum(r.jsRequests, keys))))} | ${Math.round(med(has.map(k => avg(k, r => sum(r.cpuMs, keys)))))} | ${(100 * shareB).toFixed(1)}% | ${(100 * shareC).toFixed(1)}%`);
}
const restC = stores.reduce((s, k) => s + avg(k, r => sum(r.cpuMs, ["inline theme", "unattributed"])), 0) / allC;
console.log(`(inline code outside app blocks + unattributed samples: ${(100 * restC).toFixed(1)}% of script time, no bytes)`);

console.log(`\nTable 4, app count vs blocking time (mean of two runs):`);
for (const [lo, hi, label] of [[0, 0, "0 apps"], [1, 2, "1-2 apps"], [3, 5, "3-5 apps"], [6, 99, "6+ apps"]]) {
  const g = stores.filter(k => apps(k).size >= lo && apps(k).size <= hi);
  console.log(`${label} | ${g.length} stores | median blocking time ${Math.round(med(g.map(k => avg(k, r => r.tbt))))} ms | median total JS ${kb(med(g.map(k => avg(k, total))))} KB`);
}

if (blk) {
  const rows = blk.results.filter(r => !r.error && r.blockedRequests > 0 && A.has(r.store)).map(r => ({
    tbt0: avg(r.store, x => x.tbt), tbt1: r.tbt, js0: avg(r.store, total), js1: total(r), req: r.blockedRequests }));
  const d = rows.map(x => x.tbt1 - x.tbt0);
  console.log(`\nTable 3, blocked mode (${blk.ran}): ${rows.length} stores had app requests blocked (median ${med(rows.map(x => x.req))} requests blocked)`);
  console.log(`blocking time median ${Math.round(med(rows.map(x => x.tbt0)))} -> ${Math.round(med(rows.map(x => x.tbt1)))} ms; per-store change median ${Math.round(med(d))} ms, range ${Math.round(Math.min(...d))} to ${Math.round(Math.max(...d))} ms; fell on ${d.filter(x => x < 0).length}/${rows.length}`);
  console.log(`total JS median ${kb(med(rows.map(x => x.js0)))} -> ${kb(med(rows.map(x => x.js1)))} KB; per-store change median ${kb(med(rows.map(x => x.js1 - x.js0)))} KB`);
}

census.mjs

// census.mjs: how do apps get code onto Shopify storefronts, across many stores? HTML only, no browser.
// 1. Resolve the Tranco top N domains (apex and www) and keep those whose A record is in Shopify's
//    storefront range 23.227.38.0/24 (stores behind another proxy are missed, so this undercounts).
// 2. Fetch each kept store's homepage once (mobile UA, robots.txt checked, 6 at a time, 20 s timeout)
//    and read three markers Shopify puts in the HTML:
//      asyncLoad() urls array          = script tags (ScriptTag API), stop being injected 2027-03-01
//      "BEGIN app block: shopify://apps/<handle>" comments = theme app extension blocks and embeds
//      external <script src> outside app blocks, not Shopify, not the store = pasted into the theme
// Usage: node census.mjs top-1m.csv 200000 > census-2.json
import { readFileSync } from "node:fs";
import { Resolver } from "node:dns/promises";

const [file, topN] = [process.argv[2], +process.argv[3]];
const domains = readFileSync(file, "utf8").split("\n").slice(0, topN).map(l => l.split(",")[1]?.trim()).filter(Boolean);
const UA = "Mozilla/5.0 (Linux; Android 11; moto g power (2022)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Mobile Safari/537.36";
const resolver = new Resolver({ timeout: 3000, tries: 2 });
resolver.setServers(["1.1.1.1", "8.8.8.8"]);

async function pool(items, n, fn) {
  const out = new Array(items.length); let i = 0;
  await Promise.all(Array.from({ length: n }, async () => { while (i < items.length) { const k = i++; out[k] = await fn(items[k]); } }));
  return out;
}
const onShopify = async h => { try { return (await resolver.resolve4(h)).some(ip => ip.startsWith("23.227.38.")); } catch { return false; } };

// Step 1 result is cached in candidates.txt (delete it to re-resolve).
const { existsSync, writeFileSync } = await import("node:fs");
let candidates;
if (existsSync("candidates.txt")) candidates = readFileSync("candidates.txt", "utf8").split("\n").filter(Boolean);
else {
  const t0 = Date.now();
  const dns = await pool(domains, 200, async d => (await onShopify(d)) || (await onShopify("www." + d)) ? d : null);
  candidates = dns.filter(Boolean);
  writeFileSync("candidates.txt", candidates.join("\n") + "\n");
  process.stderr.write(`resolved ${domains.length} in ${Math.round((Date.now() - t0) / 1000)} s, ${candidates.length} on Shopify IPs\n`);
}

const SHOPIFY_HOST = /(^|\.)(shopify\.com|shop\.app|shopifycdn\.net|shopifysvc\.com|myshopify\.com|shopifycloud\.com)$/;
const base = h => h.split(".").slice(-2).join(".");

async function get(url) {
  const ac = new AbortController(); const t = setTimeout(() => ac.abort(), 20_000);
  try { const r = await fetch(url, { headers: { "user-agent": UA, accept: "text/html" }, redirect: "follow", signal: ac.signal }); return { status: r.status, url: r.url, body: await r.text() }; }
  catch (e) { return { error: e.name }; } finally { clearTimeout(t); }
}
function robotsAllowsRoot(txt) {
  // the "*" group only: is "/" disallowed outright?
  let inStar = false;
  for (const raw of txt.split("\n")) {
    const l = raw.replace(/#.*/, "").trim(); if (!l) continue;
    const [k, ...v] = l.split(":"); const val = v.join(":").trim();
    if (/^user-agent$/i.test(k)) inStar = val === "*";
    else if (inStar && /^disallow$/i.test(k) && val === "/") return false;
  }
  return true;
}

function parse(html, finalUrl) {
  const host = new URL(finalUrl).hostname;
  const isShopify = /Shopify\.shop\s*=|cdn\.shopify\.com|\/cdn\/shop\//.test(html);
  let tags = [];
  const m = html.match(/function asyncLoad\(\)\s*\{[\s\S]{0,300}?var urls = (\[[^\]]*\])/);
  let blockedInvalid = 0;
  if (m) try { tags = JSON.parse(m[1]).map(u => new URL(u.startsWith("//") ? "https:" + u : u)); } catch {}
  blockedInvalid = tags.filter(u => u.hostname === "blocked.invalid").length;
  tags = tags.filter(u => u.hostname !== "blocked.invalid");
  // app block regions by character offset
  const regs = [], stack = [];
  for (const b of html.matchAll(/<!-- (BEGIN|END) app block(?:: shopify:\/\/apps\/([^/]+)\/blocks\/([^/]+)\/)?/g)) {
    if (b[1] === "BEGIN") stack.push([b.index, b[2]]); else if (stack.length) { const [s, app] = stack.pop(); regs.push([s, b.index, app]); }
  }
  const apps = new Set(regs.map(r => r[2]).filter(Boolean));
  const embedHosts = new Set(), pasted = new Set();
  for (const s of html.matchAll(/<script\b[^>]*\bsrc=["']([^"']+)["']/gi)) {
    let u; try { u = new URL(s[1].startsWith("//") ? "https:" + s[1] : s[1], finalUrl); } catch { continue; }
    const inBlock = regs.some(([a, b]) => s.index > a && s.index < b);
    if (inBlock || /\/extensions\/[0-9a-f-]{36}\//.test(u.pathname)) { if (!SHOPIFY_HOST.test(u.hostname)) embedHosts.add(u.hostname); continue; }
    if (SHOPIFY_HOST.test(u.hostname) || base(u.hostname) === base(host)) continue;
    pasted.add(u.hostname);
  }
  // double-load heuristic (lower bound): the same non-Shopify host both as a script tag and inside an app block
  const tagHosts = new Set(tags.map(u => u.hostname).filter(h => !SHOPIFY_HOST.test(h)));
  return {
    isShopify, scriptTags: tags.length, scriptTagHosts: [...new Set(tags.map(u => u.hostname))],
    appBlockHandles: [...apps], pastedHosts: [...pasted],
    bothWays: [...tagHosts].filter(h => embedHosts.has(h)),
    blockedInvalid,
    password: /\/password\/?$/.test(new URL(finalUrl).pathname),
    webPixelsManager: /web-pixels-manager|webPixelsManager/.test(html),
    htmlBytes: Buffer.byteLength(html),
  };
}

let done = 0;
const rows = await pool(candidates, 6, async d => {
  const robots = await get(`https://${d}/robots.txt`);
  if (robots.status === 200 && !robotsAllowsRoot(robots.body)) return { domain: d, skipped: "robots" };
  const r = await get(`https://${d}/`);
  if (++done % 200 === 0) process.stderr.write(`fetched ${done}/${candidates.length}\n`);
  if (r.error || r.status !== 200) return { domain: d, skipped: r.error ?? `status ${r.status}` };
  return { domain: d, final: r.url, ...parse(r.body, r.url) };
});
console.log(JSON.stringify({ ran: new Date().toISOString(), node: process.version, list: "Tranco 8PW6V", topN, candidates: candidates.length, rows }, null, 1));

census-analyze.mjs

// census-analyze.mjs: every number the post quotes from the census. node census-analyze.mjs census-2.json
import { readFileSync } from "node:fs";
const d = JSON.parse(readFileSync(process.argv[2], "utf8"));
const med = a => { const s = [...a].sort((x, y) => x - y); const n = s.length; return n ? (n % 2 ? s[(n - 1) / 2] : (s[n / 2 - 1] + s[n / 2]) / 2) : 0; };
const p90 = a => { const s = [...a].sort((x, y) => x - y); return s.length ? s[Math.min(s.length - 1, Math.ceil(0.9 * s.length) - 1)] : 0; };
const pct = (a, b) => `${(100 * a / b).toFixed(1)}%`;
const skipped = d.rows.filter(r => r.skipped);
const why = {}; for (const r of skipped) { const k = r.skipped.startsWith("status") ? r.skipped : r.skipped; why[k] = (why[k] ?? 0) + 1; }
const notStore = d.rows.filter(r => !r.skipped && (!r.isShopify || r.password));
const S = d.rows.filter(r => !r.skipped && r.isShopify && !r.password);
console.log(`census ${d.ran}, ${d.list}, top ${d.topN} domains -> ${d.candidates} on Shopify IPs -> ${S.length} open Shopify storefronts measured`);
console.log(`skipped ${skipped.length}: ${Object.entries(why).sort((a, b) => b[1] - a[1]).slice(0, 8).map(([k, v]) => `${k} ${v}`).join(", ")}; not a storefront or password page ${notStore.length}`);
const tag = S.filter(r => r.scriptTags > 0), blk = S.filter(r => r.blockedInvalid > 0);
const app = S.filter(r => r.appBlockHandles.length > 0), past = S.filter(r => r.pastedHosts.length > 0), both = S.filter(r => r.bothWays.length > 0);
console.log(`stores with >=1 live script tag: ${tag.length} (${pct(tag.length, S.length)}); script tags per store median ${med(S.map(r => r.scriptTags))}, among users median ${med(tag.map(r => r.scriptTags))}, p90 ${p90(tag.map(r => r.scriptTags))}, max ${Math.max(0, ...S.map(r => r.scriptTags))}`);
console.log(`stores with blocked.invalid script tag entries: ${blk.length} (${pct(blk.length, S.length)})`);
console.log(`stores with theme app extension blocks (BEGIN app block): ${app.length} (${pct(app.length, S.length)}); distinct apps per store median ${med(S.map(r => r.appBlockHandles.length))}, p90 ${p90(S.map(r => r.appBlockHandles.length))}`);
console.log(`stores with both channels: ${S.filter(r => r.scriptTags > 0 && r.appBlockHandles.length > 0).length} (${pct(S.filter(r => r.scriptTags > 0 && r.appBlockHandles.length > 0).length, S.length)}); script tags only ${S.filter(r => r.scriptTags > 0 && !r.appBlockHandles.length).length}; extensions only ${S.filter(r => !r.scriptTags && r.appBlockHandles.length).length}; neither ${S.filter(r => !r.scriptTags && !r.appBlockHandles.length).length}`);
console.log(`stores with hard-coded third-party script src: ${past.length} (${pct(past.length, S.length)}); hosts per store median ${med(S.map(r => r.pastedHosts.length))}`);
console.log(`double-load candidates (same non-Shopify host as script tag and inside an app block, lower bound): ${both.length} (${pct(both.length, S.length)})`);
console.log(`web pixels manager present: ${S.filter(r => r.webPixelsManager).length} (${pct(S.filter(r => r.webPixelsManager).length, S.length)})`);
const apps = {}; for (const r of S) for (const h of r.appBlockHandles) apps[h] = (apps[h] ?? 0) + 1;
const hosts = {}; for (const r of tag) for (const h of new Set(r.scriptTagHosts)) hosts[h] = (hosts[h] ?? 0) + 1;
console.log(`distinct app handles seen: ${Object.keys(apps).length}; distinct script tag hosts: ${Object.keys(hosts).length}`);
console.log(`script tag hosts on >=2% of stores: ${Object.entries(hosts).filter(([, v]) => v / S.length >= 0.02).length} (counts only, not named in the post)`);

export-csv.mjs

// export-csv.mjs: the anonymised per-store table published with the post (counts, bytes and ms only, no hosts).
// node export-csv.mjs run-3.json run-4.json blocked-1.json > stores.csv
// Same store filter and two-run mean as analyze.mjs. Rows are sorted by total compressed JS, not by name,
// and numbered S01 upward in that order. Blocked mode is a single run.
import { readFileSync } from "node:fs";
const [r3, r4, blk] = process.argv.slice(2).map(f => JSON.parse(readFileSync(f, "utf8")));
const good = d => new Map(d.results.filter(r => !r.error && r.isShopifyStore && r.status === 200).map(r => [r.store, r]));
const A = good(r3), B = good(r4), X = new Map(blk.results.filter(r => !r.error).map(r => [r.store, r]));
const stores = [...A.keys()].filter(k => B.has(k));
const sum = (o, keys) => keys.reduce((s, k) => s + (o?.[k] ?? 0), 0);
const avg = (k, f) => (f(A.get(k)) + f(B.get(k))) / 2;
const kb = b => Math.round(b / 1024);
const total = r => Object.values(r.jsBytes).reduce((a, b) => a + b, 0);
const CH = [["ext_kb", ["app embed"]], ["scripttag_kb", ["scripttag"]], ["hardcoded_kb", ["pasted"]], ["inline_loaded_kb", ["runtime third party"]],
  ["theme_kb", ["theme"]], ["shopify_kb", ["shopify"]], ["webpixel_kb", ["web pixel"]]];
const rows = stores.map(k => {
  const x = X.get(k);
  return { k, total: avg(k, total), cells: [
    new Set([...A.get(k).apps, ...B.get(k).apps]).size, A.get(k).scriptTagCount, A.get(k).blockedInvalid, A.get(k).appBlocks.length, A.get(k).pasted.length,
    kb(avg(k, total)), ...CH.map(([, keys]) => kb(avg(k, r => sum(r.jsBytes, keys)))),
    ...[["app embed"], ["scripttag"], ["pasted"]].map(keys => Math.round(avg(k, r => sum(r.cpuMs, keys)))),
    A.get(k).tbt, B.get(k).tbt, x && x.blockedRequests > 0 ? x.tbt : "", x && x.blockedRequests > 0 ? kb(total(x)) : "", x?.blockedRequests ?? "" ] };
}).sort((a, b) => a.total - b.total);
console.log(["store", "apps", "scripttag_urls", "blocked_invalid", "app_block_handles", "hardcoded_hosts", "js_kb", ...CH.map(c => c[0]),
  "ext_cpu_ms", "scripttag_cpu_ms", "hardcoded_cpu_ms", "blocking_ms_run3", "blocking_ms_run4", "blocking_ms_blocked", "js_kb_blocked", "requests_blocked"].join(","));
rows.forEach((r, i) => console.log([`S${String(i + 1).padStart(2, "0")}`, ...r.cells].join(",")));
if (process.env.TRACE) { const i = rows.findIndex(r => r.k === process.env.TRACE); process.stderr.write(`traced store is S${String(i + 1).padStart(2, "0")}\n`); }

Output: analyze.mjs

runs: 2026-11-24T05:37:38.691Z and 2026-11-24T05:54:14.149Z, Chrome/158.0.8127.88, Node v24.20.0
listed 42; measured in both runs 40; run-3 errors 0, not Shopify 2; run-4 errors 0
stability: same app list in 38/40; app JS bytes differ run to run by median 0.1%; blocking time differs by median 41 ms

stores with any app script: 37/40; apps per store median 4, max 16
stores with >=1 live script tag: 35; script tag URLs per store median 3, total 131; blocked.invalid entries total 8 on 1 stores
stores with theme app extension scripts: 30; with hard-coded third-party scripts: 24
total JS per store: median 1474 KB compressed (p90 3166), 4994 KB decoded
app JS (extension + script tag) on stores with apps: median 354 KB compressed (p90 1462), 1148 KB decoded; share of the store's JS median 22%
app main-thread script time on stores with apps: median 326 ms (p90 1850), share median 18%

Table 1, per channel (mean of two runs per store; medians over stores that have the channel):
channel | stores | median KB compressed | p90 KB | median KB decoded | median requests | median main-thread ms | share of all JS bytes | share of all script time
theme app extension | 31 | 332 | 1022 | 1106 | 28 | 239 | 18.4% | 18.8%
script tag | 33 | 109 | 468 | 353 | 6 | 79 | 9.4% | 7.5%
hard-coded third party | 25 | 57 | 577 | 308 | 2 | 151 | 7.0% | 7.5%
loaded by inline code | 19 | 150 | 1000 | 451 | 7 | 56 | 8.3% | 8.2%
theme | 39 | 75 | 269 | 261 | 5 | 125 | 5.7% | 11.1%
shopify | 40 | 832 | 1371 | 2859 | 42 | 628 | 49.7% | 37.6%
web pixel frames | 21 | 53 | 79 | 147 | 2 | 24 | 1.6% | 0.7%
(inline code outside app blocks + unattributed samples: 8.6% of script time, no bytes)

Table 4, app count vs blocking time (mean of two runs):
0 apps | 3 stores | median blocking time 163 ms | median total JS 854 KB
1-2 apps | 8 stores | median blocking time 183 ms | median total JS 922 KB
3-5 apps | 14 stores | median blocking time 375 ms | median total JS 1365 KB
6+ apps | 15 stores | median blocking time 799 ms | median total JS 2616 KB

Table 3, blocked mode (2026-11-24T06:11:04.352Z): 37 stores had app requests blocked (median 6 requests blocked)
blocking time median 466 -> 304 ms; per-store change median -60 ms, range -1072 to 75 ms; fell on 32/37
total JS median 1550 -> 1138 KB; per-store change median -431 KB

Output: census-analyze.mjs

census 2026-11-24T05:36:50.562Z, Tranco 8PW6V, top 200000 domains -> 2867 on Shopify IPs -> 2761 open Shopify storefronts measured
skipped 97: status 403 52, TypeError 33, robots 6, status 404 3, status 430 1, status 401 1, status 500 1; not a storefront or password page 9
stores with >=1 live script tag: 2172 (78.7%); script tags per store median 3, among users median 3, p90 9, max 102
stores with blocked.invalid script tag entries: 0 (0.0%)
stores with theme app extension blocks (BEGIN app block): 2532 (91.7%); distinct apps per store median 4, p90 9
stores with both channels: 2096 (75.9%); script tags only 76; extensions only 436; neither 153
stores with hard-coded third-party script src: 2229 (80.7%); hosts per store median 2
double-load candidates (same non-Shopify host as script tag and inside an app block, lower bound): 395 (14.3%)
web pixels manager present: 2675 (96.9%)
distinct app handles seen: 1053; distinct script tag hosts: 876
script tag hosts on >=2% of stores: 35 (counts only, not named in the post)

Per-store data (anonymised)

Counts, kilobytes and milliseconds only, no hosts. Rows are sorted by total compressed JavaScript, not by name. KB columns are compressed and the mean of two runs; blocking_ms_blocked, js_kb_blocked and requests_blocked come from the single blocked run and are empty where nothing was blocked.

store,apps,scripttag_urls,blocked_invalid,app_block_handles,hardcoded_hosts,js_kb,ext_kb,scripttag_kb,hardcoded_kb,inline_loaded_kb,theme_kb,shopify_kb,webpixel_kb,ext_cpu_ms,scripttag_cpu_ms,hardcoded_cpu_ms,blocking_ms_run3,blocking_ms_run4,blocking_ms_blocked,js_kb_blocked,requests_blocked
S01,3,3,0,0,0,335,0,18,0,0,87,230,0,0,65,0,71,53,55,319,3
S02,1,1,0,0,0,438,0,0,0,0,23,414,0,0,0,0,157,88,103,440,1
S03,2,1,0,1,0,631,27,6,0,10,83,506,0,30,3,0,88,82,75,484,2
S04,3,3,0,0,0,643,0,42,0,0,68,534,0,0,549,0,200,247,195,601,3
S05,2,2,0,0,0,651,0,13,0,0,192,393,53,0,99,0,1729,1629,1754,636,2
S06,0,0,0,0,0,680,0,0,0,0,75,605,0,0,0,0,130,130,,,0
S07,2,3,0,0,0,852,0,101,0,0,121,631,0,0,56,0,179,170,182,742,3
S08,0,0,0,0,0,854,0,0,0,156,20,677,0,0,0,0,185,181,,,0
S09,0,0,0,0,2,892,0,0,332,0,0,560,0,0,0,172,165,161,,,0
S10,2,0,0,1,0,991,472,0,0,0,53,439,27,276,0,0,119,131,64,373,2
S11,3,3,0,0,2,1132,0,296,110,10,54,636,27,0,177,176,260,415,181,656,4
S12,4,3,0,3,0,1152,64,6,0,1,37,1044,0,41,1,0,204,206,193,1084,6
S13,1,0,0,1,0,1209,222,0,0,0,116,818,53,202,0,0,194,188,167,979,1
S14,4,4,0,1,0,1246,0,109,0,0,59,1078,0,3,58,0,233,423,257,1138,4
S15,4,3,0,0,2,1297,227,79,40,10,43,846,53,23,21,78,228,275,201,973,4
S16,8,5,0,3,3,1320,281,301,308,150,21,259,0,239,88,218,324,275,316,723,9
S17,5,2,0,3,1,1362,30,72,152,0,105,1004,0,297,38,155,478,467,419,1236,8
S18,4,3,0,1,7,1368,100,8,918,0,115,200,27,20,5,546,342,233,259,1260,12
S19,11,3,8,4,3,1397,523,8,54,0,11,748,53,1279,2,26,732,703,304,872,15
S20,3,1,0,2,0,1406,45,277,0,0,22,1061,0,39,318,0,458,441,272,1071,3
S21,2,1,0,1,1,1542,567,59,1,104,58,726,27,495,79,0,426,346,285,700,4
S22,5,4,0,1,1,1550,7,20,6,0,67,1371,79,0,11,0,380,445,316,1501,5
S23,4,2,0,1,2,1552,167,134,57,0,55,1139,0,142,55,4,568,578,562,1242,4
S24,5,3,0,2,0,1634,78,278,0,0,20,1252,7,61,279,0,476,694,438,1273,6
S25,2,1,0,0,1,1651,142,0,34,0,103,1320,53,146,0,51,476,456,406,1509,2
S26,8,4,0,3,0,1780,342,405,0,0,134,899,0,382,191,0,420,421,263,922,10
S27,8,6,0,3,2,2018,628,468,41,296,344,243,0,1218,377,770,901,866,696,767,11
S28,6,1,0,3,1,2365,339,14,0,0,44,1914,53,97,13,0,674,811,777,2025,6
S29,6,4,0,3,1,2486,332,460,21,528,26,1067,53,381,349,20,440,462,261,1684,8
S30,9,4,0,5,0,2539,423,273,0,789,83,972,0,247,110,2,641,531,552,1837,12
S31,12,3,0,6,3,2616,604,375,117,155,160,1179,27,412,118,464,1397,1399,1340,1691,18
S32,10,4,0,2,3,2673,358,69,404,0,93,1696,53,164,12,278,597,651,683,2242,14
S33,3,2,0,3,1,2805,469,0,47,2,29,2251,7,569,0,36,702,581,606,2336,3
S34,5,5,0,1,5,2813,277,468,160,781,130,997,0,239,512,151,1056,1083,710,2067,6
S35,9,6,0,4,1,3044,2276,255,11,0,102,241,158,2516,315,18,1251,1066,86,503,13
S36,16,9,0,7,8,3166,1022,781,577,72,234,453,27,1895,409,571,805,792,252,1282,21
S37,8,6,0,3,6,3191,27,63,567,1000,376,1156,1,58,34,707,736,1072,469,2238,10
S38,14,8,0,8,10,3220,397,552,692,45,269,1265,0,264,453,846,1123,989,793,2218,37
S39,12,7,0,4,1,3529,1346,116,38,336,55,1635,3,1919,63,15,1172,1375,549,1892,27
S40,16,11,0,4,9,4497,1175,475,270,1382,340,561,293,895,955,506,2260,2467,1308,2674,24

Frequently asked questions

Do Shopify apps slow down my store?

They can, and how much depends on how each app puts code on the page. On the 37 of 40 Shopify example stores that loaded app scripts, those scripts added a median 354 KB of compressed JavaScript and 326 ms of main-thread script time in our lab test, a median 22% of each store's JavaScript bytes. Theme app extensions (app blocks and embeds) were 18.4% of all JavaScript bytes across the sample and script tags 9.4%. Shopify removes both when you uninstall; code pasted into theme files stays.

Does uninstalling a Shopify app remove its code?

Partly. Shopify's ScriptTag documentation says all script tags an app created are removed automatically when it is uninstalled, and its theme app extension documentation says the app's blocks are removed from your themes. Code an app or a developer pasted into theme files is different: Shopify's Help Center says some apps add theme code that isn't automatically removed, so you have to find and delete it yourself.

How do I find which app is slowing down my Shopify store?

Start by listing what is on the page. Run our 16-line console snippet on your storefront (or read the page source) to list script-tag hosts, app block handles and hard-coded third-party scripts. Then, on a duplicate theme, switch app embeds off one at a time and block each app's script domains in Chrome DevTools, running each test several times and comparing the medians for main-thread time and transferred bytes. Confirm any change in Shopify's web performance reports, which use real visits.

Will my store break when Shopify stops script tags on March 1, 2027?

Only the features that still arrive as script tags will stop. Shopify's docs say it will stop injecting script tags into storefronts on March 1, 2027, and apps have not been able to create or update them since October 1, 2026. In our census, 78.7% of 2,761 open Shopify storefronts still loaded at least one. Search your page source for asyncLoad, list the hosts in its urls array, and ask each vendor when their app embed or web pixel replaces it.

Do app embeds load when they are switched off?

Switching an embed off in the theme editor deactivates it, and Shopify keeps it in settings_data.json with disabled set to true. You can confirm it stopped loading by checking that its BEGIN app block comment is gone from page source.

Do Shopify web pixels slow down a store?

We can only answer part of this. Shopify says app pixels are loaded in a strict sandbox using web workers, and custom pixels run in a sandboxed iframe. We measured main-thread and iframe cost only; worker time is not in our numbers. The web pixel frames we could see were present on 21 of 40 stores, at a median 53 KB of compressed JavaScript and 24 ms of main-thread time, 0.7% of all script time in the sample.

How many Shopify apps is too many?

There is no safe number. In our 40 stores, lab blocking time (long-task time over 50 ms) rose with the number of app sources loading scripts: a median 163 ms with none, 183 ms with 1 to 2, 375 ms with 3 to 5 and 799 ms with 6 or more. Total JavaScript rose with it, the groups are small, and nothing else was held equal, so treat a high count as a reason to measure, not as a verdict on any one app.

Next articleAdd SAML SSO to SaaS: 12 Responses Tested on node-saml

Get in touch.

Whether you have questions or just want to explore what's possible, we're here to help.