A third-party script is code on your page that is served from another organization's domain: analytics, advertising, A/B testing, chat widgets, social buttons, consent banners or tag managers. It runs with the same privileges as your own code.
Why it matters
Each one adds a DNS lookup, connection, download and execution cost, and the page owner cannot optimize the file itself. Scripts can block rendering, occupy the main thread (hurting INP and TBT), inject late content that shifts the layout, and load further scripts of their own. They also affect privacy and security, since a compromised vendor can run code on your site.
Example
<!-- Blocking: delays parsing -->
<script src="https://widgets.example.com/chat.js"></script>
<!-- Better: non-blocking, loaded after the page -->
<script src="https://widgets.example.com/chat.js" defer></script>
Further options include loading on user interaction (click a "chat" button first), self-hosting a stable file, using preconnect for critical vendors and removing tags nobody checks.
Common mistakes
- Never auditing tags. Tag managers hide old tracking pixels that stay for years.
- Assuming async makes a script free; execution still uses the main thread.
- Loading ad and analytics scripts before the main content.
- Ignoring how many extra requests one vendor script triggers.
Related
Get notified when this term updates
Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.
यह पेज सामान्य जानकारी है, जिसे हमारी संपादकीय टीम ने लिखा है और दस्तावेज़ीकरण बदलने पर अपडेट किया जाता है। सर्वर और प्रदाता अलग-अलग होते हैं, इसलिए बदलाव पहले सुरक्षित तरीके से जाँचें। देखें: संपादकीय नीति और अस्वीकरण.