AI-generated Key Takeaways
-
The Search Ads 360 Query Language enables you to construct search queries for retrieving reporting data and resource metadata via the Search Ads 360 Reporting API.
-
You can utilize the
SearchAds360Serviceto query resources, attributes, segments, and metrics, while theSearchAds360FieldServicehelps you retrieve metadata about available fields and resources. -
Queries can be structured to retrieve attributes of resources, associated metrics, segments for specific timeframes, and related resource attributes.
-
Metadata about fields can be retrieved by querying the
SearchAds360FieldServicewith the desired field name.
The Search Ads 360 Query Language allows you to build search queries to retrieve reporting data and resource metadata using the Search Ads 360 Reporting API.
Search services
You can use the Search Ads 360 Query Language to query the API using:
SearchAds360ServiceUse this service to query resources and their related attributes, segments, and metrics. There are two methods,
SearchandSearchStream.SearchAds360Servicequeries return a list ofSearchAds360Rowinstances:- Each row represents a resource.
- If requested, rows include attributes and metric fields.
- If you request segments, additional rows are included for each segment-resource tuple.
See Create search reports for more information.
SearchAds360FieldServiceUse this service to query for metadata about available fields and resources. The service provides a catalog of queryable fields with specifics about their compatibility and type.
SearchAds360FieldServicereturns a list ofSearchAds360Fieldinstances:- Each field contains details about the requested field.
See Retrieve resource metadata to learn more.
Basic query examples
The following sections provide basic query examples that you can adapt to build your own queries.
Query for attributes of a resource
This is a basic query for attributes of the campaign resource that returns
the campaign ID, name, and status:
SELECT
campaign.id,
campaign.name,
campaign.status
FROM campaign
ORDER BY campaign.id
- Each returned
SearchAds360Rowrepresents acampaignobject. - Rows are populated with the selected fields (including the given campaign's
resource_name). - The query orders by campaign ID.
See campaign for
other available fields you can use in your queries.
Query for metrics
This is a basic query for metrics related to attributes of the campaign
resource:
SELECT
campaign.id,
campaign.name,
campaign.status,
metrics.impressions
FROM campaign
WHERE campaign.status = 'PAUSED'
AND metrics.impressions > 1000
ORDER BY campaign.id
- The query returns campaigns with the status
PAUSEDand more than 1000 impressions. - Each returned
SearchAds360Rowhas ametricsfield populated with the selected metrics. - The query orders by campaign ID.
See metrics for other
available metrics you can use in your queries.
Query for segments
This is a basic query for segments related to attributes of the campaign
resource:
SELECT
campaign.id,
campaign.name,
campaign.status,
metrics.impressions,
segments.date,
FROM campaign
WHERE campaign.status = 'PAUSED'
AND metrics.impressions > 1000
AND segments.date during LAST_30_DAYS
ORDER BY campaign.id
- The query returns campaigns with the status
PAUSEDand more than 1000 impressions. - It segments the data by date.
- As a result of the segmentation, each
SearchAds360Rowrepresents a tuple of a campaign and the date segment. - The query orders by campaign ID.
See segments for a
list of segments you can use in your queries and Segmentation for more
information about segmenting your reports.
Query for attributes of a related resource
This is a basic query on the campaign resource that joins attributes of the
bidding_strategy resource, if available. This type of related resource is
known as an attributed resource.
SELECT
campaign.id,
campaign.name,
campaign.status,
bidding_strategy.name
FROM campaign
ORDER BY campaign.id
- The query selects campaign attributes and related attributes from each campaign selected.
- Each returned
SearchAds360Rowrepresents acampaignobject populated with the selected campaign attributes, as well as, the selected bidding strategy attribute,bidding_strategy.name.
See campaign
to find out which attributed resources are available for campaign queries.
Query for field metadata
You can use SearchAds360FieldService
to retrieve field metadata.
This is a basic query for field metadata:
SELECT name, category, selectable, filterable, sortable, selectable_with, data_type, is_repeated WHERE name = RESOURCE/FIELD
- Replace RESOURCE OR FIELD with either a resource (such as,
customerorcampaign) or a field (such as,campaign.id,metrics.impressions, orad_group.id).
See Retrieve resource metadata for more information about retrieving field metadata.
Learn more
Learn more about how to build queries in the Search Ads 360 Reporting API: