欧盟用户意见征求设置(SetConsent)
AndroidiOS
如果您使用的是 Unity 引擎,请参见 Unity SDK 的 SetConsent。
设置欧盟用户意见征求的同意情况。在 app 启动后调用 SetConsent,更新用户同意情况。
每次 app 启动会重置用户同意状态,如果需要更新用户同意情况需要每次 app 启动调用 SetConsent 方法。
用户同意情况会同步至 ANALYTICS_CONSENT_CHANNEL 中配置的渠道,支持 Firebase、AppsFlyer、Adjust。详细配置请参见 欧盟用户广告隐私功能。
函数定义
UFUNCTION(BlueprintCallable, Category = "INTLSDKAPI")
static void SetConsent(FINTLConsentStatus status, const FString types="", const FString specificChannel="", bool isDMA=false);
入参说明
| 参数 | 类型 | 说明 | 备注 |
|---|---|---|---|
| status | FINTLConsentStatus | 用户同意状态 | 必填 |
| types | string | 用户同意的权限类型(多个用英文逗号 ',' 分割) | 选填,为空时使用 INTLConfig.ini 中 ANALYTICS_CONSENT_REQUIRED_TYPE 的值 |
| specificChannel | string | 需要特殊设置的 UA 渠道 | 选填,为空时使用 INTLConfig.ini 中 ANALYTICS_CONSENT_CHANNEL 的值 |
| isDMA | bool | 用户是否为 DMA 适用(EEA 地区)用户 | 选填,默认 false。AppsFlyer 与 Adjust 使用该值,Firebase 不使用。每次调用都会覆盖 SDK 根据 IP 预判断的结果,EEA 用户需传入 true支持于:Player Network SDK 1.32.01 |
用户同意状态(FINTLConsentStatus)
| 类型 | 说明 |
|---|---|
| kConsentStatusDenied | 用户不同意 |
| kConsentStatusGranted | 用户已同意 |
代码示例
// 非 EEA 用户
UINTLSDKAPI::SetConsent(kConsentStatusGranted);
// EEA 用户拒绝(同步至 AppsFlyer、Adjust 时需传入 isDMA)
UINTLSDKAPI::SetConsent(kConsentStatusDenied, "", "", true);