用户同意偏好中心构建
consent-pref-center
用于构建多用途用户同意偏好中心的技术架构指南。涵盖按用途细分粒度、依据第 7(3) 条实现便捷撤回、版本历史、审计追踪,以及 IAB Transparency and Consent Framework v2.2 集成。包含数据库模式、API 设计和 UI 组件规范。
- License 许可
- Apache-2.0
- 最近更新
- 2026-03-17
- Stars
- ★ 338
- Forks
- 68
01 前言 Front Matter
- name
- consent-pref-center
- license
- Apache-2.0
- metadata
- { "tags": "consent-preference-center, tcf-v2, consent-management, audit-trail, consent-ui", "author": "mukul975", "domain": "privacy", "version": "1.0", "subdomain": "consent-management" }
- description
- Technical architecture guide for building a multi-purpose consent preference center. Covers per-purpose granularity, easy withdrawal under Article 7(3), version history, audit trails, and IAB Transparency and Consent Framework v2.2 integration. Includes database schema, API design, and UI component specifications.
02 资源文件 4
- 资产文件assets/template.md3.7 KB
- 参考文档references/standards.md3.7 KB
- 参考文档references/workflows.md6.2 KB
- 脚本scripts/process.py12.8 KB
03 SKILL.md 正文
Building a Consent Preference Center
Overview
A consent preference center is the centralized interface through which data subjects manage their consent choices across all processing purposes. Under GDPR Article 7(3), withdrawal of consent must be as easy as giving it, making a well-designed preference center critical for compliance. The IAB Europe Transparency and Consent Framework (TCF) v2.2 provides a standardized approach for advertising-related consent that integrates with this architecture.
Architecture Components
1. Data Model
The consent preference center requires four core data entities:
Consent Purpose Registry Stores all processing purposes for which consent is the lawful basis.
| Field | Type | Description |
|---|---|---|
| purpose_id | UUID | Unique identifier for the processing purpose |
| purpose_name | VARCHAR(256) | Human-readable purpose name |
| purpose_description | TEXT | Plain-language description (Flesch-Kincaid grade 8 or below) |
| legal_basis | ENUM | "consent" or "explicit_consent" |
| data_categories | JSONB | Array of personal data categories processed |
| recipients | JSONB | Array of named third-party recipients |
| retention_period | VARCHAR(128) | Data retention period for this purpose |
| tcf_purpose_id | INTEGER | Mapped IAB TCF v2.2 purpose ID (1-11) if applicable |
| is_active | BOOLEAN | Whether this purpose is currently offered |
| created_at | TIMESTAMP | When the purpose was registered |
| updated_at | TIMESTAMP | Last modification timestamp |
Consent Text Version Immutable records of consent text presented to users.
| Field | Type | Description |
|---|---|---|
| version_id | UUID | Unique version identifier |
| purpose_id | UUID | FK to purpose registry |
| consent_text | TEXT | Exact text displayed to the user |
| text_hash | CHAR(64) | SHA-256 hash of consent_text |
| effective_from | TIMESTAMP | When this version went live |
| effective_until | TIMESTAMP | When this version was superseded (NULL if current) |
| approved_by | VARCHAR(256) | Name of DPO or legal reviewer who approved |
Consent Decision Records each consent decision made by a data subject.
| Field | Type | Description |
|---|---|---|
| decision_id | UUID | Unique decision identifier |
| subject_id | UUID | Data subject identifier |
| purpose_id | UUID | FK to purpose registry |
| version_id | UUID | FK to consent text version shown |
| decision | ENUM | "granted" or "withdrawn" |
| mechanism | VARCHAR(64) | "checkbox_tick", "toggle_switch", "api_call" |
| timestamp | TIMESTAMP | ISO 8601 UTC timestamp |
| ip_address | INET | IP address at time of decision |
| user_agent | TEXT | Browser user agent string |
| source | VARCHAR(64) | "signup_flow", "preference_center", "cookie_banner", "api" |
Consent Propagation Log Tracks downstream system notifications after consent changes.
| Field | Type | Description |
|---|---|---|
| propagation_id | UUID | Unique propagation event ID |
| decision_id | UUID | FK to consent decision that triggered this |
| target_system | VARCHAR(256) | Name of downstream system notified |
| status | ENUM | "pending", "delivered", "acknowledged", "failed" |
| sent_at | TIMESTAMP | When notification was dispatched |
| acknowledged_at | TIMESTAMP | When downstream system confirmed receipt |
2. API Design
GET /api/v1/consent/preferences/{subject_id} Returns current consent state for all purposes for a given data subject.
Response:
{
"subject_id": "usr_7f3a9b2e-41d8-4c76-b5e3-9a8d1c2f4e60",
"preferences": [
{
"purpose_id": "pur_analytics_001",
"purpose_name": "Service Improvement Analytics",
"decision": "granted",
"granted_at": "2026-01-15T10:30:00Z",
"version_id": "ver_a1b2c3d4"
},
{
"purpose_id": "pur_marketing_002",
"purpose_name": "Product Update Emails",
"decision": "withdrawn",
"withdrawn_at": "2026-02-20T14:45:00Z",
"version_id": "ver_e5f6g7h8"
}
],
"last_updated": "2026-02-20T14:45:00Z"
}
PUT /api/v1/consent/preferences/{subject_id} Updates consent for one or more purposes. Triggers downstream propagation.
Request:
{
"decisions": [
{
"purpose_id": "pur_marketing_002",
"decision": "granted",
"mechanism": "toggle_switch"
}
]
}
GET /api/v1/consent/history/{subject_id} Returns full consent history for audit purposes per Article 7(1).
GET /api/v1/consent/receipt/{decision_id} Returns a single consent receipt in Kantara Initiative Consent Receipt format.
3. TCF v2.2 Integration
The IAB Transparency and Consent Framework v2.2 (released September 2023) requires:
- TC String Generation: Encode consent signals into the IAB TC String format. The TC String is a base64url-encoded bitfield that captures consent for TCF-defined purposes (1-11) and legitimate interest assertions.
- CMP Registration: Register with the IAB Europe as a Consent Management Platform. Each registered CMP receives a unique CMP ID used in TC String generation.
- Vendor List Integration: Consume the IAB Global Vendor List (GVL) to display vendor-level consent options. The GVL is published at vendorlist.consensu.org and updated weekly.
- Purpose Mapping: Map internal CloudVault SaaS Inc. purposes to TCF v2.2 purposes:
- TCF Purpose 1 (Store and/or access information on a device) → Cookie consent
- TCF Purpose 3 (Create profiles for personalised advertising) → If applicable
- TCF Purpose 7 (Measure ad performance) → Analytics consent
- Publisher Restrictions: Configure publisher-level restrictions to limit vendors to consent-only legal basis where CloudVault SaaS Inc. policy requires it.
4. UI Component Specification
The preference center interface at CloudVault SaaS Inc. follows these design principles:
Layout:
- Accessible at Settings > Privacy > Manage Consent (maximum 2 clicks from any page)
- Also accessible via direct URL: app.cloudvault-saas.eu/settings/privacy
- Persistent "Privacy Choices" link in the page footer on every page
Per-Purpose Toggle:
- Each purpose displays: purpose name, 1-sentence description, current state (on/off toggle)
- "Learn More" expandable section with: full description, data categories, recipients, retention period
- Toggle change triggers immediate API call and visual confirmation
Consent History:
- "View History" link per purpose showing: date, action (granted/withdrawn), consent text version
- Downloadable consent receipt in JSON format (Kantara Consent Receipt specification v1.1)
Withdrawal Flow:
- Single toggle click to withdraw (matching the single click to grant during sign-up)
- Confirmation dialog: "Are you sure you want to withdraw consent for [purpose]? This will stop [specific processing]. You can re-enable this at any time."
- Post-withdrawal confirmation: "Consent withdrawn. Processing will stop within 24 hours."
Version History and Audit Trail
Every consent text change creates a new version record. The preference center always displays the current version but retains all historical versions. Audit queries can reconstruct:
- What text was shown to a specific user at a specific time
- When consent was given and withdrawn for each purpose
- Whether downstream systems were notified of consent changes
- The propagation status and timing for each consent change
Key Regulatory References
- GDPR Article 7(1) — Demonstrating consent
- GDPR Article 7(3) — Right to withdraw consent, equal ease requirement
- GDPR Article 12(1) — Transparent, intelligible, easily accessible information
- IAB TCF v2.2 Specification (September 2023) — TC String encoding, CMP requirements
- Kantara Initiative Consent Receipt Specification v1.1 — Standard consent receipt format
- EDPB Guidelines 05/2020 — Consent under Regulation 2016/679
04 同仓库更多 Skills
职场邮件监控合规
workplace-email-privacy
依据 Barbulescu 诉罗马尼亚案(欧洲人权法院大法庭)、EDPB 指引及各国劳动法,实施工作场所电子邮件与互联网监控合规。涵盖可接受使用政策、合理的隐私期待、比例原则测试以及内容监控与元数据监控的区别。关键词:邮件监控、Barbulescu、职场隐私、互联网监控、可接受使用政策、ECHR、比例原则。
举报人数据保护合规
whistleblower-data
依据欧盟指令 2019/1937 和 GDPR,为举报(吹哨)系统实施数据保护合规。涵盖匿名举报渠道、举报人与被指控人的身份保护、保存期限限制、访问限制以及反报复措施。涉及成员国转化立法与数据保护机构(DPA)指引。关键词:举报人、指令 2019/1937、匿名举报、身份保护、报复、保存期限、举报渠道。
供应商终止数据返还与删除
vendor-termination-data
依据 GDPR 第 28(3)(g) 条的供应商终止数据返还与删除流程。涵盖数据提取格式、删除证明要求、过渡规划、残留数据处理以及终止后核验。
供应商隐私风险评分
vendor-risk-scoring
面向数据处理者管理的供应商隐私风险分级方法论。涵盖数据量、敏感度、传输地点、认证情况、泄露历史和控制成熟度等评分要素,通过加权风险计算进行风险分级与等级划分。
供应商隐私尽职调查
vendor-privacy-due-diligence
依据 GDPR 第 28(1) 条的签约前供应商隐私尽职调查。涵盖风险问卷、技术控制评估、认证审查、数据流分析以及针对处理者合作的书面充分性决策。
供应商隐私合规审计
vendor-privacy-audit
依据 GDPR 第 28(3)(h) 条进行现场和远程供应商审计程序。涵盖审计计划、证据收集方法、问题发现分类、整改跟踪以及用于处理者合规验证的审计报告生成。