Skip to content

Third-Party Script

A third-party script is JavaScript provided or controlled by an external service and embedded into a website to provide additional functionality.

A third-party script is JavaScript added to a website but provided or controlled by an external service.

These scripts commonly provide analytics, embeds, advertising, chat, payments, consent management, tracking, or other integrations.

Common Examples

Third-party scripts may come from:

  • Analytics platforms
  • Advertising networks
  • Social media embeds
  • Video platforms
  • Chat tools
  • Review widgets
  • A/B testing systems
  • Marketing automation
  • Payment tools
  • Consent platforms

These services can provide important functionality, but they also add resources the website does not completely control.

How They Affect Performance

A third-party script may introduce:

  • Additional network requests
  • JavaScript downloads
  • Main-thread work
  • Additional dependencies
  • Iframes
  • Fonts
  • Images
  • Requests to multiple external domains

One small script tag can therefore trigger considerably more work than the original file suggests.

Why It Matters

Third-party code competes with the website's own content for bandwidth and processing time.

It can affect loading as well as responsiveness measured through Interaction to Next Paint.

External scripts may also change independently of the website itself.

Common Problems

Common problems include:

  • Tools installed but no longer used
  • Multiple analytics or marketing systems collecting similar data
  • Scripts loading on every page unnecessarily
  • Widgets loaded before important content
  • Plugins adding scripts automatically
  • Third-party failures delaying other resources
  • Teams unable to explain who owns a particular integration

How to Improve

Audit third-party scripts regularly.

For each one, ask:

  1. What does it do?
  2. Who owns it?
  3. Where is it required?
  4. Does it need to load immediately?
  5. Does its value justify its performance cost?

Remove unnecessary services and defer non-critical integrations where appropriate.