为 AMP 网页设置意见征求模式
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
AMP 分析代码中针对意见征求模式参数的自定义选项有限。AMP 提供了内置的意见征求管理功能,例如在征得用户意见之前延迟 Google Analytics 代码的加载,如在 AMP 网页上显示欧洲法规消息和 amp-consent 中所详述。
AMP 网页的意见征求管理设置
您可以配置以下意见征求管理设置:
指定哪些 Google 服务可以接收经用户同意收集的数据
默认情况下,对于所有 Google 服务,如果用户同意出于广告目的向 Google 发送用户数据,则视为同意。您可以通过指定哪些 Google 服务能接收标有用户同意情况的数据来覆盖此设置。
通过提供 dma_cps
列表,使用标准 amp-analytics
标记:
"vars": {
"clientId": "CLIENT_ID(custom_cookie)",
"gtag_id": "UA-1234-5",
"dma_cps": "ads,maps,playstore,search,shopping,youtube",
"config": {
"AW-2222": {...},
"G-12345678": {...}
}
}
使用 Google 跟踪代码管理器:
<!-- Google Tag Manager -->
<amp-analytics
config="https://www.googletagmanager.com/amp.json?id=GTM-WC8J58F>m.url=SOURCE_URL&dma_cps=ads%2Cmaps%2Cplaystore%2Csearch%2Cshopping%2Cyoutube"
data-credentials="include"></amp-analytics>
使用您的 amp-analytics
标记
默认情况下,对于欧洲经济区 (EEA) 内的用户,ad_personalization
意见征求为拒绝。您可以使用 amp-analytics
代码替换广告个性化设置:
<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
<amp-analytics type="gtag" data-credentials="include">
<script type="application/json">
{
"vars" : {
"gtag_id": "<DESTINATION_ID>",
"config" : {
"<DESTINATION_ID>": {
"groups": "default",
"allow_ad_personalization_signals": [true|false]
}
}
}
}
</script>
</amp-analytics>
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-11-09。
[null,null,["最后更新时间 (UTC):2024-11-09。"],[[["\u003cp\u003eAMP analytics tags have limited customization for consent mode parameters, relying on built-in AMP consent management.\u003c/p\u003e\n"],["\u003cp\u003eYou can specify which Google services (like ads, maps, or youtube) receive consented user data using the \u003ccode\u003edma_cps\u003c/code\u003e list within your \u003ccode\u003eamp-analytics\u003c/code\u003e tag or Google Tag Manager configuration.\u003c/p\u003e\n"],["\u003cp\u003eBy default, ad personalization is denied for EEA users, but you can override this within your \u003ccode\u003eamp-analytics\u003c/code\u003e tag using \u003ccode\u003eallow_ad_personalization_signals\u003c/code\u003e.\u003c/p\u003e\n"]]],["AMP provides limited consent mode parameter customization for analytics tags. Consent management settings allow specifying which Google services receive consented data, overriding the default. This is achieved using the `dma_cps` list in the `amp-analytics` tag or via Google Tag Manager. `ad_personalization` consent is denied by default for EEA users, but this can be overridden within the `amp-analytics` tag using the `allow_ad_personalization_signals` parameter. Built in consent management, delays analytics tags until consent is provided.\n"],null,["# Set up consent mode for AMP pages\n\nThe customization options for consent mode parameters in AMP analytics tags are\nlimited. AMP offers built-in consent management, like delaying analytics tags\nuntil consent is given, as detailed in\n[Displaying European regulations messages on AMP pages](https://support.google.com/admanager/answer/11136005) and [amp-consent](https://amp.dev/documentation/components/amp-consent).\n\nConsent management settings for AMP pages\n-----------------------------------------\n\nYou can configure the following consent management settings:\n\n### Specify which Google services can receive consented data\n\nBy default, consent for sending user data to Google for advertising purposes\nis considered granted for all Google services. You can override this by\nspecifying which Google services can receive data labeled with consent.\n\n- Using the standard `amp-analytics` tag, by providing the `dma_cps` list:\n\n \"vars\": {\n \"clientId\": \"CLIENT_ID(custom_cookie)\",\n \"gtag_id\": \"UA-1234-5\",\n \"dma_cps\": \"ads,maps,playstore,search,shopping,youtube\",\n \"config\": {\n \"AW-2222\": {...},\n \"G-12345678\": {...}\n }\n }\n\n- Using Google Tag Manager:\n\n \u003c!-- Google Tag Manager --\u003e\n \u003camp-analytics\n config=\"https://www.googletagmanager.com/amp.json?id=GTM-WC8J58F>m.url=SOURCE_URL&dma_cps=ads%2Cmaps%2Cplaystore%2Csearch%2Cshopping%2Cyoutube\"\n data-credentials=\"include\"\u003e\u003c/amp-analytics\u003e\n\n### Use your `amp-analytics` tag\n\nBy default, `ad_personalization` consent is denied for users based in the\nEuropean Economic Area (EEA). You can override ad personalization using your\n`amp-analytics` tag: \n\n \u003cscript async custom-element=\"amp-analytics\" src=\"https://cdn.ampproject.org/v0/amp-analytics-0.1.js\"\u003e\u003c/script\u003e\n \u003camp-analytics type=\"gtag\" data-credentials=\"include\"\u003e\n \u003cscript type=\"application/json\"\u003e\n {\n \"vars\" : {\n \"gtag_id\": \"\u003cDESTINATION_ID\u003e\",\n \"config\" : {\n \"\u003cDESTINATION_ID\u003e\": {\n \"groups\": \"default\",\n \"allow_ad_personalization_signals\": [true|false]\n }\n }\n }\n }\n \u003c/script\u003e\n \u003c/amp-analytics\u003e"]]