Targeted Advertising Consent and Signals Orchestration Design
This design outlines a scalable, privacy-compliant system for managing user consent in targeted advertising while orchestrating user signals (e.g., behavioral, demographic, contextual data) for ad personalization. It adheres to regulations like GDPR, CCPA, ePrivacy Directive, and IAB TCF v2.2, emphasizing user control, real-time decisioning, and minimal data retention.
High-Level Architecture
The system is event-driven, microservices-based, with a central Orchestrator coordinating consent validation and signal flows. Key principles:
- Zero-Trust Consent: No signal is used without explicit, granular consent.
- Signals as Ephemeral Streams: Process signals in real-time; store only what's consented and necessary.
- Granular Controls: Support purposes (e.g., "personalization", "measurement") and vendors (e.g., Google, Criteo).
┌─────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ User/Client │ │ Consent & │ │ Ad Platforms │
│ (Browser/App) │◄──►│ Signals │◄──►│ (DSPs, SSPs) │
│ │ │ Orchestrator │ │ │
└─────────┬───────┘ └────────┬─────────┘ └────────┬─────────┘
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ CMP (UI/API) │ │ Policy Engine │ │ Signal Processor │
└─────────┬───────┘ └────────┬─────────┘ └────────┬─────────┘
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ Consent Store │ │ Audit/Revocation │ │ Signals Store │
│ (Redis + DB) │ │ Queue (Kafka) │ │ (ClickHouse) │
└─────────────────┘ └──────────────────┘ └──────────────────┘
Core Components
1. Consent Management Platform (CMP)
- Purpose: Captures, updates, and queries user consents via UI banners, APIs, or SDKs.
- Features:
- TCF v2.2 compliant JSON encoding (e.g.,
tcString with purposes 1-10, legitimate interests, vendor lists via GVL).
- Granular toggles: Legitimate Interest (LI), Special Features (e.g., precise location).
- Revocation: One-click withdraw via
purposes_consent: 0.
- Tech:
- Frontend: React CMP widget (e.g., OneTrust-inspired).
- Backend: FastAPI/GraphQL API.
- Storage: Redis (TTL-based caching, 1-24h), PostgreSQL (persistent audits).
- API Endpoints:
| Endpoint | Method | Payload | Response |
|---|
/consent/save | POST | {userId, tcString, purposes} | {status: 'saved', expiry} |
/consent/query | GET | ?userId=123 | {consents: {...}, valid: true} |
/consent/revoke | POST | {userId, purposes: [1]} | {status: 'revoked'} |
2. Signals Collection & Processor
- Purpose: Ingests raw signals from clients (e.g., page views, clicks, device info) and enriches them.
- Signal Types:
| Category | Examples | Consent Required |
|---|
| Behavioral | Scroll depth, time-on-page | Purpose 5 (measurement) |
| Demographic | Age, gender (inferred) | Purpose 3 (personalization) |
| Contextual | URL, device type | None (always allowed) |
| Location | IP/Geo, GPS | Special Purpose 2 (precise geo) |
- Processing Pipeline:
- Ingest via SDK (JavaScript/Web, iOS/Android).
- Hash PII (e.g., userId → SHA-256) for pseudonymization.
- Enrich: Add timestamps, segments (e.g., via ML models for interests).
- Tech: Kafka for streaming, Apache Flink/ Spark Streaming for processing, anonymized storage in ClickHouse.
3. Policy Engine
- Purpose: Real-time decisioning: "Can I use this signal for Vendor X?"
- Logic:
- Parse
tcString → Check purpose/vendor bits.
- LI Transparency: If no objection, allow.
- Fallback: Contextual targeting if personalized denied.
- Rules as Code: YAML policies loaded dynamically.
- Tech: OPA (Open Policy Agent) or custom Rust/Wasm for sub-ms latency.
- Decision Output:
{allow: true, purposes: [3,5], vendors: [123], ttl: 3600s}.
4. Orchestrator (Central Brain)
5. Storage & Compliance Layer
| Storage | Use Case | Retention | Compliance |
|---|
| Redis | Active consents | 24h TTL | Encrypted at-rest |
| PostgreSQL | Audit logs | 90 days | GDPR Art.17 (right to erasure) |
| ClickHouse | Aggregated signals | 7 days (consented only) | Anonymized queries |
| Kafka | Revocation queue | 7 days | Dead-letter for failures |
Data Flows
-
Consent Capture:
- Browser loads → CMP checks
localStorage/__cmp → If stale, prompt → POST to /consent/save.
-
Signal Orchestration for Ad Request:
Ad Auction Trigger:
1. Client SDK: Emit {event: 'view', signals: [...], userId}
2. Orchestrator: GET /consent/query → Policy Check
3. If OK: Process → Output {bidRequest: {userSegments: ['sports'], targeting: {...}}}
4. Ad Platform receives → Serves targeted ad
5. Postback: Measure conversion → Loop back if consented
-
Revocation Handling:
- User revokes → Kafka topic → Propagate to all downstream (invalidate caches, purge signals).
Security & Performance
- Security: mTLS between services, OWASP Top-10 mitigations, differential privacy for signals.
- Performance: <50ms p99 latency (Redis + Wasm policy).
- Monitoring: Prometheus + Grafana; alerts on consent rejection >10%.
- Testing: Contract tests for TCF, chaos engineering for revocation floods.
Implementation Roadmap
- MVP (4 weeks): CMP + basic Orchestrator (Node.js + Redis).
- Phase 2 (8 weeks): Policy Engine + Kafka streaming.
- Phase 3 (12 weeks): ML enrichment, multi-region (EU/US silos).
This design enables 100% compliant targeted ads with full user control. For prototypes or customizations (e.g., specific ad tech stack), provide more details!