consent-mode
它能做什么
这项技能检查 Google 代码是否会根据每位访客同意的内容,发送正确的同意信号。适合使用 Google 分析或广告、并必须遵守 GDPR 等隐私规则的网站所有者。
适用场景
- ✓当你的网站在有隐私法律的地区使用 Google 分析或广告代码时。
- ✓当你需要把代码更新为 Consent Mode v2 的设置时。
- ✓当你想确认同意状态被正确发送时。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/consent-mode/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请在我的网站上设置 Google Consent Mode v2,使广告和分析代码遵循访客选择的 Cookie。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会更新代码设置,使其发送广告用户数据和广告个性化的同意状态,并检查发往 Google 的请求中是否出现 consent 参数。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Implement Google Consent Mode v2
Consent Mode v2 is essential for adhering to privacy regulations (like GDPR) while maintaining the ability to measure conversion and analytics data in a privacy-safe way.
Quick Reference
- Adjust tag behavior based on user consent for privacy compliance
- Maintain data insights through modeling for non-consenting users
- Ensure the
gcdparameter is present in pings to Google services
Check
Verify that Google Consent Mode v2 is correctly implemented and sending the appropriate consent states.
Fix
Update your GTM or gtag.js implementation to support the new ad_user_data and ad_personalization consent types.
Explain
Explain the transition to Consent Mode v2 and why it's required for digital advertising in certain regions.
Code Review
Review the routes, assets, and loading behavior that affect Implement Google Consent Mode v2. Flag exact files, requests, or rendering steps that add unnecessary network, CPU, or layout cost, and describe the measurement method used to confirm the issue.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/performance/consent-mode
常见问题
为什么 Consent Mode 很重要?
这项技能说明,它帮助遵守 GDPR 等隐私规则,同时仍允许保护隐私的衡量。
新的同意类型有哪些?
这项技能列出了广告用户数据(ad user data)和广告个性化(ad personalization)。
如何检查它是否生效?
这项技能说明,发往 Google 服务的请求中应包含 gcd 参数。
详情
作者的原始描述
Use when auditing slow page loads, heavy assets, or rendering delays related to Implement Google Consent Mode v2. Verify the actual bottleneck in DevTools, Lighthouse, or field data before recommending changes.
热度
- GitHub 星标
- 75k
- 排名
- #2778
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。