Privacy-First Web Analytics: ClickHouse, Redis Buffers, and Sub-1KB Tracking
How to build a GDPR-compliant, cookie-free web analytics platform using ClickHouse for high-volume OLAP queries, Redis write buffers, and a sub-1KB tracking script.
Privacy-First Web Analytics: ClickHouse, Redis Buffers, and Sub-1KB Tracking
Google Analytics loads 45KB of JavaScript and uses cookies. PagePulse tracks everything you need in under 1KB with zero cookies.
1. The 800-Byte Tracking Script
Our tracking snippet collects page URL, referrer, viewport, and country (from IP) without any cookies or local storage:
javascript(function() { const data = { url: location.href, ref: document.referrer, sw: screen.width }; navigator.sendBeacon('/api/collect', JSON.stringify(data)); })();
2. Redis Write Buffer
Incoming events are buffered in Redis lists and flushed to ClickHouse every 5 seconds in batches, preventing write amplification under high traffic.
3. ClickHouse OLAP Queries
ClickHouse processes billions of rows in milliseconds. Dashboard queries like "top pages this week by country" return in under 50ms even with millions of events.
Summary
Cookie-free tracking + columnar OLAP storage creates an analytics platform that is both privacy-compliant and blazing fast at any scale.