条件指标
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
在 Google Ads API 中,每种条件报告都由单独的资源表示。除非另有必要,否则 *_view
资源仅包含 resource_name
字段。
如果需要提取任何特定于条件的数据,则 Google Ads API 客户端必须指定对应的 ad_group_criterion
或 campaign_criterion
字段。
这样一来,Google Ads API 客户端就可以在同一请求中请求获取 ad_group_criterion
或 campaign_criterion
字段以及 *_view
资源,并将其发送到 GoogleAdsService.SearchStream
方法。
查询请求示例
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
。例如,针对 keyword_view
选择 FROM
后,您可以请求以下所有资源中的字段:
ad_group_criterion
ad_group
campaign
customer
如需了解可以这种方式为给定资源请求哪些资源,请查看其参考页面的属性资源行。例如,对于 keyword_view
,您可以在其参考页面上找到相关资源。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-27。
[null,null,["最后更新时间 (UTC):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)."]]