首页 > 解决方案 > AMP 的 Cookie 通知,使用 amp-geo 和 amd-consent

问题描述

我以为这很简单。在页面底部显示“我们使用 cookie”警告并带有关闭按钮。

我们的要求很简单,至少向大家展示一次。带有隐私政策链接的直接副本。没有 cookie 阻塞,简单。

那么有没有人有一个类似于我可以用作基线的示例运行?我正在查看 BBC 的 amp 页面,但它们仅针对欧盟国家/地区显示,我正在为每个人显示此内容。

干杯!

标签: amp-html

解决方案


如果您只是想直接运行“我们使用 cookie”通知而没有花哨的装饰,那么amp-user-notification可能是适合您的路线。我们在我们的网站上运行它:https ://www.craigattachments.com 。

amp-user-notification如果出现该要求,它也确实具有进行地理定位的能力。

https://amp.dev/documentation/components/amp-user-notification

标题脚本:

<script async custom-element="amp-user-notification" src="https://cdn.ampproject.org/v0/amp-user-notification-0.1.js"></script>

通知代码:

<amp-user-notification
    layout="nodisplay"
    id="amp-user-notification1"
    data-show-if-href="https://foo.com/api/show-api?timestamp=TIMESTAMP"
    data-dismiss-href="https://foo.com/api/dismissed">
    This site uses cookies to personalize content.
    <a href="">Learn more.</a>
   <button on="tap:amp-user-notification1.dismiss">I accept</button>
</amp-user-notification>

推荐阅读