How to remove cookie banners and ads from website screenshots
Riley ThompsonJul 1, 20268 min read
Find out how easy it is to capture and share pixel-perfect screenshots at scale using Allscreenshots. Sign up for a free account and start integrating your first screenshot API call today.
RT
Riley Thompson
Developer advocate focused on web tooling, screenshot APIs, and helping teams ship better visual experiences.
Automated screenshots are only useful when they show the page you meant to capture. Cookie consent banners, ads, newsletter popups, chat widgets, survey prompts, and sticky promos can cover the exact content you need to inspect.
The problem is worse at scale. A single manual screenshot can be cleaned up by closing the banner. A scheduled capture, visual regression run, audit archive, or thumbnail pipeline needs a repeatable rule.
This guide shows how to reduce screenshot noise without hiding meaningful page changes.
Why Screenshots Get Covered
Modern websites often render several layers on top of the page:
Overlay
Why it appears
Screenshot problem
Cookie banner
Consent and privacy compliance
Covers footer, CTAs, pricing, or forms
Ad slot
Monetization
Creates layout shifts and inconsistent captures
Newsletter modal
Lead capture
Blocks the page after a delay
Chat widget
Support or sales
Floats over buttons and content
Promo bar
Campaigns and discounts
Changes frequently and triggers false diffs
Survey prompt
Feedback collection
Appears unpredictably
None of these layers are necessarily bugs. They are part of the live page. But if your goal is to document the underlying product page, compare a visual baseline, or generate clean thumbnails, they get in the way.
Use Built-In Blocking First
AllScreenshots supports ad blocking and cookie banner blocking as capture settings:
Use these before reaching for custom workarounds. They handle the common cases while keeping your capture request simple.
Keep ad and cookie-banner blocking consistent across a workflow. Mixing blocked and unblocked captures makes visual diffs harder to interpret.
Decide What You Are Trying to Prove
Before hiding anything, be clear about the purpose of the screenshot.
Goal
Recommended approach
Marketing review
Block cookie banners and ads
Visual regression testing
Block noise, keep product UI visible
Compliance evidence
Capture the page as the user sees it, or archive both versions
Thumbnail generation
Block overlays and use a fixed viewport
Competitor monitoring
Usually block ads, but think carefully before hiding promos
Cookie banner QA
Do not block the cookie banner
There is no universal "clean" screenshot. A consent banner is noise in a product thumbnail, but it is the subject of the test when your legal team asks whether consent appears correctly.
Use Stable Wait Conditions
Some popups appear after a delay. Others appear only after the main content renders. If you capture too early, you may miss a banner that a real user sees. If you capture too late, a newsletter modal may cover the page.
The goal is to capture after the real page is ready, not after every third-party script has finished doing work.
Handle Full-Page Screenshots Carefully
Full-page screenshots are more likely to expose overlays because they include areas a user would normally scroll to. Sticky cookie banners and chat widgets can repeat visually or cover content across the captured page.
For full-page captures:
Use blockCookieBanners for consent overlays.
Use blockAds when ad slots are not part of the review.
Capture a desktop and mobile viewport separately.
Review the first output manually before scheduling hundreds of pages.
Keep the viewport height realistic so sticky elements behave like they do for users.
If you only need the hero section or first viewport, avoid full-page mode. It is faster and produces fewer surprises.
Make Visual Diffs Less Noisy
Cookie banners and ads are a common cause of false positives in visual regression testing. They change independently from your code, so they can fail a pull request even when the product UI is fine.
For visual regression, aim for deterministic captures:
Source of noise
Mitigation
Cookie banner
Enable cookie-banner blocking
Ads
Enable ad blocking
Chat widget
Disable it in test environments when possible
Animations
Prefer reduced motion or wait for a stable selector
Dates and timers
Hide or freeze them in the app under test
Personalized content
Use a seeded test account or static fixture data
The cleanest setup is an environment built for testing: same data, same viewport, same theme, same page state. Blocking helps, but it is not a substitute for deterministic test data.
When You Should Not Block
Do not hide overlays when they are part of the user experience you are reviewing.
Examples:
Testing whether a cookie banner appears in the right countries
Checking whether an ad layout reserves enough space
Auditing whether legal disclosures are visible
Reviewing a promotional campaign before launch
Capturing evidence of exactly what a customer saw
In those cases, capture the page as-is. If you also need a clean version for design review, archive both:
pricing-user-view.png
pricing-clean-review.png
That small naming distinction prevents confusion later.
Use Scheduled Screenshots for Ongoing Reviews
If the same pages need regular review, use a schedule rather than running captures manually. Scheduled screenshots are useful for:
Pricing pages
Landing pages
Legal pages
Documentation homepages
Public app status pages
Partner pages
For scheduled monitoring, start with blocking enabled and change detection at a moderate sensitivity. Then inspect the first few runs. If important page changes are hidden, loosen the blocking. If harmless third-party movement triggers alerts, tighten the setup.
Before you automate a page, take one test screenshot and check:
Is the content you care about visible?
Did the cookie banner disappear?
Are ad slots removed or still reserving space?
Did the page layout shift after blocking?
Is a chat widget still covering a button?
Does mobile behave differently from desktop?
Are you capturing too early or too late?
One manual review at the start saves noisy alerts and broken baselines later.
Clean Screenshots Are a Product Decision
Removing banners and ads is not just a technical setting. It changes what the screenshot represents.
For QA and visual regression, clean captures usually produce better signal. For compliance and customer evidence, the raw user view may be more accurate. For monitoring, the right answer depends on whether the overlay is part of what you care about.
Pick the capture policy once, document it, and use it consistently across the workflow.