零指标
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
搜索结果中指标为零的情况
执行查询时,您可能会遇到值为零的实体的指标。可能的原因如下:
- 这些实体不符合展示条件。
- 系统可能已在该报告的日期范围内暂停这些实体。
您往往需要通过查询结果获取有关广告系列效果的信息。在这种情况下,零指标可能并不是您所想要的。要生成更有用的报告,您可以明确排除指标值为零的情况。
使用谓词排除指标值为零的情况
谓词是一个求值结果为 TRUE
、FALSE
或 UNKNOWN
的表达式。它们应用于 Google Ads 查询语言中 WHERE
子句的搜索条件。
以下查询演示了如何使用谓词明确移除指标值为零的情况:
SELECT
campaign.id,
metrics.impressions
FROM campaign
WHERE metrics.impressions > 0
通过细分排除指标为零的情况
细分报告时会始终排除指标为零的情况,前提是所有选定的指标均为零(请参阅下文)。
在搜索查询中添加任意 segments
字段即可对报告进行细分。例如,如果您按 segments.date
对报告进行细分,则指标将细分为每个日期一行。此类报告不会返回任何没有指标的日期。
对于以下查询,报告不会包含零指标行:
SELECT
campaign.name,
metrics.impressions,
segments.date
FROM campaign
WHERE segments.date DURING LAST_30_DAYS
返回的指标为零的行
如果某行的所有所选指标均为零,则不会返回该行。
例如:
SELECT
ad_group_criterion.criterion_id,
metrics.impressions,
metrics.clicks,
metrics.conversions,
segments.date
FROM keyword_view
WHERE segments.date BETWEEN <date1> AND <date2>
生成的报告不会包含任何所选的三个指标均为零的行。
如果您检索的数据早于保留期限,则生成的报告中不会包含任何早于保留期限的数据行。所有账号数据(包括效果指标、结算信息和历史报告)都将保留 11 年。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-27。
[null,null,["最后更新时间 (UTC):2025-08-27。"],[[["\u003cp\u003eZero metrics in search results can occur due to entity ineligibility or pausing within the report's date range.\u003c/p\u003e\n"],["\u003cp\u003eYou can exclude zero metrics by using a predicate in the \u003ccode\u003eWHERE\u003c/code\u003e clause of your query to filter for non-zero values.\u003c/p\u003e\n"],["\u003cp\u003eSegmenting your report by fields like \u003ccode\u003esegments.date\u003c/code\u003e automatically excludes rows where all selected metrics are zero.\u003c/p\u003e\n"],["\u003cp\u003eReports will not include rows where all selected metrics are zero or for data older than the 11-year retention period.\u003c/p\u003e\n"]]],[],null,["# Zero Metrics\n\nZero metrics in search results\n------------------------------\n\nWhen you execute a query, you may encounter metrics for entities that\nare zero. This could be because:\n\n- The entities are ineligible for display.\n- They could have been paused within the report's date range.\n\nWith query results, you often want to obtain information about how your\ncampaigns are performing. In this context, zero metrics may not be\ndesirable. To produce a more useful report, you can explicitly exclude zero\nmetrics.\n\nExclude zero metrics with a predicate\n-------------------------------------\n\nA predicate is an expression that evaluates to `TRUE`, `FALSE`, or `UNKNOWN`.\nThey are used in the search condition of the `WHERE` clauses in\n[Google Ads Query Language](/google-ads/api/docs/query/structure).\n\nThe following query demonstrates how to explicitly remove zero metrics with\na predicate: \n\n SELECT\n campaign.id,\n metrics.impressions\n FROM campaign\n WHERE metrics.impressions \u003e 0\n\nExclude zero metrics by segmenting\n----------------------------------\n\nZero metrics are always excluded when segmenting a report, provided all\n*selected* metrics are zero (see [below](#rows_returned)).\n\nSegmenting a report is done by including any `segments` field in the search\nquery. For example, if you segment a report by `segments.date`, metrics are\nbroken down with one row for each date. Dates with no metrics are not returned\nin such a report.\n\nFor the following query, the report won't include zero metric rows: \n\n SELECT\n campaign.name,\n metrics.impressions,\n segments.date\n FROM campaign\n WHERE segments.date DURING LAST_30_DAYS\n\nReturned rows with zero metrics\n-------------------------------\n\nRows whose selected metrics are all zero won't be returned.\n\nFor example: \n\n SELECT\n ad_group_criterion.criterion_id,\n metrics.impressions,\n metrics.clicks,\n metrics.conversions,\n segments.date\n FROM keyword_view\n WHERE segments.date BETWEEN \u003cdate1\u003e AND \u003cdate2\u003e\n\nThe resulting report won't contain any rows in which all three selected metrics\nare zero.\n\nIn situations where you retrieve data older than the\n[retention period](//ads-developers.googleblog.com/2024/10/new-data-retention-policy-for-google-ads.html),\nthe resulting report won't contain any rows for data older than the retention\nperiod. All account data, including performance metrics, billing information\nand historical reports, are retained for a period of 11 years."]]