Course contentsShow
← System Design
Lesson 1728 of 1,91941. Real-World System: Notification SystemFree lesson

Opt-Out and Compliance Tracking

Maintain audit logs of preference changes and ensure GDPR/CAN-SPAM compliance with unsubscribe tracking.

Opt-Out and Compliance Tracking

What you'll learn: How to build audit trails and compliance mechanisms that respect user opt-outs and satisfy legal requirements like GDPR and CAN-SPAM.

The Core Idea

When users unsubscribe from notifications, you need more than just flipping a flag—you must prove you honored that choice. Regulations like GDPR (Europe) and CAN-SPAM (US) require verifiable records showing when users opted out, what they opted out of, and that you stopped messaging them accordingly.

Think of it like a library checkout system: it's not enough to return a book; the library needs a timestamped record proving you returned it, in case questions arise later.

Why This Matters

Without proper tracking:

  • You risk heavy fines (GDPR violations can cost 4% of annual revenue)
  • You can't prove compliance during audits
  • Users may receive unwanted messages even after opting out
  • You lose trust and damage your reputation

Implementation Essentials

Audit log requirements:

  • Capture every preference change with user_id, timestamp, change_type (opt-in/opt-out), channel, and ip_address
  • Store the change source (user action, admin override, automated)
  • Make logs immutable and append-only

Compliance features:

  • Honor opt-outs within 10 business days (CAN-SPAM requirement)
  • Provide clear unsubscribe mechanisms in every applicable notification
  • Allow granular opt-outs by channel and notification type
  • Include "right to be forgotten" workflows (GDPR Article 17)
  • Generate compliance reports showing opt-out rates and enforcement timing

Integration with notification processing: Before sending, check the preference store AND the audit log to ensure no recent opt-out exists that hasn't fully propagated yet (eventual consistency concern).

Key Takeaway: Compliance tracking transforms user preferences into legally defensible audit trails—every opt-out must be recorded, timestamped, and provably honored across all notification channels.