Loadzen

← All articles

Performance6 min readReece Crowther

Third-Party Scripts and Website Speed: What to Remove and What to Keep

Analytics, chat widgets, social embeds, and ad scripts can silently destroy your page speed. Here is how to audit and clean them up.

The hidden cost of third-party scripts

Every third-party script you add to your site is a dependency you do not control. The script's server has to respond, the code has to download, and the browser has to parse and execute it — all before your page can finish loading.

A single slow third-party script can add 1–3 seconds to your page load time. Most sites accumulate these gradually over years as features are added and old ones are never removed.


The most common slow third-party scripts

Analytics and tracking:

Google Analytics 4 is reasonably lightweight. Older analytics platforms, heatmap tools (Hotjar, FullStory, Lucky Orange), and session recording scripts tend to be much heavier. If you have multiple analytics tools running simultaneously, consolidate them.

Live chat widgets:

Chat widgets (Intercom, Drift, HubSpot Chat, Zendesk) are among the worst offenders. A chat widget can add 300–600KB of JavaScript. If you are not actively using live chat, remove the script entirely.

Social media embeds:

Embedded Twitter timelines, Facebook like boxes, and Instagram feeds load entire social media SDKs. Replace them with static screenshots or links if the live embed is not essential.

Advertising scripts:

Programmatic advertising tags (Google Ad Manager, Prebid) are deliberately aggressive about loading early because ad revenue depends on fast ad rendering. These are very difficult to optimise without specialist knowledge.

Fonts from external CDNs:

Google Fonts is free and convenient but adds a DNS lookup, a connection, and a download. Self-hosting fonts eliminates this dependency entirely.


How to audit your third-party scripts

1. Open Chrome DevTools (F12) and go to the Network tab.

2. Reload your page with the network tab open.

3. Filter by "third-party" or look for requests to domains that are not your own.

4. Sort by size to identify the largest scripts.

5. For each script, ask: is this actively used? Is the benefit worth the performance cost?


Strategies for keeping scripts without destroying speed

Load scripts after interaction: Chat widgets can be loaded only when a user scrolls or moves their mouse, rather than on page load. This improves scores significantly.

Use the defer attribute: Scripts loaded with defer download in parallel with the HTML but only execute after parsing is complete. This removes them from the critical rendering path.

Facade patterns: Replace heavy embeds (YouTube videos, maps, chat widgets) with a lightweight placeholder that loads the real embed only when a user clicks on it.


The rule of thumb

Every third-party script should have a clear business case. If you cannot name a specific metric it improves, remove it. Fewer scripts is almost always faster.

Run a Loadzen check before and after removing scripts to see the measurable impact on your score.

Related guide

Website Performance Optimisation Guide

Check your own site

Run a free speed check with Loadzen and get a prioritized fix plan for your specific platform.

Run free speed check