试用 Google Analytics 的 MCP 服务器。从
GitHub 安装,并参阅
公告了解详情。
Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
WebhookNotification
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
配置长时间运行的操作资源,以便在资源更新时,从 Google Analytics Data API 向您的网络钩子服务器发送网络钩子通知。
通知配置包含不公开的值和只有您的 GCP 项目可见不同的 GCP 项目可以将不同的网络钩子通知附加到同一个长时间运行的操作资源。
| JSON 表示法 |
{
"uri": string,
"channelToken": string
} |
| 字段 |
uri |
string
可选。将接收网络钩子通知的网址。当长时间运行的操作资源的状态更改时,此地址将接收 POST 请求。POST 请求的正文中将包含长时间运行的操作资源的 JSON 版本以及 sentTimestamp 字段。发送的时间戳将指定自请求发送时间以来的 unix 微秒数;这样,您就可以识别重放通知 示例 URI 为 https://us-central1-example-project-id.cloudfunctions.net/example-function-1。 URI 必须使用 HTTPS 并指向具有网络服务器上有效 SSL 证书的网站。URI 的字符串长度不得超过 128 个字符,请仅使用 RFC 1738 中列入许可名单的字符。 当您的 webhook 服务器收到通知时,应在 5 秒内以 HTTP 响应状态代码 200 进行回复。 必须提供 URI 才能使用网络钩子通知。 发送到此网络钩子服务器的请求将包含用于对服务账号 google-analytics-audience-export@system.gserviceaccount.com 进行身份验证的 ID 令牌。如需详细了解 ID 令牌,请参阅 https://cloud.google.com/docs/authentication/token-types#id。对于 Google Cloud Functions,这让您可以将函数配置为需要进行身份验证。在 Cloud IAM 中,您需要向 Cloud Run 调用者 (roles/run.invoker) 授予服务账号权限,webhook post 请求的 Cloud Functions Invoker (roles/cloudfunctions.invoker) 角色,以传递 Google Cloud Functions 身份验证。此 API 可以向任意 URI 发送 webhook 通知;对于 Google Cloud Functions 以外的 Webhook 服务器,如果不需要,则应忽略授权不记名标头中的此 ID 令牌。
|
channelToken |
string
可选。渠道令牌是任意字符串值,字符串长度不得超过 64 个字符。渠道令牌可让您验证网络钩子通知的来源。这样可以防止邮件被仿冒。渠道令牌将在 webhook POST 请求的 X-Goog-Channel-Token HTTP 标头中指定。 使用网络钩子通知不需要渠道令牌。
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2026-04-24。
[null,null,["最后更新时间 (UTC):2026-04-24。"],[],["This document outlines the configuration for webhook notifications from the Google Analytics Data API. You can set up a webhook server (`uri`) to receive POST requests containing long-running operation resource updates in JSON format, along with a `sentTimestamp`. The `uri` must be HTTPS with a valid SSL certificate and is required for webhook notifications. Optionally, use a `channelToken` for source verification, which is included in the `X-Goog-Channel-Token` header. Notifications will include an ID token for authentication.\n"]]