Third-Party Scripts & Tag Management Performance

Third-party scripts are externally supplied code embedded in a website – tracking pixels, chat widgets, video embeds or entire tag management containers such as Google Tag Manager – that load in addition to your own site. Because they often consume bandwidth and main-thread processing time in an uncontrolled way, they are among the most common causes of poor INP scores; they affect LCP mainly when they load early and take bandwidth away from the main content. GTM containers in particular grow unnoticed over the years, because tags are rarely removed even once the tools behind them have long stopped being used.

In practice

Agencies should audit GTM containers regularly, at least once a year, and consistently remove unused tags, pixels and triggers – a simple and often overlooked performance lever. Non-critical scripts such as chat widgets or video embeds can be loaded through a facade pattern (a placeholder that loads the real widget only on click or scroll) or deferred with requestIdleCallback, instead of loading synchronously in the head. For tracking scripts, use server-side tagging where possible (server-side GTM or conversions APIs, for example) rather than client-side pixels, because less code then runs in the browser and main-thread load drops; server-side tagging changes nothing about the consent obligations for tracking. Tools such as Partytown move third-party JavaScript into a web worker and take load off the main thread – not every script is suitable for this, so the effect is worth measuring case by case. A performance budget helps to keep the growth of tag containers under control over the long term; a maximum of 150 to 200 KB of third-party code is not an official specification but a house rule that has served us well. Before every larger campaign rollout, run a lab measurement of main-thread load: PageSpeed Insights and Lighthouse cannot determine INP themselves – that needs real interactions – but Total Blocking Time (TBT) gives them a robust lab proxy. Interactions can additionally be replayed in the Chrome DevTools performance panel. The actual INP effect of new tags only shows up in field data, and because of the rolling 28-day CrUX window it does so with roughly a month's delay.

Matching service

Sources

← Back to the glossary