Section 05 · 14 guides
AdSense Integration Guides: Frameworks, Ad Units, Performance
The ad code is short, but where and how it loads decides your layout stability, your speed scores and your revenue. These guides cover framework-specific integration, each ad format, and the performance work that keeps pages fast with ads on them.

All guides in this section (14)
- Auto ads vs manual ad units: which one to use, and how to combine them
Auto ads need only the AdSense code in the head of every page; Google then decides where in-page, overlay and intent-driven ads appear.
- How to add Google AdSense to an Astro site (with or without view transitions)
In Astro, a script tag with any attribute other than src is not processed or bundled, so the AdSense code with async and crossorigin is output exactly as written.
- How to add Google AdSense to a Next.js App Router site
In the Next.js App Router, a next/script tag in the root layout loads the AdSense library once for all routes, and Next.js guarantees it loads only once across navigations.
- How to add AdSense to Hugo and Eleventy sites with partials and shortcodes
In Hugo, the AdSense code belongs in a partial called from the base template head, and ad units fit in a shortcode stored in layouts/_shortcodes.
- How to add AdSense to WordPress without a plugin (classic and block themes)
The wp_head action fires inside the head element, so a small function hooked to it outputs the AdSense code on every front-end page.
- AdSense in single-page apps: pushing ad slots on route changes without breaking policy
Each adsbygoogle.push({}) call asks the AdSense library to fill one ins element that has not been filled yet; a filled ins is never filled a second time.
- Responsive AdSense ad units: data-ad-format, full-width mobile ads and CSS sizing
AdSense display ad units are responsive by default and calculate their size from the width of the parent container and the user's screen.
- In-article, In-feed and Multiplex ads: where each native AdSense format belongs and how to place the code
AdSense has three native ad unit types: In-article ads between paragraphs, In-feed ads inside lists of content, and Multiplex ads that show several ads in a grid.
- Anchor, vignette and side rail ads: how AdSense overlay formats work and how to control them
Anchor, vignette and side rail ads are Auto ads overlay formats: Google places them over the page's content without affecting its layout.
- How to prevent layout shift (CLS) from AdSense ads by reserving slot space
web.dev lists ads, embeds and iframes without dimensions, and dynamically injected ads, among the most common causes of poor Cumulative Layout Shift.
- AdSense and Core Web Vitals: measuring the real impact of ads on LCP, INP and CLS
Core Web Vitals pass at the 75th percentile of page loads when LCP is 2.5 seconds or less, INP is 200 milliseconds or less and CLS is 0.1 or less, for mobile and desktop separately.
- Lazy loading AdSense ads: safe patterns, documented limits and what to measure
AdSense Help does not document a lazy-loading setting or a lazy-loading pattern for manual ad units; Google Publisher Tag, the Ad Manager tag, has one.
- AdSense with a Content Security Policy: the strict, nonce-based setup Google supports
Publishers are not required to use a Content Security Policy, but if they do, AdSense supports only strict CSP based on a random nonce, not a domain allowlist.
- Unfilled AdSense ad slots: reading data-ad-status and handling blank spaces cleanly
After an ad request completes, AdSense adds data-ad-status to the ins element with the value "filled", "unfilled" or "unfill-optimized".