---
title: "Third-party script loads too early (lint/script-strategy)"
description: "lint/script-strategy: Analytics, chat and tag-manager scripts loaded with the default `afterInteractive` (or as a blocking `<script src>`) compete with…"
canonical: https://void-design.vercel.app/rules/lint/script-strategy
lastModified: 2026-09-16
---

# Third-party script loads too early

`lint/script-strategy` · severity **warn** · category Lint · detected by `void lint` and `void audit`

## Why it matters

Analytics, chat and tag-manager scripts loaded with the default `afterInteractive` (or as a blocking `<script src>`) compete with hydration and inflate TBT/INP. `beforeInteractive` only works in the root layout.

## How to fix it

Load third-party scripts with `next/script` `strategy="lazyOnload"` (or `worker`). Reserve `beforeInteractive` for consent/bot-detection in `app/layout.tsx`.

## Example

```tsx
import Script from 'next/script'
<Script src="https://www.googletagmanager.com/gtag/js?id=G-XXXX" strategy="lazyOnload" />
```

## References

- https://nextjs.org/docs/app/api-reference/components/script#strategy

## More lint rules

`void lint` reports 67 rules in this category. Static source checks with no browser: Tailwind v4 silent failures, Next.js 16 API traps, React render-body bugs, accessibility markup, SEO files and motion hygiene.

- `missing-alt` Image without `alt` — [lint/missing-alt](https://void-design.vercel.app/rules/lint/missing-alt)
- `google-fonts-link` Google Fonts loaded via `<link>` / `@import` — [lint/google-fonts-link](https://void-design.vercel.app/rules/lint/google-fonts-link)
- `font-display` `@font-face` without `font-display` — [lint/font-display](https://void-design.vercel.app/rules/lint/font-display)
- `too-many-font-families` More than 3 font families loaded — [lint/too-many-font-families](https://void-design.vercel.app/rules/lint/too-many-font-families)
- `browser-global-in-render` Browser global (`window`, `document`, `navigator`, `localStorage`) at module scope or during render — [lint/browser-global-in-render](https://void-design.vercel.app/rules/lint/browser-global-in-render)
- `timer-in-render` `setTimeout` / `setInterval` called in a component body — [lint/timer-in-render](https://void-design.vercel.app/rules/lint/timer-in-render)
- `motionvalue-subscribe-in-render` MotionValue `.on("change")` subscription in a component body — [lint/motionvalue-subscribe-in-render](https://void-design.vercel.app/rules/lint/motionvalue-subscribe-in-render)
- `webgl-in-map` WebGL canvas rendered inside `.map()` — [lint/webgl-in-map](https://void-design.vercel.app/rules/lint/webgl-in-map)

Detected by `void lint` and `void audit`. Explain it in a terminal: `void rules lint/script-strategy`
