Allscreenshots Docs
Features

Ad and content blocking

Block ads, trackers, and cookie banners from screenshots

Ad and content blocking

Remove unwanted content like ads, trackers, and cookie consent banners to capture clean screenshots.

Ad blocking and cookie banner blocking are enabled by default for screenshot, async, bulk, schedule, and compose captures. Set blockAds: false or blockCookieBanners: false when you need an unfiltered page render.

Quick options

Ad blocking

Common advertising networks are removed by default:

{
  "url": "https://example.com"
}

This blocks:

  • Google Ads
  • Facebook Ads
  • Amazon Ads
  • Common ad networks and exchanges
  • Tracking pixels

GDPR/CCPA cookie consent popups are removed by default:

{
  "url": "https://example.com"
}

This handles:

  • OneTrust
  • Cookiebot
  • TrustArc
  • Custom consent implementations
  • EU cookie notices

Disable blocking

Set either option to false if you want to preserve ads or cookie banners:

{
  "url": "https://example.com",
  "blockAds": false,
  "blockCookieBanners": false
}

Block levels

For more comprehensive blocking, use the blockLevel parameter:

{
  "url": "https://example.com",
  "blockLevel": "pro"
}

Available levels

LevelDescriptionUse case
noneNo domain blockingFull page render
lightBasic ad networksMinimal blocking
normalCommon trackers and adsGeneral use
proAggressive blockingClean screenshots
pro_plusVery aggressiveMaximum blocking
ultimateMost aggressiveMay break some sites

Higher block levels may break some websites that depend on blocked resources. Test your target URLs before using aggressive levels in production.

What gets blocked

Each level includes everything from lower levels plus:

Light

  • Major ad networks (Google, Facebook, Amazon)
  • Basic analytics (Google Analytics)

Normal

  • Social media trackers
  • Marketing pixels
  • A/B testing platforms
  • Session recording tools

Pro

  • All third-party tracking
  • CDN-hosted trackers
  • Fingerprinting scripts
  • Most advertising

Pro Plus

  • Aggressive list additions
  • Regional ad networks
  • Crypto miners
  • Malware domains

Ultimate

  • Everything above
  • Edge cases and new trackers
  • May over-block legitimate resources

Hide specific elements

For fine-grained control, hide elements by CSS selector:

{
  "url": "https://example.com",
  "hideSelectors": [
    ".newsletter-popup",
    "#chat-widget",
    "[data-testid='promo-banner']",
    ".sticky-footer-ad"
  ]
}

Selector examples

ElementSelector
Chat widgets#intercom-container, .drift-widget
Newsletter popups.modal-newsletter, [data-popup='newsletter']
Promo banners.promo-banner, .announcement-bar
Social share buttons.share-buttons, .social-links
Fixed headers.sticky-header

You can hide up to 50 selectors per request.

Custom CSS

Inject CSS to hide or modify elements:

{
  "url": "https://example.com",
  "customCss": ".newsletter-modal { display: none !important; } .hero-section { background: #fff; }"
}

Common patterns

Hide multiple elements:

.ad-container, .sponsored-content, .affiliate-link {
  display: none !important;
}

Remove sticky positioning:

.sticky-header, .fixed-sidebar {
  position: relative !important;
}

Disable animations:

*, *::before, *::after {
  animation: none !important;
  transition: none !important;
}

Examples

Clean article screenshot

curl -X POST 'https://api.allscreenshots.com/v1/screenshots' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "url": "https://example.com/article",
    "blockAds": true,
    "blockCookieBanners": true,
    "hideSelectors": [
      ".newsletter-modal",
      ".related-articles",
      ".comments-section"
    ],
    "fullPage": true
  }' --output clean-article.png

E-commerce product page

curl -X POST 'https://api.allscreenshots.com/v1/screenshots' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "url": "https://example.com/product",
    "blockLevel": "pro",
    "hideSelectors": [
      "#chat-widget",
      ".upsell-section"
    ],
    "customCss": ".price-tag { font-size: 24px !important; }"
  }' --output product.png

News website

curl -X POST 'https://api.allscreenshots.com/v1/screenshots' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "url": "https://example.com/news",
    "blockAds": true,
    "blockCookieBanners": true,
    "blockLevel": "normal",
    "customCss": "video { display: none; } .paywall-overlay { display: none !important; }"
  }' --output news.png

Best practices

Use the defaults first

Begin with the default blockAds and blockCookieBanners behavior:

{
  "url": "https://example.com"
}

Only increase blockLevel if needed.

Test before production

Some sites break with aggressive blocking. Test your target URLs:

const levels = ['none', 'light', 'normal', 'pro'];

for (const level of levels) {
  const screenshot = await capture({
    url: 'https://example.com',
    blockLevel: level,
  });
  // Verify output visually
}

Use selectors for specific elements

If blocking breaks functionality, switch to targeted selectors:

{
  "blockLevel": "none",
  "hideSelectors": [
    ".specific-ad-container",
    "#that-annoying-popup"
  ]
}

Combine approaches

Layer blocking methods for best results:

{
  "blockAds": true,
  "blockCookieBanners": true,
  "blockLevel": "light",
  "hideSelectors": [".newsletter-modal"],
  "customCss": ".chat-widget { visibility: hidden; }"
}

On this page