On this page

    Get the right capture

    Remove Cookie Banners and Ads

    Get clean screenshots: switch on the blocking options, then click, remove or block what is left. Real before and after renders of IKEA and Spiegel.

    Time
    10 minutes
    Plan
    Free
    You need
    • An API key in RS_API_KEY
    • A browser with developer tools, to find selectors

    What you will have at the end

    The same page as a visitor sees it after they accept cookies, with one option.

    Most screenshots of European sites show a cookie banner, and many news sites show ads above the content. You will switch on the blocking options first. They fix most pages. Then you will fix the pages they do not fix.

    All images on this page are real renders from October 2026. Sites change their banners often, so your results can differ.

    Switch on the blocking options

    Four switches cover most pages:

    curl -X POST https://api.renderscreenshot.com/v1/screenshot \
      -H "Authorization: Bearer $RS_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "url": "https://www.ikea.com/gb/en/",
        "block": { "cookie_banners": true, "ads": true, "trackers": true, "chat_widgets": true }
      }' --output clean.png
    
    No options
    block.cookie_banners
    cookie_banners clicks the accept button of common consent tools, or hides the banner.
    Option What it does
    cookie_banners Clicks the accept button of common consent tools. If it finds none, it hides common banner elements.
    ads Blocks requests to ad networks and hides common ad containers.
    trackers Blocks analytics and tracking scripts.
    chat_widgets Blocks Intercom, Drift, Zendesk, Crisp and similar widgets.

    In the SDKs:

    Node.js

    const image = await client.take(
      TakeOptions.url('https://www.ikea.com/gb/en/')
        .blockCookieBanners()
        .blockAds()
        .blockTrackers()
        .blockChatWidgets()
    );
    

    Python

    image = client.take(
        TakeOptions.url('https://www.ikea.com/gb/en/')
        .block_cookie_banners()
        .block_ads()
        .block_trackers()
        .block_chat_widgets()
    )
    

    Ruby

    image = client.take(
      RenderScreenshot::TakeOptions
        .url('https://www.ikea.com/gb/en/')
        .block_cookie_banners
        .block_ads
        .block_trackers
        .block_chat_widgets
    )
    

    GET request

    # GET supports the two most common switches
    curl "https://api.renderscreenshot.com/v1/screenshot?url=https%3A%2F%2Fwww.ikea.com%2Fgb%2Fen%2F&block_cookies=true&block_ads=true" \
      -H "Authorization: Bearer $RS_API_KEY" --output clean.png
    

    Remove a banner that is still there

    Some sites build their own consent screen, or load it in a frame. Spiegel is one of them: with cookie_banners on, the consent screen is still there.

    To remove it, find its container:

    1. Open the page in Chrome or Firefox and right-click the banner. Choose Inspect.
    2. In the elements panel, move up to the element that holds the whole banner and the dark backdrop.
    3. Copy its ID or a stable class. On Spiegel it is <div id="sp_message_container_1519494">. The number changes, so match the start of the ID.

    Add the selector to page.remove:

    {
      "url": "https://www.spiegel.de",
      "block": { "cookie_banners": true },
      "page": { "remove": ["[id^='sp_message_container']"] }
    }
    
    cookie_banners only
    + page.remove
    page.remove takes the element out of the page before the capture.

    If removing the banner does not work, try these in order:

    Try Request When it helps
    Click the site's accept button "page": { "click": "#accept-button" } The site shows different content after consent
    Block the consent script "block": { "requests": ["*consent-tool-host*"] } The banner comes back after removal
    Wait for a late banner "wait": { "delay": 2000 } The banner appears a few seconds after load

    The blocking guide lists the selectors and script hosts of OneTrust, Cookiebot, Didomi, TrustArc and Usercentrics.

    Collapse empty ad slots

    block.ads stops the ads, but many sites keep the space for them, so your screenshot can start with an empty box. Remove the site's ad wrapper too. On BBC, in October 2026, it is [data-testid="ad-unit"]:

    {
      "url": "https://www.bbc.com",
      "block": { "ads": true, "cookie_banners": true },
      "page": { "remove": ["[data-testid='ad-unit']"] }
    }
    

    Use page.hide instead of page.remove when you want to keep the space, for example to keep the layout the same between screenshots.

    Test on your own URLs

    Render each URL twice, without and with your options, and look at the pairs. This script saves before-N.png and after-N.png for every line in urls.txt:

    #!/usr/bin/env bash
    n=0
    while read -r url; do
      n=$((n + 1))
      for mode in before after; do
        block='{}'
        [ "$mode" = after ] && block='{"cookie_banners": true, "ads": true, "trackers": true, "chat_widgets": true}'
        curl -sS -X POST https://api.renderscreenshot.com/v1/screenshot \
          -H "Authorization: Bearer $RS_API_KEY" -H "Content-Type: application/json" \
          -d "{\"url\": \"$url\", \"block\": $block}" -o "$mode-$n.png"
      done
      echo "$n $url"
    done < urls.txt
    

    Each URL uses two credits. When the pairs look right, keep the options in your production requests.

    A site that shows "access denied" or a challenge page instead of content is blocking the renderer, not showing a banner. See capture sites with bot protection.

    Next steps

    Try RenderScreenshot free

    150 free credits every month, no credit card required.