Auditing the third-party scripts that slow your site
Short answer: List every script on your site that loads from someone else's domain, note who asked for it and what it's for, measure what it costs, and remove anything nobody can justify. For the rest, load them with async or defer, delay heavy widgets until someone interacts, and give each script a named owner. Most small sites carry tags from campaigns, tools and agencies long gone.
Chat widgets, review badges, analytics, heatmaps, ad pixels, booking embeds, social feeds, A/B testing tools: each one adds code that runs on your visitors' phones. Individually they look harmless. Together they're one of the most common reasons a small business site feels sluggish. This checklist walks through an audit you can run in an afternoon.
Why third-party scripts are worth auditing
web.dev's guide to loading third-party JavaScript lists the ways these scripts can hurt a page: too many network requests to multiple servers, loading large amounts of code, blocking content from displaying until they finish, using legacy APIs such as document.write(), and slow servers that delay the page even when the embed uses async or defer. It gives examples of typical third-party code: social sharing buttons, video embeds, advertising iframes, analytics scripts, A/B testing scripts and helper libraries.
Chrome's Lighthouse documentation describes its third-party audit as flagging pages where third-party code blocks the browser's main thread for 250 milliseconds or longer in total. (The page notes that, as of Lighthouse 13, this audit has been folded into a newer insight, but the principle stands.)
Part 1: build the inventory
- [ ] Open your homepage, a key service or product page, and your contact or checkout page in Chrome. Open DevTools, go to the Network tab, reload, and filter by "JS". Note every domain that isn't yours.
- [ ] Check your tag manager, if you use one. List every tag, its trigger and when it was last edited. web.dev's guide specifically warns to use tag managers carefully, because they make it easy to add tags that nobody reviews.
- [ ] Check your CMS or theme settings for scripts pasted into header and footer fields. Old tracking codes often live here.
- [ ] Check plugins and apps. On WordPress and Shopify, many plugins and apps inject their own scripts on every page, even where they're not needed.
- [ ] Write it down in a simple table: script, vendor, what it does, who asked for it, which pages need it, date added.
Part 2: question each script
For each row, ask:
- [ ] Is anyone still using its data or feature? A heatmap tool nobody has logged into for a year is pure cost.
- [ ] Is it duplicated? Two analytics tags, or the same pixel installed by a plugin and by hand, are common.
- [ ] Does it need to run on every page? A booking widget only needs the booking page; a checkout script only needs checkout.
- [ ] Does a lighter version exist? Some vendors offer a link or a static badge instead of a full embed.
- [ ] Is there an owner? If nobody can say who needs it, that's a strong hint.
web.dev's advice is direct: if a script doesn't add clear value, remove it, and if needed, run a test to balance its perceived value against its impact on engagement or performance.
Part 3: measure before and after
- [ ] Run Lighthouse or PageSpeed Insights on the same three pages and record the results.
- [ ] Look at the third-party summary and main-thread work in the report to see which scripts take the most time.
- [ ] Use DevTools' request blocking to temporarily block a script and reload. If the page gets noticeably faster and nothing important breaks, you've found a candidate.
- [ ] Re-test after each change, not all at once, so you know what made the difference.
Part 4: load what stays more politely
- [ ] Use
asyncordefer. web.dev recommends loading third-party scripts with one of these attributes to avoid blocking the browser while it parses the page. - [ ] Add resource hints such as
preconnectordns-prefetchfor the few third-party domains that are essential early, as the guide suggests. - [ ] Lazy-load embeds. The guide points to lazy loading for embedded resources such as ads and videos so they load only when needed.
- [ ] Use a facade for heavy widgets. Show a static button or image that looks like the chat widget or video player, and load the real thing when the visitor clicks.
- [ ] Consider self-hosting small scripts whose vendor servers are slow, as web.dev suggests, keeping in mind you then need to update them yourself.
- [ ] Run A/B tests carefully. web.dev recommends sending testing scripts to a smaller sample and deciding which version to show on the server where possible, because client-side testing scripts can delay rendering.
Part 5: keep it from growing back
- [ ] One gatekeeper. New scripts are added through one person or one process, with a reason and an end date for campaign tags.
- [ ] Quarterly review. Repeat Part 1 every few months; it gets quicker each time.
- [ ] Remove on cancellation. When you cancel a tool, remove its code the same day.
- [ ] Keep the inventory with your site documentation so the next developer or agency inherits it.
What usually comes off
These are worth examining first on most small business sites, though every site differs:
- Analytics or pixels from tools you no longer use
- Duplicate tags installed by a plugin and manually
- Social feed widgets that load a lot of code for a few posts
- Chat widgets loading on every page when they're only staffed part-time
- Font and icon libraries loaded from a CDN when only a few icons are used
FAQ
Will removing scripts break my tracking?
Only if you remove ones you still rely on. That's why the inventory records what each script is for. Check with whoever uses the data before deleting.
Is a tag manager bad for performance?
Not in itself, but it makes adding tags easy, and tags pile up. Treat it as part of the audit and review its contents regularly.
How many third-party scripts is too many?
There's no fixed number. Judge by impact: measure main-thread time and page speed, and keep only what earns its cost.
Should I lazy-load my chat widget?
Often yes. Loading it after interaction or a delay, or showing a lightweight facade button, keeps the page fast for visitors who never open chat.
Not sure what half the scripts on your site are for? Send us your URL and we'll help you work out what can go.