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.
Quick options
Block ads
Remove common advertising networks:
{
"url": "https://example.com",
"blockAds": true
}This blocks:
- Google Ads
- Facebook Ads
- Amazon Ads
- Common ad networks and exchanges
- Tracking pixels
Block cookie banners
Remove GDPR/CCPA cookie consent popups:
{
"url": "https://example.com",
"blockCookieBanners": true
}This handles:
- OneTrust
- Cookiebot
- TrustArc
- Custom consent implementations
- EU cookie notices
Combine both
Use both options together for clean screenshots:
{
"url": "https://example.com",
"blockAds": true,
"blockCookieBanners": true
}Block levels
For more comprehensive blocking, use the blockLevel parameter:
{
"url": "https://example.com",
"blockLevel": "pro"
}Available levels
| Level | Description | Use case |
|---|---|---|
none | No domain blocking | Full page render |
light | Basic ad networks | Minimal blocking |
normal | Common trackers and ads | General use |
pro | Aggressive blocking | Clean screenshots |
pro_plus | Very aggressive | Maximum blocking |
ultimate | Most aggressive | May 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
| Element | Selector |
|---|---|
| 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 'Authorization: Bearer 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.pngE-commerce product page
curl -X POST 'https://api.allscreenshots.com/v1/screenshots' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://shop.example.com/product",
"blockLevel": "pro",
"hideSelectors": [
"#chat-widget",
".upsell-section"
],
"customCss": ".price-tag { font-size: 24px !important; }"
}' --output product.pngNews website
curl -X POST 'https://api.allscreenshots.com/v1/screenshots' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://news.example.com",
"blockAds": true,
"blockCookieBanners": true,
"blockLevel": "normal",
"customCss": "video { display: none; } .paywall-overlay { display: none !important; }"
}' --output news.pngBest practices
Start with quick options
Begin with blockAds and blockCookieBanners:
{
"blockAds": true,
"blockCookieBanners": true
}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; }"
}