Compliant with GDPR, CCPA, COPPA, LGPD, PECR, PDPA, PIPEDA, and more.
Microsoft Clarity 是一款免费的行为分析工具,通过热图和会话录制帮助您了解用户如何与您的网站互动。Clarity Consent Mode 允许您根据用户的个人同意偏好调整 Clarity 的行为,确保符合 GDPR 等数据保护法规。
在收到有效的同意信号之前,Clarity 不会设置 Cookie。当用户授予同意时,Clarity 会设置第一方和第三方 Cookie 以跨会话跟踪用户。当未收到同意时,Clarity 以无 Cookie 模式运行,功能受限。
重要提示: 自 2025 年 10 月 31 日起,Clarity 对来自欧洲经济区(EEA)、英国(UK)和瑞士(CH)的页面访问强制执行同意信号要求。对于来自这些地区的用户,必须提供有效的同意信号才能完整使用 Clarity 的各项功能。对于这些用户,Consent Mode 默认处于启用状态。
Clarity Consent Mode 使用两种相互独立的同意类型:
| 权限 | 数据用途 |
|---|---|
| analytics_Storage | 与分析相关的数据(用户行为、使用情况和交互模式)。 |
| ad_Storage | 与广告相关的数据(再营销、转化和广告活动效果)。 |
每个权限均可设置为 granted 或 denied。这两个权限相互独立,Clarity 在同意值的任意组合下都能正常运行。
ad_Storage 和 analytics_Storage 这两个键区分大小写。可接受的值为小写的 granted 或 denied。
仅当授予相应权限时,才会写入以下 Cookie:
| analytics_Storage=granted | ad_Storage=granted |
|---|---|
_clck(第一方) | MUID |
_clsk(第一方) |
要将 Microsoft Clarity 与 UniConsent CMP 集成,请按照以下步骤确保符合用户的同意偏好:
在 Clarity 仪表板中选择项目,进入 Settings → Setup,然后关闭默认设置 Cookie 的选项。这样可确保 Clarity 在设置任何 Cookie 之前先等待有效的同意信号。(对于来自 EEA、英国和瑞士的流量,Consent Mode 已默认启用。)
无论同意状态如何,都应在页面加载过程中尽早加载 Clarity 脚本。Clarity 在所有 Consent Mode 配置下都能正常运行,并会根据其收到的同意信号自动调整行为。
我们建议将同意脚本放在 <head> 标签中,以便默认设置 Consent Mode,并在用户更改其同意设置时进行更新。在 Clarity 脚本尚未加载时,调用会被加入队列。
// Clarity tag is added here
// You can set default consent mode right after the Clarity tag
<script>
window.clarity = window.clarity || function () {
(window.clarity.q = window.clarity.q || []).push(arguments);
};
window.clarity('consentv2', {
'ad_Storage': 'denied',
'analytics_Storage': 'denied'
});
</script>
UniConsent CMP 使用 Consent API V2(consentv2)自动向 Microsoft Clarity 发送同意信号,确保符合用户的隐私偏好。它将分析或统计目的映射到 analytics_Storage,将营销或广告目的映射到 ad_Storage,并在用户接受、拒绝或进行精细化选择时更新 Clarity 的同意状态。
要确认同意信号已正确传递,请打开浏览器开发者工具,进入 Console(控制台) 选项卡,然后运行:
clarity('metadata', (d, upgrade, consent) => {
console.log('consentStatus:', consent);
}, false, true, true);
在用户接受 Cookie 之前,您应该看到两个权限均为拒绝状态:
{
analytics_storage: "DENIED",
ad_storage: "DENIED"
}
在用户于 UniConsent CMP 横幅中接受后,这些值会相应更新(例如,两者均为 "GRANTED")。您还可以确认在同意被拒绝期间不会写入 _clck 或 _clsk Cookie。