Ad Blocking
Block advertisements from appearing in your screenshots using built-in ad blocking technology.
How it works
When enabled, the blocker intercepts network requests and blocks known ad servers and tracking scripts before they load.
Basic usage
curl "https://api.domshot.com/shot?key=YOUR_API_KEY&url=https://example.com&blockAds=true" \
--output screenshot.png
const params = new URLSearchParams({
key: 'YOUR_API_KEY',
url: 'https://example.com',
blockAds: 'true'
});
await fetch(`https://api.domshot.com/shot?${params}`)
.then(res => res.blob())
.then(blob => fs.writeFile('screenshot.png', blob));
$params = [
'key' => 'YOUR_API_KEY',
'url' => 'https://example.com',
'blockAds' => 'true'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.domshot.com/shot?' . http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$result = curl_exec($ch);
file_put_contents('screenshot.png', $result);
curl_close($ch);
package main
import (
"net/http"
"net/url"
)
func main() {
params := url.Values{}
params.Set("key", "YOUR_API_KEY")
params.Set("url", "https://example.com")
params.Set("blockAds", "true")
resp, _ := http.Get("https://api.domshot.com/shot?" + params.Encode())
defer resp.Body.Close()
// Save response to file
}
Benefits
- Cleaner screenshots - Remove distracting advertisements
- Faster loading - Fewer resources to download
- Consistent results - Avoid dynamic ad content variations
- Privacy-focused - Blocks known tracking scripts
Ad blocking may cause layout shifts or broken elements on websites that rely heavily on ad revenue. Test thoroughly before using in production.
When to use ad blocking
| Use case | Recommended |
|---|
| Documentation screenshots | Yes - cleaner appearance |
| E-commerce sites | Maybe - may affect layout |
| News sites | Yes - removes ads/clutter |
| Social media | Yes - improves consistency |
| Testing web apps | No - may break functionality |
Combining with other blocking
Ad blocking can be combined with banner and tracking blocking:
curl "https://api.domshot.com/shot?key=YOUR_API_KEY&url=https://example.com&blockAds=true&blockBanners=true&blockTracking=true" \
--output screenshot.png
const params = new URLSearchParams({
key: 'YOUR_API_KEY',
url: 'https://example.com',
blockAds: 'true',
blockBanners: 'true',
blockTracking: 'true'
});
await fetch(`https://api.domshot.com/shot?${params}`)
.then(res => res.blob())
.then(blob => fs.writeFile('screenshot.png', blob));
$params = [
'key' => 'YOUR_API_KEY',
'url' => 'https://example.com',
'blockAds' => 'true',
'blockBanners' => 'true',
'blockTracking' => 'true'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.domshot.com/shot?' . http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$result = curl_exec($ch);
file_put_contents('screenshot.png', $result);
curl_close($ch);
package main
import (
"net/http"
"net/url"
)
func main() {
params := url.Values{}
params.Set("key", "YOUR_API_KEY")
params.Set("url", "https://example.com")
params.Set("blockAds", "true")
params.Set("blockBanners", "true")
params.Set("blockTracking", "true")
resp, _ := http.Get("https://api.domshot.com/shot?" + params.Encode())
defer resp.Body.Close()
// Save response to file
}
See also:
Parameters
| Parameter | Type | Default | Description |
|---|
blockAds | boolean | false | Enable ad blocking using prebuilt filters |
Ad blocking has minimal performance overhead:
- Initial filter loading: ~50-100ms (one-time per request)
- Network request blocking: Reduces overall page load time
- Memory usage: Slight increase for blocker instance
For pages with heavy advertising, enabling ad blocking often results in faster screenshots and smaller file sizes.