Most sites load scripts from other companies: analytics, tag managers, A/B testing, chat, ads, embeds, consent banners. Each one adds network requests and main-thread work you do not control, and together they are often the biggest reason a page is slow to respond.

Measure their cost

  1. List them: open the network panel, filter by third-party domains, and note what each one is for and who owns it.
  2. Measure main-thread time: in a Lighthouse report or the Performance panel, the "third-party usage" view groups blocking time by provider.
  3. Compare with and without: test a page with each script blocked (devtools request blocking) and compare LCP and Total Blocking Time.
  4. Check real users: real-user INP and long tasks show the impact on actual devices.

Ask whether you need it

For each script: who uses its data, how often, and what would break without it? It is common to find tags for tools nobody has opened in months.

Load later

ScriptBetter loading
Analyticsdefer or async, after main content
Chat widgetOn first interaction or after a delay
Video embedsA facade (thumbnail) that loads the player on click
Social embedsOn scroll into view
A/B testingServer-side where possible; avoid anti-flicker snippets that hide the page
<!-- load analytics without blocking rendering -->
<script defer src="https://analytics.example.com/script.js"></script>

<!-- facade for an embedded video: a plain image until clicked -->
<button class="video-facade" data-video-id="abc123"><img src="/thumbs/abc123.jpg" alt="Play demo video" width="640" height="360"></button>

Control the tag manager

Tag managers make it easy for many people to add scripts without review. Put a review step on new tags, set a budget for third-party JavaScript, and periodically remove tags that are no longer used.

Reduce connection costs

For third parties you keep, preconnect to their origin if they are needed early, and self-host scripts where licences allow, so they share your connection and caching. See preload, prefetch and preconnect.

Protect against failures

A third-party script that fails or hangs should not break your page. Load it asynchronously, guard calls to its APIs, and watch for errors from third-party origins in real-user error data.

Worked example

A content site's mobile INP p75 was 420 ms. Third-party usage showed a tag manager loading 14 tags, including two analytics tools doing the same job, a heatmap tool nobody used and a chat widget loaded on every article. Removing three tags, loading chat on interaction and deferring the remaining analytics brought INP p75 to 210 ms and LCP down by 400 ms. Ad revenue was unchanged.

Monitoring third parties

  • Real-user INP and long tasks per page, before and after tag changes.
  • JavaScript errors from third-party domains.
  • Synthetic checks that catch a third party blocking rendering entirely.

VitalRix real user monitoring records Web Vitals and JavaScript errors per page from real visitors, and the free INP check shows how a page responds in a real browser. Related: Total Blocking Time and web performance budgets.

Common mistakes

  • Loading everything synchronously in the head.
  • Anti-flicker snippets that hide the page until an A/B script loads.
  • Never removing old tags.
  • Assuming a vendor's script is "lightweight" without measuring it on a real phone.

A third-party inventory template

ScriptOwnerPurposeLoaded onMain-thread costKeep?
Analytics AMarketingTraffic reportsAll pagesLowYes, deferred
HeatmapsProductUX researchAll pagesHighOnly during studies
Chat widgetSupportLive chatAll pagesHighLoad on interaction
Tag managerMarketingContainerAll pagesVariesYes, reviewed quarterly

Keeping a table like this, with an owner for each row, turns "who added this?" into a quick check. Review it every quarter with the owners, and remove what nobody defends. Measure the effect on INP with the free INP check and on real users with real user monitoring; see frontend monitoring for what else to track.

Do async scripts still affect performance?

Yes. They download in parallel, but their execution still blocks the main thread when it runs, which can hurt INP.

Should I self-host third-party scripts?

Where licences allow and the script does not need to update itself, self-hosting can save connection time and improve caching.

How do I convince stakeholders to remove a tag?

Show the measured cost (INP, LCP, conversion) with and without it, and ask who uses the data.

Try VitalRix free

Uptime monitoring, APM, logs, real user monitoring and status pages in one place. No credit card needed.