Cookie consent for the rest of us.
A lightweight, self-hosted widget that logs consent decisions directly to your own Cloudflare D1 database. No SaaS fees, no complex dashboards. 1-click deploy.
Zero SaaS Fees: Hosted entirely on your own infrastructure.
Auto-Blocking: Blocks scripts until consent is granted.
Own Your Data: Audit trails live in your Cloudflare instance.
Live Tracker Status (Interactive)
This page has two tracking scripts injected. Notice how they are blocked until you interact with the real consent banner at the bottom of the screen.
Analytics Script
data-consent-category="analytics"
Marketing Pixel
data-consent-category="marketing"
Change preferences at any time:
Want to reset everything?
Documentation
1. Add the Script Tag
Place the following script tag in the <head> of your HTML, before any other scripts. Replace the data-api-url with your deployed Cloudflare Worker URL.
2. Tag Your Trackers
To ensure the widget blocks non-essential cookies, you must add the data-consent-category attribute to your tracking scripts. The enforcer will automatically prevent them from executing until consent is granted.
Cloudflare Worker Setup
1 1-Click Deploy (Public Repos)
If your repository is public on GitHub, you can deploy it directly via Cloudflare's web dashboard.
Free forever on Cloudflare's free tier.2 CLI Deployment (Private Repos)
Since your repository is private, deploy securely using the Wrangler CLI:
- # 1. Login to Cloudflare
npx wrangler login - # 2. Create the D1 Database
npx wrangler d1 create galletas4all-db - # 3. Create the Database tables
npx wrangler d1 execute galletas4all-db --file=./worker/schema.sql - # 4. Deploy the Worker
npx wrangler deploy
Alternative Logging Options
Local-Only (No Backend)
Run the widget completely client-side. Consent is managed locally in the visitor's browser.
Google Sheets Logging
Log consents into a free Google Sheet using a simple Apps Script:
Show Google Apps Script Code
function doPost(e) {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var data = JSON.parse(e.postData.contents);
sheet.appendRow([
new Date(),
data.visitorId,
data.accepted,
JSON.stringify(data.acceptedCategories),
JSON.stringify(data.rejectedCategories),
data.url,
data.referrer,
data.language
]);
return ContentService.createTextOutput(JSON.stringify({success:true}))
.setMimeType(ContentService.MimeType.JSON);
}
Publish as a Web App (access: "Anyone") and use the URL in data-api-url.
About Felipe Millán
Felipe is a Growth Operator, GTM Strategist, and community builder with 15+ years of experience leading marketing, GTM, PLG, and community-driven growth across 5 continents, including SendGrid and Semrush IPOs.
Visit Website