DEV Community

Rahil Khan
Rahil Khan

Posted on

Your small-business site is slow because of scripts you forgot about: a 15-minute third-party script audit

Chat widgets, review badges, three analytics tags, a Facebook pixel nobody checks, an old popup plugin... Third-party scripts pile up on small-business sites, and each one adds download time, blocks the page from becoming usable, and can break when the vendor changes something.

Here's the 15-minute audit we run before touching anything else.

1. List what's actually loading

Open your homepage, then DevTools → Network → filter by JS, reload, and sort by Domain. Everything not on your own domain is third-party. Or paste this in the Console:

[...document.scripts]
  .map(s => s.src)
  .filter(src => src && !src.includes(location.hostname))
  .forEach(src => console.log(src));
Enter fullscreen mode Exit fullscreen mode

2. Ask three questions per script

  • Does someone on the team actually use the data or feature? (If nobody has opened that heatmap tool in a year, remove it.)
  • Is it loaded twice? (Common: GA added by a theme and by a plugin.)
  • Does it need to be on every page? (A booking widget only needs the booking page.)

3. Load the survivors politely

<!-- Doesn't block rendering, runs after HTML is parsed -->
<script src="https://example-widget.com/widget.js" defer></script>

<!-- Independent scripts like analytics can use async -->
<script src="https://www.googletagmanager.com/gtag/js?id=G-XXXX" async></script>
Enter fullscreen mode Exit fullscreen mode

For heavy chat widgets, load them only after the visitor interacts:

let loaded = false;
function loadChat() {
  if (loaded) return; loaded = true;
  const s = document.createElement('script');
  s.src = 'https://example-chat.com/loader.js';
  document.body.appendChild(s);
}
['scroll', 'mousemove', 'touchstart'].forEach(e =>
  window.addEventListener(e, loadChat, { once: true, passive: true })
);
Enter fullscreen mode Exit fullscreen mode

4. Re-test

Run Lighthouse (or PageSpeed Insights) before and after. Removing two or three unused tags often cuts seconds off "Time to Interactive" on mobile.

Fewer scripts = faster site, fewer things that can break, and less visitor data handed to vendors you forgot about.

We do this audit on every site we take over at NEXCOD. Studio: https://nexcod.vercel.app · WhatsApp +1 289 902 5119

Top comments (0)