Skip to content

How to control third-party script weight

Speed1 min readFixes check third-party-weight

Tag managers, chat widgets, ads and pixels often outweigh the page itself and block the main thread. Load them late, remove what nobody uses.

Step by step, with screenshots: Third-party scripts: taming tag managers, chat widgets and ads →

Check your own site

Runs this check and the other 192, free, in about 45 seconds.

Or run only this check with the free Unused CSS/JS checker.

What it is

Third-party scripts are pieces of JavaScript that your page loads from other companies' servers: analytics, tag managers, ad networks, chat widgets, video embeds, social buttons, A/B testing and review widgets. They run with the same access as your own code, on your visitors' devices.

On many sites they outweigh the page itself and cause most of the main-thread blocking, which slows Interaction to Next Paint and Total Blocking Time. getReport adds up the bytes and blocking time per third party and flags more than 250 KB transferred or 250 ms of blocking. A page is OK when every tag has a clear owner and purpose, loads only where it is needed and does not delay the first screen.

What a passing site looks like

  • Third-party code weight: passeswarning · −2 ptseffort M

Third-party code weight

Why it matters. Tags, widgets and embeds from other companies run on your visitors' phones at your page's expense. Over 250 KB or 250 ms of blocking is a sign they dominate the load.

How to fix it.
  1. List what each third party gives you; remove the ones nobody looks at.
  2. Load the rest after interaction or with a facade (a static thumbnail for YouTube, a click-to-load chat button).
  3. Move tags into a tag manager that fires them late, not in <head>.

Questions people ask

How do third-party scripts affect performance?

They add downloads from other domains, each needing its own connection, and they run JavaScript on the main thread, where it competes with your page. Heavy tags delay the first paint when they load in the head, and they make taps and clicks feel slow. Some load further scripts of their own, so a single tag can pull in several hundred kilobytes.

How do I defer third-party scripts?

Add async or defer to script tags that do not need to run before the page renders, and load widgets such as chat, video and maps only when the visitor scrolls to or clicks them. Tag managers can fire tags after the window has loaded instead of on page view. Show a lightweight placeholder, such as an image with a play button, instead of a full embed.

Does Google Tag Manager slow down a website?

GTM itself is fairly light, but everything it loads counts: each analytics, advertising or heatmap tag adds its own JavaScript. A container with dozens of tags firing on every page can add hundreds of milliseconds of blocking time. Remove tags nobody owns, fire tags only on the pages that need them, and use the window loaded trigger for anything not needed immediately.

How do I audit third-party scripts?

List every third-party domain the page loads; getReport and the Network panel in Chrome DevTools both show them with their size and blocking time. For each one, note who asked for it and what it is used for. Remove what nobody can explain, check that cookie consent really stops tracking scripts before consent, and repeat the check every quarter.

Filed under Speed & Core Web Vitals. Copy is generated from the same catalogue that scores every report, so what you read here is what the report says.