כדאי לנסות את שרת ה-MCP ל-Google Analytics. אפשר להתקין מ-
GitHub, ולקרוא את
ההודעה לפרטים נוספים.
WebhookNotification
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
הגדרת משאב של פעולה ממושכת לשליחת התראה על webhook מ-Google Analytics Data API לשרת ה-webhook שלכם כשהמשאב מתעדכן.
הגדרות ההתראות מכילות ערכים פרטיים וגלויות רק לפרויקט שלכם ב-GCP. פרויקטים שונים ב-GCP יכולים לצרף התראות webhook שונות לאותו משאב של פעולה ממושכת.
ייצוג ב-JSON |
{
"uri": string,
"channelToken": string
} |
שדות |
uri |
string
זה שינוי אופציונלי. כתובת האינטרנט שתקבל את ההתראה מה-webhook. כתובת זו תקבל בקשות POST כשהסטטוס של המשאב של הפעולה הממושכת ישתנה. בקשת ה-POST תכיל גם גרסה של JSON של משאב הפעולה ממושכת בגוף וגם שדה sentTimestamp . חותמת הזמן שנשלחת תציין את המיקרו-שניות ביוניקס מאז תחילת הזמן שבו הבקשה נשלחה. כך תוכלו לזהות התראות שהופעלה בהן הפעלה חוזרת. דוגמה ל-URI היא https://us-central1-example-project-id.cloudfunctions.net/example-function-1 . מזהה ה-URI חייב להשתמש ב-HTTPS ולהפנות לאתר עם אישור SSL תקין בשרת האינטרנט. אורך המחרוזת של ה-URI חייב להיות מקסימום 128 תווים, והיא יכולה לכלול רק את התווים שמופיעים ברשימת ההיתרים של RFC 1738. כששרת ה-webhook מקבל התראה, הוא אמור להשיב עם קוד סטטוס תגובה מסוג HTTP 200 תוך 5 שניות. כדי להשתמש בהתראות webhook, נדרש URI. בקשות לשרת ה-webhook הזה יכילו אסימון מזהה לאימות חשבון השירות google-analytics-audience-export@system.gserviceaccount.com . מידע נוסף על אסימונים מזהים זמין בכתובת https://cloud.google.com/docs/authentication/token-types#id. ב-Google Cloud Functions, כך תוכלו להגדיר את הפונקציה כך שתחייב אימות. ב-Cloud IAM, תצטרכו להקצות את הרשאות חשבון השירות לתפקידים Cloud Run Invoker (roles/run.invoker ) ו-Cloud Functions Invoker (roles/cloudfunctions.invoker ) כדי שבקשת ה-post של ה-webhook תעבור את האימות של Google Cloud Functions. ממשק ה-API הזה יכול לשלוח התראות webhook למזהי URI שרירותיים. בשרתים של webhook שאינם Google Cloud Functions, צריך להתעלם מאסימון המזהה בכותרת של בעל ההרשאה אם הוא לא נדרש.
|
channelToken |
string
זה שינוי אופציונלי. אסימון הערוץ הוא ערך מחרוזת שרירותי, והאורך המקסימלי של המחרוזת הוא 64 תווים. טוקני ערוץ מאפשרים לכם לאמת את המקור של התראה מ-webhook. כך אפשר למנוע זיוף של ההודעה. אסימון הערוץ יופיע בכותרת ה-HTTP X-Goog-Channel-Token של בקשת ה-POST ל-webhook. לא נדרש אסימון ערוץ כדי להשתמש בהתראות webhook.
|
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-26 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-26 (שעון UTC)."],[[["\u003cp\u003eWebhook notifications can be configured for long-running operations in the Google Analytics Data API to send updates to your server.\u003c/p\u003e\n"],["\u003cp\u003eThese notifications are project-specific and include a JSON payload with operation details and a timestamp.\u003c/p\u003e\n"],["\u003cp\u003eThe webhook configuration requires a URI using HTTPS with a valid SSL certificate, and optionally, a channel token for verification.\u003c/p\u003e\n"],["\u003cp\u003eWhen receiving a notification, your server should respond with an HTTP 200 status code within 5 seconds.\u003c/p\u003e\n"],["\u003cp\u003eAuthentication for Google Cloud Functions is provided through an ID token representing the service account \u003ccode\u003egoogle-analytics-audience-export@system.gserviceaccount.com\u003c/code\u003e, while other webhook servers can ignore this token.\u003c/p\u003e\n"]]],["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"],null,["# WebhookNotification\n\n- [JSON representation](#SCHEMA_REPRESENTATION)\n\nConfigures a long-running operation resource to send a webhook notification from the Google Analytics Data API to your webhook server when the resource updates.\n\nNotification configurations contain private values \\& are only visible to your GCP project. Different GCP projects may attach different webhook notifications to the same long-running operation resource.\n\n| JSON representation |\n|---------------------------------------------------|\n| ``` { \"uri\": string, \"channelToken\": string } ``` |\n\n| Fields ||\n|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `uri` | `string` Optional. The web address that will receive the webhook notification. This address will receive POST requests as the state of the long running operation resource changes. The POST request will contain both a JSON version of the long running operation resource in the body and a `sentTimestamp` field. The sent timestamp will specify the unix microseconds since the epoch that the request was sent; this lets you identify replayed notifications. An example URI is `https://us-central1-example-project-id.cloudfunctions.net/example-function-1`. The URI must use HTTPS and point to a site with a valid SSL certificate on the web server. The URI must have a maximum string length of 128 characters \\& use only the allowlisted characters from [RFC 1738](https://www.rfc-editor.org/rfc/rfc1738). When your webhook server receives a notification, it is expected to reply with an HTTP response status code of 200 within 5 seconds. A URI is required to use webhook notifications. Requests to this webhook server will contain an ID token authenticating the service account `google-analytics-audience-export@system.gserviceaccount.com`. To learn more about ID tokens, see \u003chttps://cloud.google.com/docs/authentication/token-types#id\u003e. For Google Cloud Functions, this lets you configure your function to require authentication. In Cloud IAM, you will need to grant the service account permissions to the Cloud Run Invoker (`roles/run.invoker`) \\& Cloud Functions Invoker (`roles/cloudfunctions.invoker`) roles for the webhook post request to pass Google Cloud Functions authentication. This API can send webhook notifications to arbitrary URIs; for webhook servers other than Google Cloud Functions, this ID token in the authorization bearer header should be ignored if it is not needed. |\n| `channel``Token` | `string` Optional. The channel token is an arbitrary string value and must have a maximum string length of 64 characters. Channel tokens allow you to verify the source of a webhook notification. This guards against the message being spoofed. The channel token will be specified in the `X-Goog-Channel-Token` HTTP header of the webhook POST request. A channel token is not required to use webhook notifications. |"]]