Google Ads Query Language

The Google Ads Query Language can query the Google Ads API for

Resources or metrics in GoogleAdsService.Search

The get method can be used to query multiple resources simultaneously since all services return only one resource at a time.

The result from a GoogleAdsService query is a list of GoogleAdsRow instances, with each GoogleAdsRow representing a resource. If metrics were requested, the row would also include metrics.

For a list of queryable metrics, such as impressions or clicks, consult the Metrics documentation.

Metadata about available fields and resources in GoogleAdsFieldService

This service provides a catalog of queryable fields with specifics about their compatibility and type.

The result from a GoogleAdsFieldService query is a list of GoogleAdsField instances, with each GoogleAdsField containing details about the requested field.

Resources and metrics

When querying for metrics, you can also have the details of the associated resources returned at the same time. You can then immediately take those resources, modify them, and send them back to the service's mutate method. Here is a sample workflow:

  1. Query all the campaigns that are currently PAUSED and have impressions greater than 1000.
  2. Process each GoogleAdsRow returned in the list and retrieve the campaigns that are in each GoogleAdsRow.
  3. Change the status of each campaign from PAUSED to ENABLED.
  4. Call CampaignService.MutateCampaigns with the modified campaigns to update them.

Resources query

There are times when you may not care about metrics. Here's a query for campaigns showing how to get the campaign ID, name, and status:

SELECT,, campaign.status
FROM campaign

This query orders by campaign ID. Each resulting GoogleAdsRow would have a campaign populated with the selected fields.

To find out what other fields are available for campaign queries, consult the Campaign documentation.

Metrics query

When querying for metrics, you can query corresponding resources at the same time. Here's a query for campaigns showing how to get the campaign ID, name, status, and impressions:

SELECT,, campaign.status, metrics.impressions
FROM campaign
WHERE campaign.status = 'PAUSED' AND metrics.impressions > 1000

This query filters for only the campaigns that have a status of PAUSED and have had greater than 1000 impressions while ordering by campaign ID. Each resulting GoogleAdsRow would have a metrics populated with the selected metrics.

For a list of queryable metrics, consult the Metrics documentation.

Field metadata

Queries sent to GoogleAdsFieldService is meant for retrieving field metadata. Here's a query for the metadata of the field

SELECT name, category, selectable, filterable, sortable, selectable_with,
       data_type, is_repeated
WHERE name =

You can replace in this query with either a resource (such as customer or campaign) or a field (such as metrics.impressions or

For a list of queryable fields, consult the GoogleAdsField documentation.

Code examples

The client libraries have examples of using the Google Ads Query Language in GoogleAdsService. The basic operations folder has examples such as GetCampaigns, GetKeywords, and GetArtifactMetadata. The reporting folder has a GetKeywordStats example.

Send feedback about...

Google Ads API
Google Ads API
Need help? Visit our support page.