Prebid 与 UniConsent CMP 集成

UniConsent CMP 提供与 Prebid 同意管理模块的内置集成,包括 IAB TCF、GPP 和 CCPA。

启用并包含以下 Prebid 模块:

  • consentManagement
  • consentManagementUsp
  • consentManagementGpp

在 Prebid 中配置 CMP 相关设置:

pbjs.setConfig({
  gdpr: {
    cmpApi: "iab",
    timeout: 3000,
    allowAuctionWithoutConsent: false,
  },
  usp: {
    cmpApi: "iab",
    timeout: 500,
  },
  gpp: {
    cmpApi: "iab",
    timeout: 3000,
  },
});

等待 IAB TCF 同意信号

export default class UniConsentCMP {
  static cmpReady(next) {
    return new Promise((resolve, reject) => {
      window.__tcfapi &&
        window.__tcfapi("addEventListener", 2, function (tcData, success) {
          if (tcData && !tcData.gdprApplies) {
            resolve(next);
          }
          if (
            (tcData && tcData.eventStatus === "tcloaded") ||
            tcData.eventStatus === "useractioncomplete"
          ) {
            resolve(next);
          }
        });
    });
  }
}

await UniConsentCMP.cmpReady();

还有其他问题?

联系我们:support@uniconsent.com