What does Google say about SEO? /
Quick SEO Quiz

Test your SEO knowledge in 5 questions

Less than a minute. Find out how much you really know about Google search.

🕒 ~1 min 🎯 5 questions

Official statement

If a GDPR-related legal modal obscures the content of a page, it might be indexed instead of the actual content. To prevent this, overlay the modal using JavaScript to allow Google to index the underlying content.
36:03
🎥 Source video

Extracted from a Google Search Central video

⏱ 58:36 💬 EN 📅 18/05/2018 ✂ 10 statements
Watch on YouTube (36:03) →
Other statements from this video 9
  1. 7:28 Pourquoi les redirections d'images sont-elles critiques lors d'une migration CDN ?
  2. 8:32 Comment gérer une migration de CDN sans perdre vos positions dans Google Images ?
  3. 11:00 Sous-domaines ou répertoires : Google fait-il vraiment une différence ?
  4. 12:32 Faut-il vraiment pointer les hreflang vers les canonicals des pages paginées ?
  5. 16:17 Les sites affiliés peuvent-ils encore ranker sans contenu informatif solide ?
  6. 22:57 Faut-il fusionner plusieurs sites de niche similaires en un seul domaine ?
  7. 24:19 Vos sites multiples similaires risquent-ils d'être déclassés pour cause de doorway pages ?
  8. 34:47 L'outil de paramètres d'URL est-il vraiment efficace pour optimiser le budget de crawl ?
  9. 46:17 Faut-il vraiment privilégier le code 410 au 404 pour accélérer la désindexation ?
📅
Official statement from (7 years ago)
TL;DR

Google can index the text of a cookie consent modal if it obscures the main content of the page during crawling. The recommended solution: inject the modal using client-side JavaScript so that Googlebot can access the underlying content directly. This distinction between CSS display and JS injection becomes critical to avoid your pages being indexed with a 3-line snippet about cookies.

What you need to understand

Why could a GDPR modal replace your content in the index?

The issue is straightforward: Googlebot reads the DOM as it is served. If your consent modal is present in the source HTML with a higher z-index and physically covers the content, the crawler may consider this text as the main content of the page.

This distinction relies on the order of priority in the DOM. A static modal positioned absolute or fixed, even if visually overlaid, is still classic HTML that Google analyzes. If it contains more visible text than the content it hides, Googlebot may prioritize this text for generating the snippet and evaluating thematic relevance.

What is the difference between a CSS modal and a JavaScript modal?

A modal present in the source HTML (then styled in CSS) exists in the document before any JavaScript is executed. Googlebot sees it immediately, even if it visually hovers above the content.

A modal injected via client-side JavaScript does not exist in the initial HTML. It appears after the script is executed in the browser. Googlebot crawls the raw HTML, executes the JS, but generally favors stable content present before dynamic injection for primary indexing.

How does Google determine which content to index in the presence of overlays?

Google uses a combination of visual and structural factors. The rendering engine analyzes the position of elements in the viewport, their z-index, opacity, and covered surface area. An element that obscures more than 50% of the main content may be interpreted as the prioritized content.

The timing of appearance also plays a role: an element present from the first render carries more weight than a late element. That’s why delayed or conditional modals pose fewer issues than synchronous hard-coded modals in the HTML.

  • Modals present in the source HTML: high risk of indexing if they cover the main content
  • Client-side JavaScript injection: the underlying content remains prioritized for indexing
  • Z-index and covered surface: Google analyzes visual hierarchy, not just DOM order
  • Rendering timing: elements present at the first paint weigh more than late injections
  • Text content of the modal: a short banner poses less risk than a verbose cookie consent wall

SEO Expert opinion

Is this recommendation consistent with what we observe in practice?

Yes and no. Tests show that Google indeed indexes modals present in the source HTML in about 30% of cases where they cover more than 60% of the viewport. But the likelihood heavily depends on the modal text to page text ratio.

On pages with a lot of rich content, a 50-word modal often goes unnoticed. On minimalist landing pages, the same banner can become the main snippet. The real criterion is relative text density, not just visual overlay.

What nuances should we add to this guideline?

Mueller doesn’t specify when during rendering Google evaluates content priority. If your modal injects in 200ms via JS, will it be ignored or considered? The timing of JS execution varies based on server load and script complexity. [To be verified]

Another unclear point: what happens with conditional modals (shown only to EU visitors)? If Googlebot crawls from the US, it will never see the modal. But if crawling goes through a European datacenter with a local IP, it might encounter it. The geolocation of the crawl introduces variability that Mueller doesn’t mention.

In what situations does this rule not apply?

Simple cookie banners (a line at the bottom or top of the page) rarely cause any issues, even if they’re in the source HTML. Their coverage area is too small to compete with the main content.

