The short answer
Add scripts deliberately, load them asynchronously where possible, and audit what is already on the page every few months. Most sites carry scripts nobody remembers adding and nobody looks at the output of.
The cost is not just speed. A third-party script that fails or hangs can block your page from rendering.
What each script costs
- Download time, on every page load, for every visitor
- Execution time, which blocks the main thread
- A DNS lookup and connection to another domain
- A dependency that can slow or break your page
- A privacy consideration, since it sees your visitors
- Potentially a consent requirement
The fourth is the one that causes incidents. A chat widget or analytics script whose provider has an outage should not take your site down, and without care it can.
Load order matters
| Script type | How to load |
|---|---|
| Anything visual above the fold | Synchronous, minimal |
| Analytics | Asynchronous, after content |
| Chat widgets | Deferred, or on interaction |
| Advertising and tracking pixels | Asynchronous, and audit regularly |
| Fonts | Preload, with a fallback that displays |
Loading a chat widget only when someone shows intent to use it, rather than on every page load, is one of the larger easy wins on a typical business site.
Audit what is already there
- List every third-party domain the page contacts.
- For each, identify who added it and what it is for.
- Check whether anyone looks at its output.
- Remove anything with no owner or no use.
- Repeat every few months, because they accumulate.
Step three removes more than people expect. Tags from old campaigns, abandoned trials and previous agencies are common and cost every visitor load time.
Protect against failure
Load third-party scripts in a way that a slow or failing provider degrades gracefully rather than blocking your page. Asynchronous loading does most of this.
For anything critical to the page working, consider whether a third party should be in that path at all. A form that cannot submit because an external script failed is a lost enquiry.