Public BetaVitalSentinel is now live! Read the announcement
Performance

What is Third-Party Scripts?

JavaScript code loaded from external domains, such as analytics, ads, social widgets, and other embedded services.

Third-party scripts are JavaScript files loaded from domains other than your own. They include analytics, advertising, social media widgets, chat tools, and more.

Common third-party scripts

  • Google Analytics / Tag Manager
  • Facebook Pixel
  • Chat widgets (Intercom, Drift)
  • Advertising scripts
  • Social sharing buttons
  • Video embeds
  • A/B testing tools

Performance impact

Third-party scripts can significantly affect:

  • Load time: Additional network requests
  • Main thread: Competing for execution time
  • TBT: Blocking user interactions
  • CLS: Injecting content

Measuring third-party impact

Tools to identify slow scripts:

  • Lighthouse "Third-party usage" audit
  • Chrome DevTools Network panel
  • WebPageTest third-party breakdown

Optimizing third-party scripts

Load asynchronously

<script src="analytics.js" async></script>

Delay until needed

// Load chat only when user scrolls
window.addEventListener('scroll', loadChat, { once: true });

Use facades

Show static placeholder, load real widget on interaction.

Self-host when possible

Host fonts and libraries locally for better control.

Monitor your website performance

VitalSentinel tracks Core Web Vitals and performance metrics to help you stay ahead of issues.