Tutorial 5 min read

Best practices for blocking ads and cookie banners

Our database of 50,000+ rules ensures clean screenshots. Learn how the ad blocking system works and how to customize it.

Nothing ruins a screenshot like a giant cookie consent banner or an intrusive ad popup. That's why LambdaShot includes built-in ad and cookie blocking that works on virtually any website.

How it works

Our blocking system uses multiple techniques:

  • Filter lists - We maintain 50,000+ rules from EasyList, EasyPrivacy, and custom sources
  • Cosmetic filtering - CSS rules that hide elements without breaking page functionality
  • Script blocking - Prevents tracking scripts from loading
  • Cookie consent detection - Identifies and dismisses GDPR/CCPA consent dialogs

Enabling ad blocking

Add these parameters to your request:

GET /take?url=https://example.com&block_ads=true&block_cookie_banners=true

You can enable them independently - some users want to block ads but keep cookie banners, or vice versa.

What gets blocked

With block_ads=true:

  • Display ads (banners, sidebars, interstitials)
  • Video pre-roll ads
  • Native advertising units
  • Social media widgets
  • Analytics and tracking pixels

With block_cookie_banners=true:

  • GDPR consent dialogs
  • CCPA opt-out notices
  • Cookie preference popups
  • Newsletter signup overlays
  • Age verification gates (where legally appropriate)

Hiding specific elements

Sometimes you need to hide something that our filters don't catch. Use the hide_selectors parameter:

GET /take?url=https://example.com&hide_selectors=.promo-banner,#popup-overlay

This accepts any valid CSS selector. Multiple selectors can be comma-separated.

Chat widgets

Support chat widgets (Intercom, Drift, etc.) can clutter screenshots. Block them with:

GET /take?url=https://example.com&block_chats=true

Best practices

  1. Start with defaults - Enable block_ads and block_cookie_banners for most use cases
  2. Test your specific URLs - Some sites may need additional hide_selectors
  3. Consider your use case - If you're monitoring ad placements, obviously don't block ads
  4. Combine with delays - Add a short delay to ensure blocking completes before capture

Our filter lists are updated weekly to handle new ad networks and cookie consent providers. If you find something we're not blocking, let us know.