Skip to main content
Docs

Introduction

Nuxt Scripts gives Nuxt apps a consistent way to load third-party scripts, with controls for timing, privacy, and type safety.

Background

useHead works well for adding a script tag. The setup becomes harder once the script must account for server-side rendering (SSR), delayed loading, or a typed global API. Nuxt Scripts handles those cases through one API.

Third-Party Script Challenges

  • Running safely in both client and server code.
  • Choosing when the browser loads a script.
  • Avoiding render-blocking work and unnecessary data exposure.
  • Validating configuration and typing the script API.

How Third Parties Can Impact User Experience

Analytics, video embeds, maps, and social widgets all run code that you do not control. One integration may be cheap; several can compete with hydration, delay interactivity, and block rendering.

Third-party scripts can add network overhead and delay document parsing, depending on how they load. The 2025 Web Almanac chapter on Third Parties found that request counts rose even as pages contacted fewer unique third-party domains. Counting vendors alone can therefore understate how much work they add to a page.

Nuxt Scripts Features

Loading

  • By default, scripts load with the onNuxtReady trigger, after hydration and during an idle period.
  • Trigger scripts from consent, visibility, interaction, or application state.
  • Serve supported scripts from your origin with First-Party Mode.

Developer APIs

  • Registry entries for common third-party applications.
  • Page-event helpers for analytics integrations.
  • Input validation for script options.
  • Type safety and SSR-compliant APIs.

Privacy

  • Minimize user data exposure with the privacy-focused proxy.
  • Integrated consent management.
  • Privacy defaults such as crossorigin="anonymous" and referrerpolicy="no-referrer".