Log in / Create free account🌐 ES☀️

Advanced training · Module 8 — GAQL and the API — reading what the interface does not show

What GAQL is: the language you use to ask Google Ads what the interface does not show

⏱️ 9 min read · 🥷 Scripts 📐 Measurement · updated on 2026-09-02

🎧 Listen to the lesson · ≈ 4 min🔒 Subscribers only

In short: GAQL is the language you use to ask the Google Ads API questions: SELECT fields and metrics FROM a resource WHERE conditions. The interface is just a view of the same thing. It does three things the screen doesn't: cross-referencing, volume and your own history. It changes nothing and cannot show what Google doesn't expose.

This whole course has kept repeating that "the scripts read through GAQL what the interface hides". This module explains what that means, so you know which questions you can ask Google Ads, how they are phrased and what their limits are — with no programming needed. What you learn here will help you ask for better data, audit a script and understand where every figure in a sheet comes from.

What is GAQL?

GAQL (Google Ads Query Language) is the query language of the Google Ads API: the way to tell Google "give me these columns, from this table, with these conditions". It looks like the SQL used in databases and it reads almost like plain English:

SELECT campaign.name, metrics.cost_micros, metrics.conversions
FROM campaign
WHERE segments.date DURING LAST_30_DAYS
ORDER BY metrics.cost_micros DESC

"Give me the name, the cost and the conversions of every campaign over the last 30 days, sorted by cost."

Why does GAQL exist?

The Google Ads interface is a view of the data; the API is access to the data. Everything the interface shows comes from the API (plus a bit more that the interface does not show, or shows aggregated, or takes a while to show). GAQL is the language for asking for it directly: from a script, from a tool, from a report of your own.

What is the difference between GAQL and the interface?

Concept In the interface In GAQL
Resource (table) Tabs: Campaigns, Ad groups, Keywords, Search terms… campaign, ad_group, keyword_view, search_term_view, shopping_performance_view, detail_placement_view… (dozens)
Field (attribute) Text columns: name, status, type campaign.name, campaign.status, campaign.id, ad_group_criterion.keyword.text
Metric Numeric columns metrics.clicks, metrics.cost_micros (in millionths), metrics.conversions, metrics.search_impression_share
Segment The "Segment" button segments.date, segments.device, segments.ad_network_type, segments.conversion_action_name
Filter The funnel icon WHERE campaign.status = 'ENABLED' AND metrics.clicks > 100

Everything has a name and a type; there is no ambiguity. And every resource documents which fields, metrics and segments it accepts.

Where do GAQL queries run?

What does GAQL allow that the interface doesn't?

  1. Joins the interface does not offer: search terms with their keyword, their match type, their ad group, their campaign and their conversions by action, all in a single table; PMax placements; hour-of-day and day-of-week statistics per campaign; Quality Score components per keyword with daily history if you store it.
  2. Volume: thousands of rows every night, with no manual paging and no exporting.
  3. Your own history: the interface shows today's state; a script that queries through GAQL every day and stores the result builds the time series Google does not give you (daily QS, daily IS, ad asset performance across months).

What can't GAQL do?

💡 Ninja trick: the house rule at Ninja Scripts for GAQL is the one that prevents the most errors: if a field is in the WHERE, it is also in the SELECT, and campaigns and ad groups are identified by campaign.id and ad_group.id, never by name (names change and break the joins). If you ever read a script's query, those two things tell you whether whoever wrote it knew what they were doing.

What you should remember

📎 Sources and further reading

⚠️ Free training with no support. Ninja Scripts support channels (email and Telegram) are only for the use of the scripts, not for Google Ads questions or questions about this training.

Pick up here

After →Anatomy of a GAQL query: clauses, operators, dates, micros and the rules that get you rejectedGAQL and the API — reading what the interface does not showRelacionadaLead quality: scoring every contact and teaching Google the difference between a customer and a browserMeasurement II — offline conversions, values, GA4, attribution and lead qualityRelacionadaAuditing your tracking: the routine that tells you your data is trustworthyBasic measurement — conversions, the Google tag and consentRelacionadaOffline conversions: telling Google what happens after the formMeasurement II — offline conversions, values, GA4, attribution and lead qualityRelacionadaThe judge: judging each campaign by its business target, not by the strategy targetSmart Bidding I — strategies, portfolios, learning and the target judge

Ver el temario completo

🎓
You're reading the Ninja Academy in the open

Create your free account (no card) to save your progress, take the graded quizzes, earn the Basic level certificate and unlock part of the Intermediate and Advanced training.

Create my free account →
🥷

Subscriber feature

This option is part of the Ninja Scripts Suite subscription.

See the subscription →