POST 結構定義
傳送至 Webhook 的 POST 要求會採用 JSON 格式,並使用下列結構定義:
Webhook Proto 酬載
// Represent user lead data for single column
message UserLeadColumnData {
// Human-readable text of the field type (e.g.: Full Name, What is your
// preferred dealership?). This field might not always be populated.
optional string column_name = 1;
// Column value based on column type
oneof column_value {
string string_value = 2;
}
// Column ID. Populated for all types of fields. (e.g.: FULL_NAME)
optional string column_id = 3;
}
// Message to construct webhook JSON payload
message WebhookLead {
// Unique ID to represent lead
optional string lead_id = 1;
// User inputted data per column
repeated UserLeadColumnData user_column_data = 2;
// API version
optional string api_version = 3;
// Form ID to which lead belonged to.
optional int64 form_id = 4;
// Campaign ID that the lead form is associated with
optional int64 campaign_id = 5;
// Key to be used by advertiser to verify the request
// is from Google.
optional string google_key = 6;
// Denotes if the lead is a test lead.
optional bool is_test = 7;
// Click ID for the lead submission.
optional string gcl_id = 8;
// Adgroup ID which generated the lead.
optional int64 adgroup_id = 9;
// Creative ID which generated the lead.
optional int64 creative_id = 10;
// Asset group ID represents the container for holding assets, associated
// URLs, hints and criteria that will be used to select assets and for
// optimization. This field is only populated for Performance Max campaigns.
int64 asset_group_id = 11;
// Lead stage at the time of delivery.
string lead_stage = 12 [(datapol.semantic_type) = ST_NOT_REQUIRED];
// Lead submit time in ISO-8601 format. Ex- 2024-09-26T12:30:00Z
string lead_submit_time = 13 [(datapol.semantic_type) = ST_NOT_REQUIRED];
}
欄位說明
| 欄位 | 說明 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
lead_id |
用於識別特定待開發客戶的專屬字串。
處理建議:使用這項功能,排除收到的重複待開發客戶。所有表單的 ID 皆不重複。回報與特定待開發客戶相關的問題時,必須提供這個 ID。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
api_version |
這個待開發客戶結構定義所屬的 API 版本。這項設定會在遷移至新結構定義時使用,目前可以忽略。 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
form_id |
Google Ads 中設定的每個表單都有專屬 ID。目前產品允許在廣告活動層級附加表單 (而非在廣告群組或廣告層級附加)。 影響:只能在 用戶端需要使用 8 位元組整數來處理。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
campaign_id |
附加的待開發客戶表單的 Google Ads 廣告活動 ID 或委刊項 ID (Display & Video 360)。 用戶端必須使用 8 位元組整數進行處理。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
adgroup_id |
Google Ads 廣告群組 ID 用於區分廣告活動中的特定廣告群組。(僅適用於影片和探索廣告的待開發客戶)
用戶端必須使用 8 位元組整數進行處理。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
creative_id |
Google Ads 廣告素材 ID 用於區分廣告群組中的特定廣告素材。(僅適用於影片和探索廣告的待開發客戶)
用戶端必須使用 8 位元組整數進行處理。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
gcl_id |
Google 點擊 ID,用於追蹤每次廣告點擊的不重複參數。 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
google_key |
廣告主為每個表單設定的金鑰。
處理建議:處理透過 Webhook 收到的待開發客戶前,請先驗證 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
is_test |
這個欄位具有「選填」語意。如果值為 true,請將這個待開發客戶視為測試待開發客戶。如果值為 false 或沒有這個欄位,請將這個待開發客戶視為有效的正式版待開發客戶。 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
user_column_data |
重複的鍵/值元組,用於傳輸使用者提交的資料。
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
asset_group_id |
這個欄位只會填入最高成效廣告活動。
這表示包含待開發客戶表單的容器 ID。
用戶端必須使用 8 位元組整數進行處理。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
lead_stage |
這表示系統傳送待開發客戶時的階段。這個欄位有助於追蹤待開發客戶的漏斗階段 / 轉換狀態。 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
lead_submit_time |
這表示使用者提交表單的時間戳記。以 ISO-8601 格式表示。Ex- 2024-09-26T12:30:00Z |
無法辨識的欄位和向前相容性
為確保 Webhook 整合功能維持穩定,並能適應日後的強化功能,建議您設計 JSON 剖析器時,讓系統能順利忽略 Webhook 酬載中未明確取用或辨識的任何欄位,這是標準最佳做法。
重要建議:設定 JSON 剖析邏輯,只處理應用程式特別需要的欄位。請勿編寫預期有固定欄位集的程式碼,或在酬載中出現新的非預期欄位時會失敗的程式碼。
重要性:
- 向前相容性:Google 可能會在日後的更新中,於 Webhook 酬載中新增選填欄位,以提供更豐富的資料或新功能。如果剖析器過於嚴格 (例如,遇到不明屬性就會失敗),Google 推出這類非破壞性變更時,您的整合功能可能會中斷。
- 簡化維護作業:只專注於您主動使用的資料點,整合程式碼會更簡單,也更容易維護。
大多數現代 JSON 剖析程式庫都提供選項,可預設忽略不明屬性,或設定為忽略不明屬性。
待開發客戶處理
待開發客戶處理人員應以下列 HTTP 程式碼回應:
| HTTP 回應 | 回應內文 (JSON) | 可重試的錯誤? |
|---|---|---|
200 |
{} | 不適用 |
4XX |
{"message: Free form error text, describing what was wrong with request"} | 否 |
5XX |
{"message: Intermittent retraible error optional message"} | 是 |
重複的聯絡人
系統不保證只會傳送一次待開發客戶資訊,因此待開發客戶處理 webhook 應能妥善處理重複資訊。