Skip to content
Blog

The Code Slowing Down Your Website Isn't the One You Wrote

Third-party scripts are, on most of the websites we audit, the biggest source of slowness. Not the framework, not the images, not the server: the code you load from other domains. Analytics, support chat, advertising ...

Development6 min read
AlejandroChief Technology Officer

The Code Slowing Down Your Website Isn't the One You Wrote

Third-party scripts are, on most of the websites we audit, the biggest source of slowness. Not the framework, not the images, not the server: the code you load from other domains. Analytics, support chat, advertising pixels, cookie banners, embedded maps, review widgets. Each one seems harmless. Together, they become the anchor dragging down your performance.

The uncomfortable part is that this code is not under your control. It lives on someone else’s servers, updates without notice, and runs in your customer’s browser with the same privileges as your own code. You can optimize your site for weeks only for a single external script to undo the work. It’s worth facing this head-on.

Why a Third-Party Script Carries So Much Weight

A third-party script is more than its download size. Its real cost has several layers that are rarely measured together:

  • Connection to another domain. Every new origin forces the browser to resolve DNS, negotiate TLS, and open a connection before downloading anything.
  • Main-thread blocking. While a script executes, the browser cannot respond to clicks or paint content. This is the main enemy of INP.
  • Cascade effect. Many scripts load additional scripts in turn. A single tag manager can inject a dozen requests you never approved.
  • Unpredictability. The provider changes its code and your site slows down without you touching a single line.

That weight directly affects the metrics Google measures. If you want the full context of what is measured and why, see our post on Core Web Vitals fundamentals; here we focus on the cause that most often breaks them.

The Inventory Almost No One Performs

Before optimizing, count. Open your browser’s developer tools, go to the Network tab, and filter by domains that are not yours. The list is usually surprising. For each script, ask yourself three questions:

  1. Does it deliver value that justifies its cost? A chat that generates sales, yes. A widget no one uses, no.
  2. Does it need to load at the start? Almost never. Most can wait until the page is usable.
  3. Is there a lighter alternative? Sometimes a static image can replace an interactive map; a link can replace a full widget.

This exercise is the technical version of doing less, but better: every script you remove is performance you recover without writing a single line of code.

Tactics for Taming What You Keep

Not everything can be removed. Analytics and a few pixels are usually non-negotiable. For those, the key is controlling when and how they load.

Deferred and Asynchronous Loading

A non-critical script should not block rendering. The defer and async attributes tell the browser not to wait for it:

<!-- Blocks rendering until downloaded and executed -->
<script src="https://other-domain.com/widget.js"></script>

<!-- Downloads in parallel and executes without slowing the page -->
<script src="https://other-domain.com/widget.js" defer></script>

The Facade Pattern

For heavy widgets—chats, embedded videos, maps—first load a lightweight image that mimics the component. The real script only downloads when the user interacts. Visitors who never open the chat never pay its cost. This is one of the highest-ROI, lowest-risk optimizations available.

Performance Budget

Set an explicit limit: a maximum number of third-party scripts and a total weight that cannot be exceeded without a conversation. Without a budget, the list only grows, because adding a script is always the easy decision. Defending the budget is, above all, a team discipline.

Provider Self-Control

When we select tools for a project, we do so with performance criteria from the start, not as a final patch. This is part of why we choose a modern stack like Next.js: it gives us control over what loads, when, and from where. Speed is designed; it is not added at the end.

The Hidden Business Cost

This is not a technical discussion for developers. Every tenth of a second of delay erodes conversions, and the accumulation of third-party scripts is often the difference between a fast site and one that drives visitors away. We covered this in business terms in how much milliseconds cost: performance is a revenue channel, not an engineering luxury.

Google documents the impact of these resources and how to mitigate it in detail in its reference resource web.dev. The conclusion is consistent with what we see in every audit: the third party you do not control is usually your biggest lever for improvement.

Frequently Asked Questions

How do I know which third-party scripts my site loads?

Open your browser’s developer tools, go to the Network tab, and filter by domains other than your own. You can also use performance-analysis tools that break down the cost of each external resource.

Is it bad to use Google Tag Manager?

It is not inherently bad, but it is a multiplier: it makes adding tags easy, which is why sites accumulate more than they need. Audit it regularly and remove what does not add value; the convenience of adding should not become technical debt.

Does the facade pattern work for any widget?

It works especially well with heavy elements that users activate voluntarily: chats, videos, maps. You load a lightweight preview and only download the real script on interaction, saving the cost for users who never engage with it.

Does deferring scripts affect analytics?

When configured correctly, modern analytics supports deferred loading without losing relevant data. It is worth verifying measurement after the change, but the impact on accuracy is usually minimal compared with the performance gain.

Final Reflection

You can write the cleanest code in the world and still serve a slow website if you leave the door open to every script someone wants to add. Performance is not lost all at once; it erodes widget by widget, through small decisions no one reviews.

Treat every third-party script for what it is: a guest consuming your customer’s resources. Some deserve to stay; many do not. Bringing order to that list is often the most cost-effective optimization available. If you would like us to review what is loading on your site, we can address it through performance-oriented web development.

Keep reading

Related articles

Development

The Language That Machines Actually Understand

Structured data is the most direct way to explain to a machine what your page contains. A human reads “Different Growth, web development agency, rated 4.9 out of 5” and understands it instantly. A search engine, howev...

Development

Why We Built Our Own Chatbot

Website visitors have questions. Some are simple, others require context about your services. A contact form works, but it introduces friction. A well-implemented chatbot can resolve doubts instantly and capture quali...

Next step

Do you have a project in mind?

If this article was useful and you want to know how we can help, we are here to listen.