Policies & violations

Where AdSense code cannot be placed: iframes, emails, software, apps, error pages and other off-limits screens

Last updated Published By the editorial team6 min5 sources

Key takeaways

  • AdSense code may not be integrated into software applications of any kind, including toolbars, browser extensions and desktop applications.
  • Google ads may not be placed inside emails, on pages where email messages are the primary focus, or on screens where private communication is the primary focus.
  • Google's policy FAQ states that placing ads in a frame within another page violates its policies.
  • Apps that show AdSense ads through a web content viewing frame must use an approved option such as the WebView API for Ads, Chrome Custom Tabs, Trusted Web Activities or SFSafariViewController.
  • Ads should not be placed on dead end or no content screens such as Thank You, Exit and Error pages.
A stop sign on a street in Toronto
Image: Stop sign in Toronto, Canada,Katarighe .,CC BY-SA 3.0,via Wikimedia Commons.

AdSense code belongs only in web pages with real publisher content that a visitor opened in a normal browser or an approved app viewing frame. It cannot go in iframes inside other pages, emails, software or toolbars, unapproved app WebViews, pop-ups or pop-unders, private messaging screens, pages built only to show ads, or dead end screens such as error, exit and thank-you pages.

The complete list of off-limits places

Gathered from the AdSense Program policies, the Ad placement policies, the AdSense policy FAQs and the Google Publisher Policies:

Where Rule Source
Iframes within another page “You’re not allowed to place ads in a frame within another page” AdSense policy FAQs
Pages that frame other people’s content No ads on pages displaying someone else’s site in a frame without permission Program policies, Ad placement
Software applications No ads in software of any kind, including toolbars, browser extensions and desktop applications (does not apply to AdMob) Program policies, Ad placement policies
Ads triggered by software No Google ads, search boxes or results displayed as a result of software actions such as toolbars Program policies, Traffic sources
Emails No ads inside email messages, or on pages where email messages are the primary focus Ad placement policies
Private communication No ads where private communication is the primary focus: direct messages, live chats, video chats, private chatrooms Ad placement policies
Pop-ups and pop-unders No ads in windows not opened by intentional user interaction, or in windows without navigation controls and an editable URL field Ad placement policies
Non-content pages No ads on any non-content-based page (does not apply to AdSense for search) Program policies
Pages made for ads No ads on pages published specifically for the purpose of showing ads Program policies
Dead end screens No ads on Thank You, Exit, Error pages, screens under construction, or screens used for alerts or navigation Publisher Policies, Inventory value
Background or off-screen No ads in apps or pages running in the background, appearing outside the display, or when attention is expected elsewhere Publisher Policies, Out of context ads
Google look-alike pages No ads on pages whose content or URL could make users think they are associated with Google through misuse of its brand features Program policies
Content Google cannot evaluate Google may disable ad serving where robots.txt blocks its crawling or on password-protected content without login credentials provided Ad placement policies
Unsupported languages No ads on content not primarily in a supported language Publisher Policies, Inventory value

Why are iframes a problem?

Two separate issues are often mixed up.

Your ad code inside a frame. The policy FAQ is explicit: placing ads on iframe pages “does violate our policies. Firstly, you’re not allowed to place ads in a frame within another page. Secondly, you’re not allowed to put ads in your software”. If you control both a page with ads and an app that loads that page, Google says it will take action.

The rule is about you wrapping a page that contains AdSense code inside a frame on another page, not about how Google’s own script renders an ad once it loads.

Your pages embedded elsewhere. The Policy center counts ad requests “coming from your pages that you’ve embedded into the sites with issues”. If your ad-bearing pages are framed by a third-party site, that site’s problems can appear in your account. Prevent unwanted framing with the frame-ancestors directive of Content Security Policy or the X-Frame-Options header, if you do not need to be embedded.

Can AdSense run in mobile apps?

Only through approved web content viewing frames. The Program policies section “Technical requirements for web content viewing frames for apps” lists:

  • WebView API for Ads: register WebView instances (Android WebView, iOS WKWebView) with the Google Mobile Ads SDK.
  • Android: Chrome Custom Tabs and Trusted Web Activities.
  • iOS: SFSafariViewController (iOS 9 and iOS 10 only, as the policy currently states).

Content shown in the WebView is subject to the same content policies as in a browser. For native app inventory, Google points to AdMob; see app-ads.txt vs ads.txt for the authorization side.

