Digital Technology & Websites

Third-Party Scripts: The Hidden Cost to Website Speed

Chat widgets, trackers and tag managers can quietly slow a website. Here is how to audit third-party scripts and load the ones you keep more safely.

Third-party scripts slow websites because every chat widget, tracker, heat map and embed adds network requests and JavaScript that the browser must download and run, often outside your control. The fix is a routine, not a one-off: list every script, ask what it earns, remove what does not, and load the rest so it cannot block the page.

Why they hurt

Google’s web.dev guidance lists the common causes: many network requests, heavy JavaScript that keeps the main thread busy, large unoptimised media, weak caching or compression, legacy APIs such as document.write(), and duplicate libraries pulled in by different embeds. They also bring privacy and security risks and can behave unpredictably (web.dev).

The trap is that each script looks small and was added for a good reason. Together they can undo the work done on the rest of the site. They matter for the metrics described in Core Web Vitals for business.

Step 1: Inventory

Open your site with browser developer tools and list every request to a domain you do not own. Group them:

Type Examples of purpose
Analytics Traffic reporting
Advertising Conversion tracking, remarketing
Chat and support Live chat widgets
Social and video embeds Feeds, video players
Testing and personalisation A/B tests
Fonts and libraries Hosted fonts, framework CDNs

For each, record who added it, why, who owns the vendor account and whether anyone still looks at the data. Old agency or campaign tags are common finds.

Step 2: Measure the cost

web.dev suggests using Lighthouse’s boot-up time and network payload audits to find the costly scripts, blocking individual requests in Chrome DevTools to see the page without them, and blocking domains in WebPageTest to compare runs. It also advises throttling the network and CPU and repeating tests, since single runs mislead (web.dev).

Step 3: Decide

For each script ask:

  1. Is the data or feature used in a decision, or by customers, this quarter?
  2. Is there a lighter alternative, such as a link to a contact form instead of a chat widget?
  3. Does it need to load on every page, or only on one?

Remove anything that fails all three. web.dev’s first recommendation is simply to remove scripts that add no clear value.

Step 4: Load what remains sensibly

MDN explains the options for external scripts. A default script blocks parsing. async downloads in parallel and runs as soon as it arrives, in no guaranteed order. defer downloads in parallel and runs after parsing, in document order (MDN). Neither has any effect on inline scripts.

Other tactics from web.dev:

  • async suits scripts that must run early, such as some analytics. defer suits less critical content.
  • Use preconnect or dns-prefetch for third-party domains you keep.
  • Lazy load embeds, such as videos, that users will not see immediately.
  • Use a tag manager to load tags asynchronously, but restrict who can add tags, because it becomes a back door for new scripts.
  • Use Content Security Policy and Subresource Integrity to reduce security risk.
  • Consider self-hosting critical scripts, weighing the loss of vendor updates and security fixes.

web.dev also warns that async and defer do not fix the cost of large script volumes, so fewer scripts beats cleverer loading.

Governance that lasts

  • One owner for the tag list.
  • A short approval step before anything new is added.
  • A quarterly audit, with a calendar reminder.
  • A performance check after each new script goes live.

Honest trade-offs

Removing a tracker can remove reporting your marketing team needs, and replacing a chat widget may reduce enquiries. Measure both speed and business outcomes. Where a site is built as a lean static site, such as the approach discussed in Astro versus WordPress, there is simply less room for scripts to accumulate. And if you are rebuilding, plan the tag list in advance, as covered in redesigning without losing SEO value.

Where Radiance Impact fits

Radiance Impact’s Technology division builds and maintains business websites, including performance work. To discuss a script audit, contact us.

Sources