Skip to content
Screenshot API · Use case

Take a website screenshot without cookie banners, popups or ads

A screenshot without a cookie banner is what every thumbnail, archive and monitoring job wants, and what a headless browser rarely delivers. Consent dialogs, newsletter popups and ad slots cover the content a human would reach in one click. The Screenshot API blocks the third-party noise by default with its built-in adblock and gives you two options for anything the site ships itself.

A news homepage captured without its consent dialog
Generated live by the API call below with adblock at its default, so the consent service never loads.
The problem

Cookie banners and ads cover the page you wanted to capture

An automated browser is always a first-time visitor: no stored consent, no dismissed popup, no ad preferences. Every capture gets the full consent wall, and the article, the product or the dashboard you wanted sits dimmed behind it.

The usual fixes are fragile. A fixed delay does not remove anything. A script that hunts for an “Accept” button breaks when the label, the language or the vendor changes. And because ads and consent scripts load late and shift the layout, two captures of the same URL taken an hour apart rarely match.

The adblock parameter, enabled by default, stops third-party requests for advertisements, trackers and cookie consent services at the network level, before the page renders. A banner built into the site’s own code is not a third-party request, so it needs a click on its button or a rule injected with styles. Both are one parameter away.

How it works

How to remove cookie consent popups and ads from a screenshot

Work in layers: keep adblock on, click the consent button when the banner is first-party, and hide the wrapper with injected CSS when clicking is unreliable. The page interaction guide walks through each layer with live examples.

1 · Capture with adblock (the default)
import createClient from 'microlink.io'

const microlink = createClient({
  apiKey: process.env.MICROLINK_API_KEY
})

const { url } = await microlink.screenshot('https://example.com', {
  adblock: true
})

adblock is true by default, so you can leave it out. Ads, trackers and third-party consent services are blocked before rendering, and the response carries the hosted image URL.

2 · Dismiss a first-party banner
import createClient from 'microlink.io'

const microlink = createClient({
  apiKey: process.env.MICROLINK_API_KEY
})

const { url } = await microlink.screenshot('https://example.com', {
  click: ['#cookie-accept', '.newsletter-close'],
  waitForSelector: 'main'
})

Selectors are clicked in array order, so you can close one layer before the next. waitForSelector then holds the capture until the content you care about is visible.

3 · Or hide it with CSS
curl 'https://api.microlink.io/?url=https%3A%2F%2Fexample.com&screenshot=true&meta=false&styles=.cookie-banner%2C+.ad-slot+%7B+display%3A+none+%21important+%7D'

Injected CSS takes the elements out of the layout without depending on a clickable button. styles accepts inline rules or the absolute URL of a stylesheet.

Parameters used
  • adblock Blocks third-party ad, tracker and cookie consent requests. On by default; set it to false to capture the page as a first-time visitor sees it.
  • click One CSS selector or an ordered array of selectors to click before the capture.
  • styles Inline CSS or an absolute stylesheet URL injected into the page before the capture.
  • modules Injects JavaScript as an ES module when a banner needs more than CSS to go away.

Reach for styles before scripts: CSS cannot break the page, and it keeps working when the button label changes. When nothing else is enough, the function parameter gives you full control of the browser page.

Why it works

Why blocking the request beats hiding the banner

Hiding a popup after it loads is a race. Blocking the request that creates it is faster and repeatable, which is what an ad-free screenshot API needs at volume.

01 · Network level
Blocked requests never render, so nothing shifts.
The adblock engine stops ad, tracker and consent service requests before the browser executes them. Those requests are not essential to the page, so skipping them also cuts response time. The layout you capture is the one the content was designed for.

The engine is the open-source Cliqz adblocker running inside the capture browser, so the filtering happens before a single ad or consent script executes.

02 · Repeatable captures
The same URL produces the same screenshot.
Without third-party slots and popups, two captures taken hours apart differ only when the content itself changed. That is the baseline visual monitoring, archives and thumbnails depend on.

The same default keeps documents readable in the clean PDF recipe, since adblock applies to every request that renders a page.

03 · First-party escape hatch
click and styles handle banners the site ships itself.
Some publishers build the consent dialog into their own bundle. Click its accept button, or hide the wrapper with one CSS rule, then wait for the main content before capturing. No custom browser script is required.

When not to: if you need the consent flow itself in the picture, for compliance evidence or a UX review, set adblock to false and capture the page as a first-time visitor sees it.

FAQ

Most of the time you do nothing: adblock is on by default and blocks third-party consent services before the page renders. If a banner still shows, it is first-party, so add click with the selector of its accept button or hide it with a styles rule.

Do I need to enable adblock to get ad-free screenshots?

No. It is enabled by default, including on the free endpoint. Pass adblock: false only when you want ads, trackers and consent flows to stay visible in the capture.
Popups injected by third-party consent management services are blocked at the network level, along with ad networks and trackers. A dialog built into the site’s own code is not a third-party request, so dismiss it with click or hide it with styles.

How do I hide a banner in a screenshot when its button has no stable selector?

Use styles to hide the banner wrapper instead of clicking. CSS injection does not depend on a button existing, and display: none takes the element out of the layout.
For anything more involved, modules and scripts inject JavaScript, and the function parameter gives you full browser control.

Does blocking ads change the layout of the screenshot?

Ad slots that never receive a creative usually collapse or stay empty, which is the layout any visitor with an ad blocker already gets. If a slot leaves a gap you do not want, hide it with a styles rule.
Related use cases

Solve the next problem with the same API

Screenshot a single element

Crop the capture to one CSS selector, such as a chart or a pricing table, with a transparent background if you need it.

Screenshots of JavaScript-rendered pages

Wait for a selector, a lifecycle event or a delay so single-page apps and lazy sections finish rendering before capture.

Screenshots behind a login

Forward a session cookie or a bearer token as a request header and capture pages only your users can see.

Faster, smaller screenshots

Skip metadata, pick JPEG quality and pixel density, and wait for a selector instead of a timer to cut time and bytes.

Clean PDFs without ads or banners

Get a document, not a browser tab: ads and consent popups blocked by default, sticky chrome removed with one CSS rule.

Clean Markdown, no boilerplate

Convert only the article body: one selector keeps navigation, ads and widgets out of the Markdown.

Ready for clean screenshots?

Ads and consent popups are gone by default, and first-party banners take one option. Start on the free endpoint and capture your first clean page today.