Guides
Reporting

GAQL

The subset of the Google Ads Query Language that Mimicr runs in googleAds:search and searchStream, with resources, operators, dates and pagination.

Reads in the Google Ads API are GAQL queries sent to googleAds:search (paginated) or googleAds:searchStream (in batches). The grammar is the official one; Mimicr runs the subset described here.

A query

bash
curl --request POST \
  --url https://google-ads.mimicr.dev/v26/customers/2220330728/googleAds:search \
  --header 'Authorization: Bearer <token>' \
  --header 'login-customer-id: 6446154552' \
  --header 'Content-Type: application/json' \
  --data '{ "query": "SELECT ad_group_ad.ad.id, segments.date, metrics.cost_micros, metrics.impressions, metrics.clicks FROM ad_group_ad WHERE campaign.id = 54542599977 AND segments.date BETWEEN '\''2026-11-01'\'' AND '\''2026-11-06'\''" }'
json
{
  "results": [
    {
      "adGroupAd": { "resourceName": "customers/2220330728/adGroupAds/54542599986~54542599990", "ad": { "resourceName": "customers/2220330728/ads/54542599990", "id": "54542599990" } },
      "metrics": { "clicks": "31", "costMicros": "38440000", "impressions": "702" },
      "segments": { "date": "2026-11-05" }
    }
  ],
  "fieldMask": "adGroupAd.ad.id,segments.date,metrics.costMicros,metrics.impressions,metrics.clicks",
  "queryResourceConsumption": "6"
}
  • Each resource includes only the selected fields, plus resourceName.
  • int64 values (ids, micros, impressions, clicks) come as strings; ctr, averageCpc and conversions as numbers. A selected metric that is zero comes as "0".
  • results is omitted when empty.

Grammar

text
SELECT field [, field...] FROM resource
  [WHERE condition [AND condition...]]
  [ORDER BY field [ASC|DESC] [, ...]]
  [LIMIT n]
  [PARAMETERS include_drafts=true|false]
OperatorExample
=, !=, >, >=, <, <=campaign.id = 54542599977
IN, NOT INcampaign_criterion.type IN ('PROXIMITY', 'LOCATION')
LIKE, NOT LIKEcampaign.name LIKE 'Gás%' (% any sequence, _ one character)
CONTAINS ANY, CONTAINS ALL, CONTAINS NONEcampaign.primary_status_reasons CONTAINS ANY ('NO_KEYWORDS')
BETWEENsegments.date BETWEEN '2026-11-01' AND '2026-11-06'
DURINGsegments.date DURING LAST_7_DAYS
IS NULL, IS NOT NULLcampaign.end_date_time IS NULL
  • Enums can be quoted or unquoted: campaign.status = 'ENABLED' or = ENABLED.
  • GAQL has no OR: queryError: UNEXPECTED_INPUT.
  • REGEXP_MATCH is not simulated: queryError: BAD_OPERATOR "Not simulated by Mimicr: REGEXP_MATCH".
  • An IN accepts up to 20,000 values. LIMIT 0 gives LIMIT_VALUE_TOO_LOW.

FROM resources

FROMCan also selectMetricsSegments
customer—yes (not in an MCC)date, day_of_week, hour, device, ad_network_type
customer_clientcustomernono
campaign_budgetcustomeryesdates
campaigncampaign_budget, customeryesall, including conversion_action
campaign_criterioncampaign, customernono
ad_groupcampaign, campaign_budget, customeryessame as campaign
ad_group_adad_group, campaign, campaign_budget, customeryessame as campaign
ad_group_criterionad_group, campaign, customernono
keyword_viewad_group, campaign, customeryessame as campaign
conversion_actioncustomernono
asset, campaign_assetcampaign (in campaign_asset), customernono
lead_form_submission_datacustomernono
geo_target_constant, language_constant—nono

Every field of the covered resources can be read, in snake_case (ad_group_ad.policy_summary.approval_status). Google resources outside the table (search_term_view, geographic_view, click_view…) give PROHIBITED_RESOURCE_TYPE_IN_FROM_CLAUSE "(not simulated by Mimicr)". An unknown field gives UNRECOGNIZED_FIELD.

Metrics and segments

Metrics: impressions, clicks, interactions, cost_micros, ctr, average_cpc, average_cost, average_cpm, conversions, conversions_value, all_conversions, all_conversions_value, cost_per_conversion, value_per_conversion and conversions_from_interactions_rate. Others give UNRECOGNIZED_FIELD "(not simulated by Mimicr)".

Segments: date, week, month, quarter, year, day_of_week, hour, device (MOBILE, DESKTOP, TABLET), ad_network_type (SEARCH, SEARCH_PARTNERS), conversion_action and conversion_action_name.

  • With segments, rows where every metric is zero are not returned. Without segments, the resource row is returned even when zero (lifetime totals).
  • Metrics on a manager account (MCC) give queryError: REQUESTED_METRICS_FOR_MANAGER.

Dates

  • Dates are evaluated in the account's time zone, on the sandbox clock.
  • Selecting segments.date, week, month, quarter or year requires a finite date filter in the WHERE clause, otherwise EXPECTED_FILTERS_ON_DATE_RANGE.
  • DURING accepts TODAY, YESTERDAY, LAST_7_DAYS, LAST_14_DAYS, LAST_30_DAYS, LAST_BUSINESS_WEEK, THIS_MONTH, LAST_MONTH, THIS_WEEK_SUN_TODAY, THIS_WEEK_MON_TODAY, LAST_WEEK_SUN_SAT and LAST_WEEK_MON_SUN. LAST_N_DAYS does not include today.
  • Literal dates: '2026-11-05' or '20261105'. segments.week must be a Monday and segments.month the 1st of the month (MISALIGNED_DATE_FOR_FILTER).

Pagination and options

  • Pages have a fixed 10,000 rows. Sending pageSize gives requestError: PAGE_SIZE_NOT_SUPPORTED.
  • nextPageToken appears while there are more pages; send it in pageToken with the same query. A different query gives INVALID_PAGE_TOKEN; in Mimicr, a token older than 2 hours gives EXPIRED_PAGE_TOKEN.
  • searchSettings.returnTotalResultsCount returns totalResultsCount; returnSummaryRow returns summaryRow with the metric totals.
  • validateOnly: true only validates the query and responds {}.

searchStream

The response is a JSON array of batches of up to 10,000 rows (not NDJSON). With summaryRowSetting: SUMMARY_ROW_WITH_RESULTS, the last batch carries summaryRow:

json
[
  { "results": [{ "campaign": { "resourceName": "customers/2220330728/campaigns/54542599977", "id": "54542599977", "name": "Campanha Goiânia" }, "metrics": { "impressions": "702", "clicks": "31", "costMicros": "38440000" } }], "fieldMask": "campaign.id,campaign.name,metrics.impressions,metrics.clicks,metrics.costMicros", "requestId": "5DIgwf8lH1GQfd6kw_7Yj9" },
  { "summaryRow": { "metrics": { "impressions": "702", "clicks": "31", "costMicros": "38440000" } }, "fieldMask": "campaign.id,campaign.name,metrics.impressions,metrics.clicks,metrics.costMicros", "requestId": "5DIgwf8lH1GQfd6kw_7Yj9" }
]

Removed items

Removed campaigns, ad groups and ads still show up in queries, with their metrics, and can be filtered with status = 'REMOVED'. In Mimicr, removed criteria (campaign_criterion, ad_group_criterion) are only returned when the query filters on their status.