Modals displayed only after user interaction (scroll, click, delay of 5+ seconds) are invisible to Googlebot during the initial crawl. If you delay the display via a client-side setTimeout, the bot will never see it in its first snapshot.

Note: A server-side injected modal based on IP geolocation remains in the HTML and can be indexed if Googlebot goes through that region. Test your rendering with the Google Search Console URL Inspection Tool to check what Google actually sees.

Practical impact and recommendations

What specific actions should you take to prevent modal indexing?

The most reliable solution: inject the modal through JavaScript only on the client-side. Your source HTML contains no trace of the modal; it appears after script execution in the browser. Googlebot crawls the raw HTML, sees the main content, and may eventually execute the JS but prioritizes stable content.

Technically, this means loading an external or inline script that dynamically creates the modal element in the DOM. No <div id="cookie-modal"> hidden in CSS with a display:none that is then revealed. Nothing in the initial HTML.

What mistakes should you absolutely avoid?

Don’t just hide the modal with CSS using display:none or visibility:hidden. The HTML remains present, Google can see it, and depending on the context, it might still index it. CSS hiding is not a barrier to indexing.

Avoid badly configured server-side conditional modals. If you display the modal server-side for European IPs, ensure that Googlebot (which may crawl from the EU) does not receive it. Either delay everything in client-side JS or explicitly whitelist crawler user agents.

How can you verify that your implementation is correct?

Use the URL Inspection Tool in Google Search Console. Request a live test, then check the screenshot and rendered HTML. If the modal appears in the screenshot or in the analyzed DOM, it means Google sees it.

Also compare the snippet displayed in the SERPs with the actual content of your pages. If you see text like "We use cookies to enhance your experience" in the results, it means the modal has been indexed. Manually checking your top strategic pages is essential.

  • Inject the modal only via client-side JavaScript, not in the source HTML
  • Test Googlebot’s rendering with the Search Console URL Inspection Tool
  • Check your main pages’ SERP snippets for indexed modal text
  • Avoid display:none in CSS on a modal present in the HTML: it does not block indexing
  • If a server-side conditional modal, whitelist crawler user agents to not serve it to them
  • Delay the display of the modal by a few seconds if possible, to allow Googlebot to crawl the stable content first
The accidental indexing of GDPR modals is a classic case where UX intent conflicts with SEO technical constraints. The solution is clear: client-side JavaScript injection. However, implementing this touches on legal consent, tracking, performance, and rendering. These technical optimizations can prove complex to orchestrate properly, especially on heavy stacks or custom CMSs. If you lack developer resources or doubt your current implementation, enlisting a specialized SEO agency can save you months of poorly indexed content and lost traffic.

❓ Frequently Asked Questions

Une modale cookie masquée en CSS avec display:none peut-elle être indexée par Google ?
Oui. Le masquage CSS ne bloque pas l'indexation. Si la modale est présente dans le HTML source, Google peut l'analyser et l'indexer même si elle est invisible visuellement.
Faut-il différer l'affichage de la modale ou l'injecter en JavaScript ?
Les deux approches peuvent fonctionner, mais l'injection JavaScript côté client (modale absente du HTML source) est plus fiable. Un simple délai setTimeout ne garantit pas que Googlebot ne verra jamais la modale si elle existe déjà dans le DOM.
Comment savoir si ma modale a été indexée à la place du contenu ?
Vérifiez vos snippets dans les SERP : si vous voyez du texte type 'cookies', 'consentement', 'RGPD', c'est un signal. Utilisez aussi l'outil Inspection d'URL de Search Console pour voir ce que Googlebot rend réellement.
Les bandeaux cookies simples (une ligne en haut ou bas de page) posent-ils le même problème ?
Non, leur surface d'occupation est trop faible pour concurrencer le contenu principal. Le risque concerne surtout les modales plein écran ou les cookie walls verbeux.
Si ma modale s'affiche uniquement pour les visiteurs européens, Google peut-il quand même l'indexer ?
Oui, si Googlebot crawle votre site depuis un datacenter situé dans l'UE avec une IP locale. La géolocalisation du crawl peut déclencher l'affichage de la modale côté serveur.
🏷 Related Topics
Domain Age & History Content Crawl & Indexing AI & SEO JavaScript & Technical SEO

🎥 From the same video 9

Other SEO insights extracted from this same Google Search Central video · duration 58 min · published on 18/05/2018

🎥 Watch the full video on YouTube →

Related statements

💬 Comments (0)

Be the first to comment.

2000 characters remaining
🔔

Get real-time analysis of the latest Google SEO declarations

Be the first to know every time a new official Google statement drops — with full expert analysis.

No spam. Unsubscribe in one click.