How to Audit Cookie Consent Across Hundreds of Websites

Peter Bubenik ยท Dropbox Tech ยท ยท Source

After studying this material, you should be able to:

  1. Explain what cookies are and distinguish between strictly necessary and non-essential cookies
  2. Describe why cookie compliance is technically challenging at scale
  3. Understand how an automated cookie auditor works end-to-end
  4. Identify the key components needed to build a scalable privacy compliance system
  5. Apply the principle of translating legal/policy requirements into testable technical behaviors

Step-by-Step Study Material

Step 1: Understanding Cookies and Why They Matter

What Are Cookies?

Cookies are small pieces of data a website sends to your browser when you visit. Think of them like a sticky note a website leaves in your browser.

Two Types of Cookies

TypePurposeConsent Required?
Strictly NecessaryKeeping you logged in, language settingsโŒ No โ€” loads automatically
Non-EssentialAnalytics, marketing, advertisingโœ… Yes โ€” requires user consent

Why This Matters

Privacy laws in many regions (like GDPR in the EU) legally require websites to get your permission before loading non-essential cookies.

๐Ÿ’ก Key Insight: Cookie banners are not just a UX feature โ€” they are a legal and ethical commitment to users.


Step 2: Understanding the Scale Problem

Surface-Level Simplicity

On paper, cookie compliance seems easy:

User visits site โ†’ Banner appears โ†’ User chooses โ†’ Site respects choice

Real-World Complexity

Dropbox operates 200+ web surfaces. Here is what makes this hard:

200+ websites
ร— Multiple languages (22 supported)
ร— Constant page changes (launches, retirements, redirects, experiments)
ร— Multiple consent methods (banners, floating controls, footer links, GPC signals)
= Thousands of potential failure points

What Can Go Wrong?

  • A page launches correctly but a later update breaks cookie behavior
  • A new integration accidentally loads non-essential cookies before consent
  • A preference is recorded but not applied after page reload
  • A new page is created but never added to compliance checks

๐Ÿ’ก Key Insight: Compliance is not a one-time setup. It requires continuous verification as systems change.


Step 3: Translating Legal Concepts Into Testable Rules

The Core Challenge

Legal language is written for humans. Machines need precise instructions.

Legal concept:

"Obtain affirmative consent before loading non-essential cookies"

Machine-testable version:

"After page load, before any user interaction, zero non-essential cookies should be present. After user clicks decline, reload page and verify only strictly necessary cookies exist."

How Dropbox Solved This

They separated policy definitions from code:

[Privacy Team]          [Engineering Team]
Defines rules     โ†’     Auditor reads rules
Updates rules     โ†’     No code change needed
Adds exceptions   โ†’     System adapts automatically

๐Ÿ’ก Key Insight: Keeping classifications outside the source code lets policy evolve independently of software releases.


Step 4: How the Cookie Auditor Works

The Tool: Playwright

Playwright is a browser automation library โ€” it controls a real browser programmatically, simulating exactly what a human visitor would experience.

Three Tests Per Page

Page URL
  โ”‚
  โ”œโ”€โ”€ Test 1: Standard US Visitor
  โ”‚     โ””โ”€โ”€ Simulate typical American user experience
  โ”‚
  โ”œโ”€โ”€ Test 2: EU Visitor
  โ”‚     โ””โ”€โ”€ Stricter consent requirements apply
  โ”‚
  โ””โ”€โ”€ Test 3: GPC Signal Active
        โ””โ”€โ”€ Browser sends automatic "do not track" preference

Each test starts with a completely fresh browser session โ€” no saved cookies, no prior preferences.

The Test Sequence (Step by Step)

Step 1: Open fresh browser session
         โ†“
Step 2: Load Dropbox page
         โ†“
Step 3: Record which cookies loaded BEFORE any interaction
         โ†“
Step 4: Check โ€” do pre-interaction cookies match expectations?
         โ†“
Step 5: Find consent controls (banner, footer, floating panel)
         โ†“
Step 6: Decline non-essential cookies
         โ†“
Step 7: Reload the page
         โ†“
Step 8: Check โ€” do post-reload cookies match expectations?
         โ†“
Step 9: Flag any unexpected cookies for review

Why Reloading Matters

Reloading tests persistence โ€” does the website actually remember and apply your choice, or does it reset?

๐Ÿ’ก Key Insight: The auditor tests what actually happens, not what the configuration says should happen. This distinction is critical.


Step 5: Solving the URL Discovery Problem

The Problem

You cannot audit pages you do not know exist. New pages are published constantly.

The Solution: A URL Detector

Think of it as an auditor for the auditor:

Cookie Auditor     โ†’ Tests: "Is consent working on this page?"
URL Detector       โ†’ Tests: "Are we checking ALL the pages we should be?"

How the URL Detector Works

Billions of traffic records
         โ†“
Step 1: Filter out duplicate URLs
         โ†“
Millions of unique paths
         โ†“
Step 2: Apply detailed filtering
    - Remove pages that don't need testing
    - Group pages sharing the same consent logic
    - Select representative samples from similar page groups
         โ†“
Manageable, representative test list

๐Ÿ’ก Key Insight: Working smarter with data โ€” filter first, then analyze โ€” dramatically reduces computing resources needed.


Step 6: The Human + Automation Partnership

Division of Labor

Automation DoesHumans Do
Visits hundreds of pagesInterpret unusual edge cases
Records cookie behaviorDefine what "correct" means
Flags potential violationsDistinguish real issues from false positives
Tracks trends over timeUpdate policy classifications
Delivers weekly reportsDecide what action to take

The Output

Teams receive a weekly report that:

  • Separates likely violations from known false positives
  • Shows historical trends (spotting when something that worked starts breaking)
  • Connects findings to responsible teams

๐Ÿ’ก Key Insight: Automation surfaces relevant information so humans can make informed decisions faster โ€” not replace human judgment entirely.


Step 7: The Broader Principle

Privacy as Infrastructure

Dropbox treats privacy like reliability or security โ€” not a checkbox, but an ongoing operational commitment.

Reliability  โ†’ Continuous monitoring of uptime
Security     โ†’ Continuous monitoring of vulnerabilities
Privacy      โ†’ Continuous monitoring of consent behavior

Lessons for Any Similar Project

If you were building this yourself, here is where the real work lives:

Browser automation itself    โ† Relatively straightforward
                                        
Defining correct behavior    โ† Hard: requires legal + technical alignment
Maintaining URL inventory    โ† Hard: requires ongoing data pipeline
Separating signal from noise โ† Hard: requires domain expertise
Building review processes    โ† Hard: requires cross-team coordination

Summary: The Complete Picture

POLICY LAYER
"What should correct behavior look like?"
(Privacy + Legal teams define rules outside the codebase)
         โ†“
DISCOVERY LAYER
"Which pages need to be tested?"
(URL Detector processes traffic data โ†’ curated test list)
         โ†“
TESTING LAYER
"Is correct behavior actually happening?"
(Playwright auditor runs 3 tests per page, simulating real users)
         โ†“
REPORTING LAYER
"What needs human attention?"
(Weekly reports, trend tracking, team routing)
         โ†“
HUMAN REVIEW
"What action should be taken?"
(Teams investigate flagged issues and update exceptions)

Quick Self-Check Questions

  1. What is the difference between strictly necessary and non-essential cookies?
  2. Why is reloading the page an important part of the audit test?
  3. Why did Dropbox keep cookie classifications outside the auditor's source code?
  4. What problem does the URL Detector solve that the Cookie Auditor alone cannot?
  5. Why is it important to test from a user experience perspective rather than checking system configuration?

More to study