【问题标题】:amp-consent and IAB consent string implementation detailsamp-consent 和 IAB 同意字符串实施详细信息
【发布时间】:2021-01-07 00:14:18
【问题描述】:

我们已经根据 IAB TCFv2 完成了 CMP 的开发,并且正在努力将其与 AMP 集成,因为 amp-consent 不会使同意字符串可用于 CMP 提示和广告。

发布者代码:

<amp-consent id="myUserConsent" layout="nodisplay">
<script type="application/json">{
    "consentInstanceId": "consent-id",
    "consentRequired": true,
    "promptUI": "consentDialog",
    "postPromptUI": "post-consent-ui",
    "checkConsentHref": "https://open-cmp.local:5003/consent/check",
    "onUpdateHref": "https://open-cmp.local:5003/consent/update"
}</script>
<div class="popupOverlay" id="consentDialog">
    <amp-iframe layout="fill" src="https://open-cmp.local:5003/demo/amp/cmp-frame.html"
                sandbox="allow-scripts allow-same-origin">
        <div placeholder>Loading</div>
    </amp-iframe>
</div>
<div id="post-consent-ui">
    <button on="tap:myUserConsent.prompt()">Update Consent</button>
</div>

Iframe 正在根据用户的设置发回同意字符串:

window.parent.postMessage({
        type: 'consent-response',
        info: "the consent string",
        action: 'accept'
    }, '*');

根据AMP documentation,当用户想要进行更改时,同意字符串可用于 amp-ad 和 CMP 提示:

传递给 iframe 的客户端信息 创建 iframe 时,会通过 name 属性将以下信息传递给 iframe。

window.name 始终设置为包含 iframe 名称的纯字符串,即 amp_iframe0,没有类似 JSON 的数据。我还尝试了 window.context,它总是 undefined

第二个挑战是,如何确保同意字符串在 amp-ad 和其他组件中可用?我尝试了 amp-iframe,但没有同意字符串。

网络上的所有文章、讨论和文档都有点混乱/过时/不一致,如果有人能指出我正确的方向,我真的很感激。

【问题讨论】:

    标签: amp-html amp-ad iab


    【解决方案1】:

    不知道这是否仍处于打开状态,但在 AMP 上,amp-ad 将获得一个托管在 ampproject.net 上的 iframe。

    正如您在此处看到的,AMP 使用“名称”内部的 JSON 提要来传输 amp-ad 标记的这些数据:

    只要属性“data-block-on-consent”和 cmp 中有一个 amp-ad,此 iframe 的 window.context 就会具有 tcf 字符串的属性,即“initialConsentValue”

    但我想在 github 上向您指出这个问题: https://github.com/ampproject/amphtml/issues/30385

    在此范围内,您应该能够像在常规 Web 中一样提供 _tcfapilocator 框架,希望我作为消费者希望以这种方式使用它,因为这将是 IAB 指定的方式...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多