third-party

Mitigate third-party script performance impact with async/defer loading and resource hints.

235|25|Updated Mar 24, 2026
One-click install
npx skills add https://github.com/PatternsDev/skills --skill third-party
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: third-party
Source: https://github.com/PatternsDev/skills/tree/main/javascript/third-party
Command: npx skills add https://github.com/PatternsDev/skills --skill third-party

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Mitigate the performance impact of third-party scripts on web pages, helping teams maintain fast load times and good Core Web Vitals while preserving essential functionality.

Core Features & Use Cases

  • Async/Defer Loading: load non-critical scripts without blocking rendering.
  • Resource Hints and Preconnect: establish early connections to third-party origins to reduce latency.
  • Lazy-Load Heavy Embeds: defer YouTube, maps, and social widgets until needed.
  • Self-Hosting & Caching: host critical third-party scripts on your domain for better control and caching.
  • Use Case: e.g., e-commerce product pages with analytics and chat widgets, marketing sites with ad and tag managers, content sites with social embeds.

Quick Start

Implement async or defer for non-critical scripts, add dns-prefetch/preconnect hints, and lazy-load heavy third-party embeds to reduce page load time.

Frequently Asked Questions about third-party

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce third-party script impact on Core Web Vitals?

Reduce third-party script impact by implementing async and defer loading for non-critical scripts, adding resource hints like dns-prefetch and preconnect, and lazy-loading heavy embeds to preserve Core Web Vitals.

What is the best way to lazy-load third-party widgets like YouTube and maps?

The best way to lazy-load third-party widgets is to defer loading heavy embeds like YouTube, maps, and social widgets until user interaction, preventing them from blocking initial page rendering and slowing down load times.

How do dns-prefetch and preconnect resource hints improve frontend optimization?

Dns-prefetch and preconnect resource hints improve frontend optimization by establishing early connections to third-party origins, reducing DNS lookup latency and connection setup time before the actual script requests occur.

Does self-hosting third-party scripts improve web performance?

Self-hosting third-party scripts improves web performance by moving critical scripts to your own domain, enabling better cache control, reducing connection overhead, and eliminating external origin latency for analytics and tag managers.

When should I use async vs defer for loading non-critical scripts?

Use async for independent third-party scripts like analytics that can load anytime, and defer for scripts needing DOM execution order, ensuring non-critical scripts load without blocking page rendering.

Can I optimize third-party analytics and ads without removing them from my site?

Yes, you can optimize third-party analytics and ads without removing them by applying async or defer attributes, adding preconnect hints, and lazy-loading heavy embeds to maintain essential functionality while protecting user-perceived performance.