third-party script
JavaScript from another company that runs on your site, such as analytics, ads, chat widgets or maps.
A third-party script runs with full access to your page, so a compromised vendor can read user data.
In more detail
You do not control its size, timing or behaviour, so it often hurts performance and privacy. Load it as late as it can go, and only from vendors you trust.
Example
Next.js offers next/script loading strategies and @next/third-parties components for common vendors.Related terms
- next/script — The Next.js Script component, which loads third-party JavaScript with a chosen strategy so it does not block the page.
- @next/third-parties — A Next.js package of ready-made, performance-tuned components for popular third-party services.
Taught in
- Route Handlers: RESTful Endpoints with NextRequest — Next.js 15 & Modern App Router Architecture
- Streaming Endpoints: Server-Sent Events & NDJSON Feeds — Next.js 15 & Modern App Router Architecture
- Image & Font Optimization: Zero Layout Shift Assets — Next.js 15 & Modern App Router Architecture
- Script Optimization: next/script & Lazy Third Parties — Next.js 15 & Modern App Router Architecture