如何在amp-story-consent的帮助下建立AMP cookie同意?

问题描述 投票:0回答:1

我想向我的AMP静态网站添加cookie同意。我想利用amp-story-consent可以提供给我的模态对话框。我研究了各种示例,也许最完整的示例是:

[https://playground.amp.dev/?url=https%3A%2F%2Fpreview.amp.dev%2Fdocumentation%2Fexamples%2Fuser-consent%2Fstory_user_consent&format=websites(示例文档https://amp.dev/documentation/examples/user-consent/story_user_consent/?referrer=ampbyexample.com)] >>

我的问题是我只想显示JSON代码段中定义的标题/消息/供应商

    <amp-story-consent id="consentUI" layout="nodisplay">
      <script type="application/json">
        {
          "title": "Headline",
          "message": "This is some more information about this choice. Here's a list of items related to this choice.",
          "vendors": ["Item 1", "Item 2", "Item 3", "Item 4", "Item 5", "Item 6", "Item 7", "Item 8", "Item 9", "Item 10"]
        }
      </script>
    </amp-story-consent>

加上接受和拒绝按钮。经过Cookie同意,我实际上并没有任何故事页面

或任何故事书夹,但是AMP验证规则似乎要求它。那是一个问题。操场上显示了“拒绝/接受”按钮对,我想要“拒绝/接受”对,但是我看不到可以在哪里定义。

在简单的amp-consent文档中有按钮(请参见https://amp.dev/documentation/components/amp-consent/处的“同意配置”:]

<div id="consent-ui">
  <button on="tap:consent-element.accept" role="button">Accept</button>
  <button on="tap:consent-element.reject" role="button">Reject</button>
  <button on="tap:consent-element.dismiss" role="button">Dismiss</button>
</div>

有人有例子或指导吗?


请注意,https://amp.dev/documentation/components/amp-consent/具有此示例代码段。它显示为“示例:在AMP故事上显示提示用户界面”

<amp-consent layout="nodisplay" id="consent-element">
  <script type="application/json">
    {
      "consents": {
        "my-consent": {
          "checkConsentHref": "https://amp.dev/documentation/examples/api/get-consent",
          "promptUI": "consent-ui"
        }
      }
    }
  </script>
  <amp-story-consent id="consent-ui" layout="nodisplay">
    <script type="application/json">
      {
        “title”: "My title",
        “message”: "My example message.",
        “vendors”: ["Item 1", "Item 2", "Item 3", "Item 4"]
      }
    </script>
  </amp-story-consent>
</amp-consent>

如何使它正常工作? (正如我提到的,我也没有如代码段所示的任何故事页面

或任何故事书挡。]]

我想向我的AMP静态网站添加cookie同意。我想利用amp-story-conent可以提供给我的模态对话框。我研究了各种示例,也许是最多的...

amp-html cookieconsent gdprconsentform ccpa
1个回答
0
投票

您不能在必须包含一定数量amp-story-consent元素的amp-story之外使用amp-story-page。>>

© www.soinside.com 2019 - 2024. All rights reserved.