Which pages on my own site should never carry ads?

Even on a compliant website, some templates must stay ad-free. Based on the “Inventory value” policies:

  1. Error pages (404, 500, maintenance pages), including soft 404s.
  2. Thank-you, confirmation and exit pages.
  3. Login, registration and password reset screens.
  4. Private messaging, inbox and chat screens on community sites.
  5. Redirect, “you are leaving this site” and countdown screens.
  6. Placeholder or “coming soon” pages.
  7. Empty search results and empty archives.

The no content guide explains how these screens are enforced.

What about pages behind a login, PDFs and staging sites?

These are gray zones rather than outright bans. Login-protected content can carry ads if Google’s crawler can evaluate it; content it cannot evaluate may have ad serving disabled. PDFs and other non-HTML files cannot run the AdSense script at all. Staging copies of your site should not run live ad code. Details in policy edge cases.

Which exceptions does Google write into these rules?

A few rules carry explicit exceptions in the policy text. Knowing them avoids over-correcting:

Rule Exception stated by Google
No ads integrated into software applications “does not apply to AdMob”, which is built for apps
No ads on non-content-based pages Does not apply to AdSense for search or mobile AdSense for search, whose results pages are by nature search pages
No opening Google ads in a new window or altering the click result Does not apply to AdSense ads served via dynamic allocation through Google Ad Manager
No ads in apps Allowed through the approved web content viewing frames listed above
No ads on content Google cannot evaluate Login-protected content can be evaluated if you provide login credentials to Google

Everything else on the list above is a flat prohibition. There is no traffic threshold, page count or “small test” below which the rules stop applying.

How do I keep ad code out of forbidden places?

Practical steps for any stack:

  1. Inventory your templates. List every template and mark which may load ads.
  2. Gate the ad code centrally. Load the AdSense script from one place (layout, header include, partial) and pass a flag that is false for excluded templates.
  3. Exclude by status code. Never render ad code when the server returns an error status.
  4. Guard environments. Load the code only on the production hostname.
  5. Check single-page apps. Route changes to login or error views must not reuse ad slots from the previous view. See AdSense in single-page apps.
  6. Never distribute the code. Do not paste the ad snippet into email templates, browser extensions, desktop wrappers or app shells.

Example of a minimal guard in a template engine (pseudo-code):

{% if page.ads_allowed and env == "production" and status == 200 %}
  <!-- paste the AdSense code snippet from your account here -->
{% endif %}

Common mistakes

  • Wrapping the site in an app shell with a plain WebView not registered through the WebView API for Ads.
  • Building a browser extension that opens your site with ads. Ads triggered by software are prohibited.
  • Adding ads to a webmail or member inbox on a community site.
  • Monetizing a page that frames another site’s article or video player without adding content.
  • Leaving ad code in the error template inherited from the main layout. Combined with misleading placements, this can escalate quickly; review ad placement policies at the same time.

Frequently asked questions

Can I put AdSense ads inside an iframe on my own site?

Google's AdSense policy FAQ answers that placing ads on iframe pages in your site or app violates its policies: you are not allowed to place ads in a frame within another page. Load the ad code directly in the page the visitor is viewing. Embedding your own pages inside other sites can also bring their policy issues into your Policy center.

Can I show AdSense in my Android or iOS app?

Only through a supported web content viewing frame. Google lists the WebView API for Ads (registering Android WebView or iOS WKWebView with the Google Mobile Ads SDK), Chrome Custom Tabs and Trusted Web Activities on Android, and SFSafariViewController on iOS (iOS 9 and 10 only). For native in-app ads, AdMob is the product designed for apps.

Can I add AdSense to my newsletter or email?

No. Google's ad placement policies prohibit placing Google ads inside email messages and alongside email messages when they are the primary focus of the page. A web version of a newsletter published as a normal article page is different, as long as it is real content and the ad code is not sent in the email itself.

Are ads allowed on my 404 page?

Google lists Error pages, along with Thank You and Exit pages, as dead end or no content screens that should not carry ads. Exclude your error template from ad code, including soft 404 pages that return a normal status but show no content.

Sources

  1. AdSense Program policies · Google AdSense Help
  2. Ad placement policies · Google AdSense Help
  3. AdSense policy FAQs · Google AdSense Help
  4. Google-served ads on screens without publisher-content · Google Publisher Policies Help
  5. Google Publisher Policies · Google Publisher Policies Help