defaultConsent
defaultConsent属性确定在调用setConsent命令之前如何处理数据收集同意。 当您不希望意外从居住在数据收集之前需要获得同意的区域中的个人收集数据时,此属性很有价值。
如果您的访客不属于《通用数据保护条例》(GDPR)的管辖范围,则默认同意可以设置为in。 GDPR管辖区内的访客可以将默认同意设置为pending。 您的同意管理平台(CMP)可以检测客户的区域,并向IAB TCF 2.0提供标记gdprApplies。此标记可用于设置默认同意。
运行defaultConsent命令时,将configure字符串属性设置为所需的同意级别。 此属性区分大小写,并且仅支持以下三个值: "in"、"out"和"pending"。 如果尝试使用任何其他值,则库会引发错误。 如果未在configure命令中进行设置,则默认值为in。
defaultConsent值在页面加载之间不持久。 确保每次调用configure命令时都设置所需的默认同意。alloy("configure", {
datastreamId: "ebebf826-a01f-4458-8cec-ef61de241c93",
orgId: "ADB3LETTERSANDNUMBERS@AdobeOrg",
defaultConsent: "pending"
});
in:数据收集正常运行,直到用户选择退出为止。out:数据将永久丢弃,直到用户选择加入为止。pending:数据存储在本地,直到用户使用setConsent命令选择加入为止。
将defaultConsent与setConsent一起使用 using-consent
Web SDK提供了两个互补的同意选项:
defaultConsent(此页面):确定默认同意首选项。setConsent:捕获访客的同意首选项。
如果同时使用这些设置,则可能会导致数据收集和Cookie设置结果有所不同,具体取决于其配置的值。
请参阅下表,根据同意设置了解何时进行数据收集以及何时设置Cookie。
defaultConsentsetConsentinininoutinpendinginpendingoutpendingoutinoutoutout有关库设置的Cookie列表,请参阅Adobe Experience Platform Web SDK Cookie。
基于gdprApplies设置默认同意
某些CMP提供了确定《通用数据保护条例》(GDPR)是否适用于客户的能力。 如果您希望客户同意不适用GDPR的情况,则可以在TCF API调用中使用gdprApplies标记。 例如:
var alloyConfiguration = { ... };
window.__tcfapi('getTCData', 2, function (tcData, success) {
if (success) {
alloyConfiguration.defaultConsent = tcData.gdprApplies ? "pending" : "in";
window.alloy("configure", alloyConfiguration);
}
});
在上述代码块中,在从TCF API获取configure之后调用tcData命令。 如果gdprApplies为true,则默认同意设置为pending。 如果gdprApplies为false,则默认同意设置为in。 请确保使用您的配置填写alloyConfiguration变量。
使用Web SDK标记扩展的默认同意
请参阅Web SDK标记扩展文档中的同意设置,了解如何使用标记执行这些操作。