适用于 AMP 的代码设置
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Accelerated Mobile Pages (AMP) 项目是一个开源网页平台,有助于提升网页内容的展示效果。AMP 内置了对 Google 代码和 Google 跟踪代码管理器的支持。本指南介绍了如何为 AMP 网页设置 Google Analytics(分析)。
安装
借助 Google 代码,您可以在 AMP 网页上安装 Google Analytics(分析)、Google Ads 及其他 Google 产品。Google 跟踪代码管理器会设置一个 AMP 容器,让您可以通过跟踪代码管理器界面创建高级配置和部署第三方跟踪代码。
请使用以下按钮选择您的平台偏好设置:
问题排查
您可以使用 amptagtest.appspot.com 验证代码植入设置,也可以通过执行以下操作来手动确保 cid
值在各个网域之间保持一致:
- 请务必清除 Cookie 或使用无痕模式。
- 如果在 Google Analytics(分析)Cookie 中找不到
cid
,还可以在网络浏览器的“Network”标签页中进行查看。搜索 collect request
,载荷应包含 cid
值。
从 Google CDN 传递到客户网站后,应通过网址调整的方式传递 cid
和 gclid
值:
**_Linker format: mydomain.com?\_gl=1\*1ie2jr6\*\_ga\*WHFTa3JPckw2TGxZSzY5b3V1cVNVSmRIREI.\*gclid\*dGVzdA.._**
最终着陆页和初始着陆页中的 cid
值仍应相同。
请注意规范网页和非 AMP 着陆页之间的重定向和网域更改。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-02-06。
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"没有我需要的信息"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"太复杂/步骤太多"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"内容需要更新"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻译问题"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"示例/代码问题"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"易于理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"解决了我的问题"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]