條件指標
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
在 Google Ads API 中,每份條件報表都以獨立資源表示。
除非另有必要,否則 *_view
資源只會包含 resource_name
欄位。
如果需要擷取任何特定條件資料,Google Ads API 用戶端必須指定對應的 ad_group_criterion
或 campaign_criterion
欄位。這樣一來,Google Ads API 用戶端就能在對 GoogleAdsService.SearchStream
方法提出的同一項要求中,一併要求 ad_group_criterion
或 campaign_criterion
欄位和 *_view
資源。
查詢要求範例
SELECT
ad_group_criterion.keyword.text,
ad_group.name,
campaign.name,
metrics.impressions,
metrics.clicks,
metrics.ctr,
metrics.average_cpc
FROM keyword_view
WHERE segments.date DURING LAST_30_DAYS
如要擷取特定條件類型的成效資料 (指標),請在 FROM
子句中指定對應的檢視畫面資源。舉例來說,在 FROM
子句中使用 keyword_view
,並在 SELECT
子句中使用一些 metrics
欄位,即可擷取關鍵字指標。
您可以從條件檢視畫面中,選取父項資源的欄位,一路向上追溯至 customer
。舉例來說,選取 FROM
keyword_view
時,您可以要求下列所有資源的欄位:
ad_group_criterion
ad_group
campaign
customer
如要瞭解特定資源可透過這種方式要求哪些資源,請查看該資源參考頁面的「Attribute Resources」(屬性資源) 列。舉例來說,如要瞭解 keyword_view
的資源,請參閱參考資料頁面。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-27 (世界標準時間)。
[null,null,["上次更新時間:2025-08-27 (世界標準時間)。"],[[["\u003cp\u003eEach criteria report in the Google Ads API is a separate resource, and clients need to specify \u003ccode\u003ead_group_criterion\u003c/code\u003e or \u003ccode\u003ecampaign_criterion\u003c/code\u003e fields to fetch specific criteria data.\u003c/p\u003e\n"],["\u003cp\u003eTo get performance data for a criteria type, use its corresponding view resource (e.g., \u003ccode\u003ekeyword_view\u003c/code\u003e) in the \u003ccode\u003eFROM\u003c/code\u003e clause of your query.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve data from parent resources, like \u003ccode\u003ead_group\u003c/code\u003e, \u003ccode\u003ecampaign\u003c/code\u003e, and \u003ccode\u003ecustomer\u003c/code\u003e, when querying a criteria view.\u003c/p\u003e\n"],["\u003cp\u003eThe "Attribute Resources" section on a resource's reference page shows which related resources can be included in your queries.\u003c/p\u003e\n"]]],[],null,["# Criteria Metrics\n\nIn the Google Ads API, each criteria report is represented by a separate resource.\nUnless otherwise necessary, `*_view` resources contain only a `resource_name`\nfield.\n\nGoogle Ads API clients must specify corresponding `ad_group_criterion` or\n`campaign_criterion` fields if any criteria specific data needs to be fetched.\nThis lets Google Ads API clients request `ad_group_criterion` or `campaign_criterion`\nfields and the `*_view` resource in the same request to the\n[`GoogleAdsService.SearchStream`](/google-ads/api/reference/rpc/v21/GoogleAdsService/SearchStream)\nmethod.\n\nSample query request\n--------------------\n\n SELECT\n ad_group_criterion.keyword.text,\n ad_group.name,\n campaign.name,\n metrics.impressions,\n metrics.clicks,\n metrics.ctr,\n metrics.average_cpc\n FROM keyword_view\n WHERE segments.date DURING LAST_30_DAYS\n\nTo retrieve performance data (metrics) for a specific criteria type, specify its\ncorresponding view resource in the `FROM` clause. For example, use\n`keyword_view` in the `FROM` clause and some `metrics` fields in the `SELECT`\nclause to retrieve keyword metrics.\n\nYou can select fields from parent resources all the way up to `customer` from a\ncriteria view. For example, when selecting `FROM` the `keyword_view`, you can\nrequest fields from all of the following resources:\n\n- `ad_group_criterion`\n- `ad_group`\n- `campaign`\n- `customer`\n\nTo discover the resources that can be requested in this way for a given\nresource, check the **Attribute Resources** row of its reference page. For\nexample, for `keyword_view`, you can find its resources on its [reference\npage](/google-ads/api/fields/v21/keyword_view)."]]