Dev.to
7/10/2026

How I Took a Site From 69 to 96 on PageSpeed by Fixing One Script Tag
Short summary
A small Next.js site went from PageSpeed 69 to 96 by replacing a raw async AdSense script tag with Next.js's Script component using the lazyOnload strategy. The async attribute wasn't enough because the 186 KiB script still competed with page content during initial load, even though no ads were rendering yet. lazyOnload defers loading until the browser is idle, preserving ad functionality while eliminating the performance penalty.
- •Replace raw async script tags with next/script lazyOnload for non-critical third-party scripts
- •PageSpeed score improved from 69 to 96 with zero functionality loss
- •Audit all ads, chat widgets, and analytics scripts for proper loading strategy in Next.js apps
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



