Integration

Next.js SEO fixes without a redeploy for every change

Updated ยท By the SEOAmazing team

Yes, SEOAmazing works with Next.js. Add one next/script tag to your root layout, app/layout.tsx in the App Router, so the snippet loads on every route. SEOAmazing crawls your site, proposes fixes for titles, meta descriptions, H1s, alt text and schema, and applies the ones you approve without a code change or deploy.

Why on-page SEO is hard to keep up with in Next.js

Next.js gives you good SEO tools. The Metadata API lets you set titles and descriptions per route, and server rendering puts that HTML in the first response. The hard part is not the tooling. It is keeping hundreds of pages right over time.

  • Metadata is scattered. It lives in layouts, pages and generateMetadata functions across many routes, so there is no single place to see what every page says.
  • Every change needs a deploy. Fixing one meta description means a code edit, a pull request, a review and a build. Marketing tweaks queue up behind product work.
  • Client-rendered parts are invisible to some bots. Content or tags added only in the browser never reach AI crawlers that skip JavaScript.
  • Content pages multiply. CMS-driven blog posts, docs and landing pages often share one template, so their titles and alt text end up generic.

How to install SEOAmazing in the Next.js App Router

The Next.js docs say that to load a third-party script on all routes, you import next/script and include it in your root layout. Next.js makes sure the script only loads once, even as users move between pages.

On strategy: the plain snippet uses defer, which means it runs after the HTML is parsed and never blocks paint. The closest next/script setting is afterInteractive, which loads early but after some hydration. It is also the default, so writing it out just makes the choice clear. You do not need beforeInteractive. The Next.js docs reserve that for critical scripts like bot detectors and consent managers. Skip the worker strategy too, since the docs say it does not yet work with the App Router.

Next.js forwards extra attributes, including custom data attributes, to the final script element. That is how data-site-id reaches the snippet.

  1. Add your domain in SEOAmazing and copy the snippet from your dashboard. Note its src URL and your site key.
  2. Open app/layout.tsx and import Script from next/script.
  3. Add the Script element inside the html element, using your src and data-site-id values.
  4. Deploy once. This is the only deploy SEOAmazing needs.
  5. Start the crawl in SEOAmazing and review the fixes it proposes.
app/layout.tsx (use the src and site key from your dashboard)
import Script from "next/script";

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        {children}
        <Script
          src="โ€ฆ/pixel.js"
          data-site-id="YOUR_SITE_KEY"
          strategy="afterInteractive"
        />
      </body>
    </html>
  );
}

Using the Pages Router instead

In the Pages Router, the Next.js docs load scripts for all routes from pages/_app. Import Script from next/script and render it next to your Component, with the same src, data-site-id and afterInteractive strategy as above. Deploy once, then start the crawl.

For reference, this is the plain snippet shape your dashboard gives you. In Next.js, use the next/script version above rather than pasting this tag by hand.

Your snippet (copy the exact one from your dashboard)
<script defer src="โ€ฆ/pixel.js" data-site-id="YOUR_SITE_KEY"></script>

What SEOAmazing changes, and what stays in your code

SEOAmazing never touches your repository. It does not open pull requests or edit files. Each fix appears in a review queue with the current value, the proposed value (editable), a severity and a one-line reason. Nothing changes until you click Approve.

Approved changes are applied in the browser by the snippet, and the ruleset is cached at the edge for about five minutes. So a fix is live a few minutes after approval, with no build.

  • It can change: title tags, meta descriptions, a single clear H1, JSON-LD schema, image alt text and internal-link anchor text.
  • It does not change: your components, your Metadata API exports, your routes or your build.
  • Changes are live only while the snippet is installed. Remove the Script tag and your pages show what your code renders. Writing fixes back to source is on the roadmap, not live.
  • The snippet is under 8 KB gzipped, cannot throw into your app, and your site renders as normal if our CDN is unreachable.

How Google and AI crawlers see the changes

Google renders JavaScript, so Googlebot sees the changes the snippet applies.

Many AI crawlers, such as GPTBot, ClaudeBot and PerplexityBot, do not run JavaScript. They read your server HTML only. SEOAmazing's prerender service can serve them fully rendered HTML with approved changes already applied. It needs bot traffic routed to the prerender with a small edge rule and the domain enabled on our side. This is set up with our help, not automatic. seoamazing.com itself runs this way.

When to use your code, and when to use SEOAmazing

If you control the code, server-rendered metadata is still the best home for your core pages. Your homepage, pricing page and top landing pages should set their titles, descriptions and schema with the Metadata API, so every crawler sees them in the first response with nothing extra to set up.

SEOAmazing is for everything around that. Use it for the long tail of blog posts, docs and template pages, and for fast testing of a new title or description without waiting on a deploy. When a change proves itself, you can move it into code. Rank tracking and Search Console data in SEOAmazing show which changes are worth keeping.

Frequently asked questions

Is there an npm package for SEOAmazing?

No. You load the snippet with next/script, which ships with Next.js. There is nothing to install from npm.

Which next/script strategy should I use?

Use afterInteractive. It is the default and the closest match to the plain snippet's defer behavior. beforeInteractive is meant for critical scripts, and the worker strategy does not yet work with the App Router.

Will SEOAmazing override my generateMetadata titles?

Only on the live page and only for fixes you approve. Your code is not changed, and your server HTML still contains your original metadata.

Do AI crawlers see the changes on a Next.js site?

Not by default, since many AI crawlers do not run JavaScript. They see your server-rendered HTML. Our prerender service can serve them the updated HTML, set up with our help through a small edge rule.

Does it work with static export or ISR pages?

The snippet works on any page that serves HTML and loads the root layout, so static, ISR and server-rendered routes all run it the same way.

Related

See what's holding your site back

Run a free crawl. Review AI fixes. Approve what you like. No CMS edits.

Start free crawl โ†’