---
source: https://iinventedlight.com/library/notes/nextjs-scripts.md
title: "Loading third-party scripts with next/script"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT (vercel/next.js); prose restates cited source lines in own words"
license_family: nextjs-mit
attribution: "Summary by iinventedlight (AI-assisted). Sources: Next.js docs, Scripts, MIT (vercel/next.js); Next.js docs, Script, MIT (vercel/next.js). Copyright (c) 2025 Vercel, Inc. MIT (https://raw.githubusercontent.com/vercel/next.js/canary/license.md)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-09
status: published
approved_by: "Cole Withington, 2026-11-09 13:04 PT: \"Yes, publish all 33 Next.js drafts\""
checked_on: 2026-11-09
as_of: 2026-11-09
confidence: medium
untested: "No Next.js app was run for this note; only the fetched documentation pages were read."
category: coding-references
topic_area: "code-web: Next.js scripts"
tags: [nextjs, script]
client: Librarian
sources:
  - id: S1
    title: "Scripts"
    publisher: Next.js docs
    url: https://nextjs.org/docs/app/guides/scripts
    accessed: 2026-11-09
    license: "MIT (vercel/next.js)"
  - id: S2
    title: "Script"
    publisher: Next.js docs
    url: https://nextjs.org/docs/app/api-reference/components/script
    accessed: 2026-11-09
    license: "MIT (vercel/next.js)"
---
# Loading third-party scripts with next/script

**Answer:** Import `next/script` to load third-party scripts with an explicit loading strategy such as `afterInteractive` or `lazyOnload`.

## See also

- [nextjs-fonts](https://iinventedlight.com/library/notes/nextjs-fonts/)
- [nextjs-images](https://iinventedlight.com/library/notes/nextjs-images/)

## Claims

- id: C1
  claim: Load third-party scripts with next/script.
  source: S1
  evidence: "To load a third-party script for multiple routes, import `next/script`"

- id: C2
  claim: Script strategy controls loading.
  source: S2
  evidence: "The loading strategy of the script. There are four different strategies that can be used:"

- id: C3
  claim: beforeInteractive belongs in the root layout.
  source: S2
  evidence: "Scripts with the `beforeInteractive` strategy must be placed inside a [root layout](/docs/app/api-reference/file-conventions/layout#root-layout),"

- id: C4
  claim: Refer to the strategy API reference.
  source: S1
  evidence: "Refer to the [`next/script`](/docs/app/api-reference/components/script#strategy) API reference documentation to learn more"

## Sources

- [S1] Scripts. Next.js docs. https://nextjs.org/docs/app/guides/scripts . License: MIT (vercel/next.js). Accessed 2026-11-09.

- [S2] Script. Next.js docs. https://nextjs.org/docs/app/api-reference/components/script . License: MIT (vercel/next.js). Accessed 2026-11-09.


License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Copyright (c) 2025 Vercel, Inc. Sources: Next.js docs (vercel/next.js on GitHub / nextjs.org), MIT (https://raw.githubusercontent.com/vercel/next.js/canary/license.md). Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
