試用 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 傳送 Webhook 通知至 Webhook 伺服器。
通知設定包含私人值,以及僅供您的 GCP 專案查看不同的 GCP 專案可能會將不同的 Webhook 通知附加至同一個長時間執行的作業資源。
| JSON 表示法 |
{
"uri": string,
"channelToken": string
} |
| 欄位 |
uri |
string
選用設定。用於接收 Webhook 通知的網址。這個位址會收到長時間執行的作業資源變更狀態的 POST 要求。POST 要求會在主體中同時包含長時間執行的作業資源的 JSON 版本和 sentTimestamp 欄位。傳送的時間戳記會指定要求傳送自 Epoch 紀元時間以來的 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,才能使用 Webhook 通知。 向這個 Webhook 伺服器發出的要求會包含用於驗證服務帳戶「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),以及用於通過 Google Cloud Functions 驗證的 Webhook 發布要求 Cloud Functions 叫用者 (roles/cloudfunctions.invoker) 角色。這個 API 可傳送 Webhook 通知給任意 URI;如果是 Google Cloud Functions 以外的 Webhook 伺服器,如果您不需要這個 ID,請忽略授權不記名標頭中的這個 ID 權杖。
|
channelToken |
string
選用設定。頻道權杖是任意字串值,字串長度上限為 64 個字元。管道權杖可讓您驗證 Webhook 通知的來源。這有助於防範假冒的郵件。頻道權杖會在 Webhook POST 要求的 X-Goog-Channel-Token HTTP 標頭中指定。 您不需要管道符記,就能使用 Webhook 通知。
|
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2026-04-24 (世界標準時間)。
[null,null,["上次更新時間: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"]]