Home / Fix guides / Speed and Core Web Vitals

How to reduce the impact of third-party code on your website

Find every script your pages load from other companies, remove the ones nobody uses, and delay or lighten the rest. Most sites get faster with just those three steps.

A third-party script is any code on your pages that loads from someone else's server: chat widgets, analytics, advertising and social pixels, review badges, embedded videos, booking tools and cookie banners. Each one looks harmless alone. Together they can slow a page more than your own content does. The fix is to list them, remove what nobody uses, delay what is not needed straight away, and keep a short approved list.

What the problem looks like

Visitors see a page that appears but does not react when they tap a menu or button. Text or buttons jump when a chat bubble or banner arrives late. Phones feel worse than laptops, because phones have less processing power to run all that extra code.

Owners usually meet it as a warning in PageSpeed Insights: Reduce the impact of third-party code, Reduce JavaScript execution time, or a high Total Blocking Time value.

Why it matters

  • Speed and search: Core Web Vitals are part of how Google judges page experience. Third-party code mostly hurts responsiveness (INP) and can delay the main content too.
  • Sales and enquiries: a page that freezes while someone tries to fill in a form or add to cart loses people at the worst moment.
  • Security and privacy: a script you load runs with nearly the same power as your own code. If the provider is compromised, or sets cookies before consent, you carry the risk.
  • Reliability: if a provider is slow or down, some scripts can hold up your page with them.

How to check your site (free)

  1. Run your address through PageSpeed Insights (pagespeed.web.dev) and read the mobile result. Open the audit called Reduce the impact of third-party code. It lists each provider with its size and the time it kept the page busy.
  2. In Chrome, open DevTools (F12), go to the Network tab, tick 3rd-party requests, reload and sort by size or time.
  3. Run WebPageTest (webpagetest.org). Its results break requests down by domain, which makes the heavy providers easy to spot.
  4. View the page source and search for <script and src=. If you use a tag manager, open its container and read the tag list too, because tags there do not show in the page source.
  5. Test on a real mid-range phone if you can. Lab scores on a fast computer hide the problem.

Write down every provider you find, what it is for, and who asked for it. You will often find tools nobody remembers adding.

How to fix it in general

1. Remove what is not used. Old analytics, abandoned ad pixels, A/B testing tools from a finished test, and duplicate trackers are the quickest wins. Removal is better than any clever loading trick.

2. Load the rest later. Scripts that are not needed to show the page can wait. Developers use async or defer on script tags so they do not block the page. Tools like chat, surveys and heat maps can load after the first interaction or a few seconds after the page is ready.

3. Use a light stand-in for heavy embeds. For YouTube, Google Maps and similar embeds, show an image and load the real player only when someone clicks. Add loading="lazy" to iframes below the first screen.

4. Pick lighter options. Ask whether you need five tools that each do a small job. One analytics tool is usually enough. Check whether a simple link or form can replace a heavy widget.

5. Cut connection delays. For the one or two providers that must load early, a <link rel="preconnect" href="https://example.com"> hint lets the browser start connecting sooner. Do not preconnect to everything, it defeats the purpose.

6. For developers: a tool such as Partytown can move some scripts off the main thread. It needs testing, since not every script works that way.

Common platforms

PlatformWhere to look
WordPressPlugins that add scripts, theme settings, and the header and footer code box
ShopifyApps (each can add code), the theme, and the Customer events settings (usually under Settings)
Google Tag ManagerThe tag list and triggers in your container
Wix, Squarespace, WebflowMarketing and tracking settings, custom code areas, embedded apps
Custom or Next.js sitesScript tags in the layout and any script loading component

Menu names change between versions and themes, so look for words like Integrations, Tracking, Custom code, Header and Footer. We have step-by-step guides for WordPress, Shopify and Google Tag Manager.

Two cautions. Uninstalling a plugin or app does not always remove its code, so recheck the page source afterwards. And before you delay a tracking or consent related script, make sure your cookie banner still works as intended.

How to confirm the fix worked

  1. Run PageSpeed Insights again on the same page and same device type. Run it two or three times, scores vary a little.
  2. Check that the provider list in Reduce the impact of third-party code is shorter and that Total Blocking Time went down.
  3. Test the things you changed: chat opens, forms send, orders complete, tracking still records visits.
  4. Look at the field data section at the top of PageSpeed Insights. It comes from real visitors and updates slowly, so give it a few weeks.

How to stop it coming back

  • Keep a simple list of every outside script, its purpose and its owner. Review it every few months.
  • Make one person the gatekeeper. Before anyone adds a new pixel, widget or app, ask what it costs in speed.
  • Add new tags through one place (a tag manager or your theme), not scattered across pages.
  • Test speed again after any marketing campaign launch, new plugin or app install.
  • Remove tools when a campaign ends.

SiteMonday's week 4 service checks speed and Core Web Vitals each year and ends with a written report and a ranked fix list, so third-party slowdowns show up with the rest. SiteMonday finds and explains the problems. Making the changes is up to you or your developer.

Step by step for your platform

Questions

What counts as third-party code?

Any script, widget or embed loaded from a domain that is not yours. Analytics, chat, ad pixels, fonts, maps, video players and review badges all count.

Can I just delete all of it?

You can remove anything you do not use or need. For tools you do need, delaying or lightening them usually gives most of the benefit without losing the feature.

Will removing a tracking script hurt my marketing?

Only if you still rely on its data. Check with whoever uses the reports first, and keep one working analytics tool.

Is async or defer enough on its own?

It helps, because the script no longer blocks the page from showing. But the script still runs and can keep the page busy, so removing or delaying it is often better.

Why is my score fine on desktop but poor on mobile?

Phones have slower processors, and third-party scripts are mostly processing work. The same code that is barely noticed on a laptop can freeze a phone for a moment.

Does a tag manager make this better or worse?

It makes tags easier to manage, but it also makes it easy to pile up tags. Review the tag list regularly and remove old ones.

Related problems