# Third-party scripts

Category: [Performance & Core Web Vitals](https://seo-geo-glossary.com/en/glossary/category/performance-core-web-vitals/) › [Optimization](https://seo-geo-glossary.com/en/glossary/category/performance-core-web-vitals/optimization/)

**Third-party scripts** are JavaScript files that a website loads from domains it does not control. Typical examples are analytics, advertising, social buttons, video embeds, chat widgets and A/B testing tools.

## What effect do they have on performance?
web.dev lists several risks. Each script adds network requests to other servers. Parsing and running the code occupies the main thread, which delays rendering and reactions to input. A slow vendor server can hold up the page, and some scripts use outdated practices such as `document.write()`. Lighthouse reports this under audits like "Reduce JavaScript execution time". Total Blocking Time (TBT) reflects it in lab tests, and Interaction to Next Paint (INP) in field data.

## How can they be controlled?
- **Governance:** web.dev recommends checking each tag for compliance, necessity, ownership, purpose and regular review, and setting a budget such as a maximum number of tags per page type.
- **Loading behavior:** `async` runs a script as soon as it is downloaded, `defer` after HTML parsing. Non-critical scripts can be loaded later, for example on interaction.
- **Connections:** `preconnect` and `dns-prefetch` shorten connection setup to important vendors.
- **Hosting:** web.dev mentions self-hosting critical scripts for better cache control, at the cost of manual updates.

## Example
In Chrome DevTools, a script can be blocked in the Network panel. Comparing a run with and without it shows what it costs.

## Related terms

- [Google Tag Manager](https://seo-geo-glossary.com/en/glossary/google-tag-manager/index.md)
- [Total Blocking Time (TBT)](https://seo-geo-glossary.com/en/glossary/total-blocking-time/index.md)
- [Interaction to Next Paint (INP)](https://seo-geo-glossary.com/en/glossary/interaction-to-next-paint/index.md)
- [Lazy loading](https://seo-geo-glossary.com/en/glossary/lazy-loading/index.md)
- [Consent Mode](https://seo-geo-glossary.com/en/glossary/consent-mode/index.md)
- [Cookie banner](https://seo-geo-glossary.com/en/glossary/cookie-banner/index.md)

## Sources

- [Efficiently load third-party JavaScript – web.dev](https://web.dev/articles/efficiently-load-third-party-javascript)
- [Controlling third-party scripts with a tag governance process – web.dev (updated 2021-04-22)](https://web.dev/articles/controlling-third-party-scripts)
- [Third-Party Scripts – Vercel Academy](https://vercel.com/academy/nextjs-foundations/third-party-scripts)

---

Last updated: October 7, 2026
URL: https://seo-geo-glossary.com/en/glossary/third-party-scripts/
