← Back to All Patterns

Cookie Consent Pattern

GDPR cookie consent banners and walls commonly found on European and privacy-focused websites

Banner Variant
Easy
Dismissible banner at bottom of page - content accessible but banner persists until consent

Scraper Challenges:

  • Detect fixed position banner at bottom
  • Click Accept/Reject or Customize
  • Handle cookie preferences modal
  • Verify banner dismissal
/patterns/cookie-consent/banner
Test This Variant
Wall Variant
Easy
Full-screen modal wall that completely blocks content access until consent given

Scraper Challenges:

  • Detect full-screen modal overlay
  • Access blocked background content
  • Handle cookie preferences
  • Verify wall removal after consent
/patterns/cookie-consent/wall
Test This Variant
Pattern Information
How to test cookie consent patterns with your scraping tools

Real-World Examples:

  • European websites complying with GDPR (BBC, The Guardian, etc.)
  • E-commerce sites (Amazon.co.uk, eBay.de, various EU retailers)
  • News sites and blogs with EU audiences
  • Any site serving EU users (required by GDPR cookie consent law)

Common Testing Approaches:

  • Puppeteer/Playwright: Use page.click() to click "Accept All" or "Reject All" buttons
  • Customize: Click customize button, select checkboxes, save preferences
  • Cookie Bypass: Set cookie_consent={"necessary":true,"analytics":false,...} cookie before first request
  • Detection: Look for fixed position elements, high z-index, cookie-related text

Cookie Format:

The cookie_consent cookie stores preferences as JSON:

{"necessary":true,"analytics":true,"marketing":false,"preferences":true}

Expires: 365 days | Path: / | SameSite: Lax

GDPR Compliance Note

These patterns simulate real-world GDPR cookie consent for testing purposes. When scraping production sites, always respect user privacy laws and cookie consent requirements.