Appearance
Ad Blocking
Remove ads from your screenshots for cleaner captures.
Plan Requirement
Ad blocking requires a Starter plan or higher.
Usage
Set blockAds=true to block advertisements before capturing:
bash
curl "https://api.urlpix.com/v1/screenshot?url=https://example.com&blockAds=true" \
-H "X-API-Key: sk_live_YOUR_KEY" \
-o clean.pngCombining with Cookie Blocking
For the cleanest screenshots, combine ad and cookie blocking:
bash
curl "https://api.urlpix.com/v1/screenshot?url=https://example.com&blockAds=true&blockCookies=true" \
-H "X-API-Key: sk_live_YOUR_KEY" \
-o pristine.pngHow It Works
When blockAds is enabled, the renderer blocks requests to known ad networks and hides common ad containers via CSS injection. This includes:
- Google Ads / AdSense
- DoubleClick
- Facebook Ads
- Common ad container selectors (
[class*="ad-"],[id*="google_ads"],iframe[src*="ads"])
JavaScript Example
javascript
const params = new URLSearchParams({
url: 'https://example.com',
blockAds: 'true',
blockCookies: 'true',
format: 'webp',
quality: '90',
})
const response = await fetch(
`https://api.urlpix.com/v1/screenshot?${params}`,
{ headers: { 'X-API-Key': 'sk_live_YOUR_KEY' } }
)Tips
- Ad blocking can speed up screenshot rendering by preventing ad network requests
- Some sites detect ad blockers and may show alternative content
- Use
customCSS(Pro+) to hide additional ad elements specific to a target site