Page Summary
-
In the Google Ads API, each criteria report is a separate resource, with
*_viewresources typically containing only aresource_namefield. -
To fetch criteria-specific data in the Google Ads API, clients must specify corresponding
ad_group_criterionorcampaign_criterionfields along with the*_viewresource in the same request. -
Performance data for a specific criteria type can be retrieved by specifying its corresponding view resource in the
FROMclause and metrics fields in theSELECTclause of a query. -
Fields from parent resources, up to the
customerlevel, can be selected when querying from a criteria view.
In the Google Ads API, each criteria report is represented by a separate resource.
Unless otherwise necessary, *_view resources contain only a resource_name
field.
Google Ads API clients must specify corresponding ad_group_criterion or
campaign_criterion fields if any criteria-specific data needs to be fetched.
Each view joins to the criterion resource that matches its targeting level (for
example, keyword_view joins to ad_group_criterion, while location_view
joins to campaign_criterion). This enables Google Ads API clients to request
ad_group_criterion or campaign_criterion fields and the *_view resource in
the same request to the GoogleAdsService.SearchStream method.
Sample query request
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
To retrieve performance data (metrics) for a specific criteria type, specify its
corresponding view resource in the FROM clause. For example, use
keyword_view in the FROM clause and metrics fields in the SELECT clause
to retrieve keyword metrics.
You can select fields from parent resources all the way up to customer from a
criteria view. For example, when selecting FROM the keyword_view, you can
request fields from all of the following resources:
ad_group_criterionad_groupcampaigncustomer
To discover the resources that can be requested in this way for a given
resource, check the Attributed resources row of its reference page. For
example, for keyword_view, you can find its resources on its
reference page.
Mapping to the UI
Each criteria report corresponds to a specific view in the Google Ads UI. Mapping these can help you reconcile API data with what you see in the interface. For a larger list of mappings, see Reports in the UI.
The following are some common criteria-based reports and their typical UI locations:
- Campaigns > Audiences, keywords, and content > Search keywords: Returns
data equivalent to
keyword_view. - Campaigns > Audiences, keywords, and content > Audiences > Demographics:
Returns data equivalent to
age_range_viewandgender_view. - Campaigns > Locations: Returns data equivalent to
location_view.