GAQL for Marketers: How to Read and Write Google Ads Query Language, With Queries to Copy
GAQL, the Google Ads Query Language, is the SQL-like language the Google Ads API uses to return reporting data. A query names the fields you want, the resource they come from, and the filters to apply. You don't need to write code to use one. Google's Interactive Query Builder validates queries, and AI assistants connected through the Google Ads MCP server run GAQL for you.
If you use an assistant for Google Ads reporting, learn to read GAQL. The query is the only record of what a number measures: which resource, which date range, which segments, which filters. That decides whether a figure is right. This guide covers the structure, six queries to adapt, and the mistakes that produce wrong numbers without any error.
Syntax and field names below come from Google's GAQL overview, query structure, grammar, date ranges and query cookbook, read on November 19, 2026. I assembled the example queries from those documented fields. I haven't run them against a live account, so validate each one in the Query Builder before you depend on it.
The shape of a query
A GAQL query has up to six clauses, in this order: SELECT, FROM, WHERE, ORDER BY, LIMIT and PARAMETERS. Through the API's main reporting service, only SELECT and FROM are required.
SELECT campaign.name, metrics.clicks
FROM campaign
WHERE segments.date DURING LAST_30_DAYS
ORDER BY metrics.clicks DESC
LIMIT 10
Read it as a sentence: for each campaign, give me the name and clicks over the last 30 days, biggest first, top ten.
Google's terminology has three kinds of field:
- Resource fields describe a thing in the account, such as
campaign.nameorad_group.status. - Metrics are measurements, such as
metrics.clicksormetrics.cost_micros. - Segments are dimensions that split the metrics, such as
segments.dateorsegments.device.
The resource in the FROM clause sets the level of the report. FROM campaign returns one row per campaign (per segment value, if you add segments). FROM ad_group returns one row per ad group. You can only name one resource in FROM, though related resources can be pulled in by selecting their fields. Selecting campaign.name in an ad_group query works without any join syntax.
Six queries to adapt
1. Which campaigns spent the most in the last 30 days, and what did they return?
SELECT campaign.name, campaign.status, campaign.advertising_channel_type,
metrics.cost_micros, metrics.conversions, metrics.conversions_value
FROM campaign
WHERE segments.date DURING LAST_30_DAYS
AND campaign.status != 'REMOVED'
ORDER BY metrics.cost_micros DESC
LIMIT 20
The advertising_channel_type column tells Search, Shopping and Performance Max campaigns apart. The status filter follows the pattern in Google's cookbook, which uses it to match what the Google Ads interface shows.
2. Same question, split by device
SELECT campaign.name, segments.device,
metrics.cost_micros, metrics.conversions_value
FROM campaign
WHERE segments.date DURING LAST_30_DAYS
AND campaign.status = 'ENABLED'
ORDER BY metrics.cost_micros DESC
Adding segments.device turns each campaign into one row per device. Google's segmentation guide warns that every extra segment can multiply the row count, so add them one at a time.
3. Search terms that spent over $50 and never converted
SELECT search_term_view.search_term, campaign.name, ad_group.name,
metrics.clicks, metrics.cost_micros
FROM search_term_view
WHERE segments.date DURING LAST_30_DAYS
AND metrics.cost_micros > 50000000
AND metrics.conversions = 0
ORDER BY metrics.cost_micros DESC
LIMIT 50
50000000 is $50 in micros, explained below. Per Google's cookbook, search_term_view leaves out Performance Max campaigns, which report search terms through a different resource, campaign_search_term_view. If your account runs mostly Performance Max, this query will look emptier than your account really is.
4. Weekly spend and conversion value, by campaign
SELECT campaign.name, segments.week,
metrics.cost_micros, metrics.conversions_value
FROM campaign
WHERE segments.week >= '2026-10-05'
AND segments.week <= '2026-11-09'
AND campaign.status != 'REMOVED'
segments.week filters need a Monday as the date. Google's date-range page says a date that isn't the first day of the period returns a MISALIGNED_DATE_FOR_FILTER error. For months use the first of the month, and for quarters the first day of January, April, July or October.
5. Keywords and what they cost
SELECT ad_group_criterion.keyword.text, ad_group_criterion.keyword.match_type,
campaign.name, ad_group.name,
metrics.clicks, metrics.cost_micros, metrics.conversions
FROM keyword_view
WHERE segments.date DURING LAST_30_DAYS
AND ad_group_criterion.status != 'REMOVED'
ORDER BY metrics.cost_micros DESC
LIMIT 50
This mirrors Google's cookbook query for the Search keywords screen with the columns cut down.
6. Ask the API which fields exist
SELECT name, category, selectable, filterable, sortable, selectable_with, data_type
WHERE name = "campaign"
This one has no FROM clause. It goes to a different service, GoogleAdsFieldService, which is the catalog of queryable fields. Put a resource or field name in the WHERE condition, such as campaign or metrics.cost_micros, and it tells you what can be selected, filtered and sorted with it. Google recommends checking it before building complex queries, and it is what stops you guessing field names.
The mistakes that don't throw errors
Cost comes back in micros. Google's budget reference puts it plainly: "One million micros is equivalent to one currency unit." That makes metrics.cost_micros a count of millionths of your account currency, so a returned 23450000 is 23.45 in your currency, and campaign_budget.amount_micros works the same way. When an assistant reports spend a million times too large, it forgot to divide.
State the date range. Google's cookbook says its own dated examples return the last seven days unless stated otherwise, so don't assume a default when you write yours. The named ranges (LAST_7_DAYS, LAST_30_DAYS and the rest) are evaluated in the account's time zone, and LAST_30_DAYS doesn't include today.
DURING only accepts named ranges. For a custom range use BETWEEN '2026-10-01' AND '2026-10-31', as Google's date page shows.
There is no OR. Google's grammar page says conditions combine only with AND. Use IN ('ENABLED', 'PAUSED') or REGEXP_MATCH instead.
Segments have to be selected and dated. Segment fields in WHERE must also appear in SELECT, except for the core date segments (segments.date, week, month, quarter, year). If you select any of those, you need a finite date range on at least one of them in WHERE.
Conversions are not conversions value, and neither is Shopify revenue. metrics.conversions counts only conversion actions marked to be included in the conversions column. metrics.all_conversions counts every conversion action regardless of that setting. metrics.conversions_value is the attributed value Google credits to the campaign. It won't match Shopify net sales, because Meta, email and organic search claim some of the same orders. The Shopify attribution guide and our write-up on choosing an attribution window cover that gap.
Old data has limits. Daily, weekly and hourly breakdowns reach back 37 months. Monthly, quarterly, yearly and unsegmented queries reach up to 11 years, with the date range starting on the first of a month and ending on the last day of a month.
How GAQL shows up when an assistant runs it
Google's own MCP server doesn't accept a raw GAQL string. Its search_search tool takes structured parameters: the customer ID, the resource, the fields, optional conditions, orderings and a limit. The server builds the GAQL from them. Those map directly onto the query clauses: resource is FROM, fields is SELECT, conditions is WHERE.
That has a practical benefit. When an assistant says it ran a query for last month's spend, ask it to show the resource, fields and conditions it used. You can read those with what you learned above and spot a missing status filter, the wrong date range or a Performance Max blind spot. Its metadata_get_resource_metadata tool is the MCP version of the field catalog in query 6. Our Google Ads MCP server guide covers setup, the read-only configuration and what the server can't change.
For Performance Max accounts, how PMax behaves for ecommerce explains why campaign-level numbers and search-term numbers don't line up.
When you'd rather not write queries
GAQL answers "what does Google Ads say about this account?" It does not answer "what happened to the business?", since the numbers stay inside Google's attribution. Finsi brings Google Ads, Meta, Shopify, Klaviyo and subscription data into one warehouse with shared metric definitions, and Finsi MCP lets Claude or ChatGPT read those numbers, read-only and logged. When an agent suggests a change to spend, the safer pattern is a proposal a person approves, which is how approval-gated agents and Finsi's ads agents work. More on the platform at what Finsi is.
Sources
- Google for Developers, Google Ads Query Language overview, query structure, grammar, date ranges
- Google for Developers, Query cookbook and Segmentation
- Google for Developers, Metrics and CampaignBudget reference (micros, conversions fields)
- Google for Developers, Google Ads MCP server developer integration guide