GAQL Script for Intraday Conversion Rate Drop Alerts
Build a custom GAQL script to detect sudden intraday conversion rate collapses across search terms. Includes ready-to-use code, thresholds, and webhook alerts.
By AdTurbo Team · 2026-12-02
A sudden collapse in conversion rate on a top-performing search term can drain thousands of dollars in ad spend before standard daily reporting catches it. Most PPC managers discover conversion anomalies 24 to 48 hours after the damage occurs, when they review daily totals or notice an inflated Cost Per Acquisition (CPA). By querying the Google Ads API using Google Ads Query Language (GAQL) via Google Ads Scripts, you can monitor search term efficiency dynamically and trigger immediate alerts before bad traffic burns your daily budget.
Whether an intraday crash stems from broken landing page tags, checkout gateway errors, broken tracking pixels, or abrupt algorithmic traffic shifts, waiting for an automated bidding strategy to self-correct is a costly mistake. In this technical walkthrough, you will learn how to design, code, test, and deploy a robust GAQL script that identifies sudden intraday conversion collapses and pushes instant alerts to your Slack, Microsoft Teams, or custom webhook.
---
Why Traditional Conversion Alerts Fail During Intraday Collapses
Most account managers rely on native automated rules inside Google Ads or look at historical dashboards once every morning. While this cadence works for macro-level account hygiene, it fails to protect against sudden real-time failures.
The Delay of Standard Daily Reporting
Native Google Ads Automated Rules run on rigid schedules—typically once daily at midnight or early morning. If an e-commerce checkout page crashes at 10:00 AM on a Friday during peak volume, an automated rule scheduled for 1:00 AM Saturday allows 15 hours of unmitigated spend on non-converting traffic. Real-time alerting requires scripts capable of running on hourly cycles, comparing rolling intraday performance against baseline metrics.
Conversion Lag vs. Operational Breakdowns
Smart Bidding handles gradual algorithmic drift, but it cannot differentiate between benign conversion lag (users who click now and convert 6 hours later) and an operational emergency (such as a 500 server error on your payment gateway). Relying on automated rules without statistical baselines results in two extremes: either continuous false-positive alerts caused by natural daytime conversion lag, or total silence while thousands of dollars exit your bank account.
To manage campaigns effectively without monitoring screens 24/7, modern accounts incorporate automated intelligence. Platforms like AdTurbo deploy machine learning agents that continuously evaluate performance fluctuations and apply safeguards in real time. If you run custom code, building your own gaql script conversion rate drop alert is your first line of defense.
---
The Anatomy of a GAQL Query for Search Term Performance
Google Ads Query Language (GAQL) is an SQL-like syntax used to query the Google Ads API and Google Ads Scripts environment (AdsApp.search()). Unlike legacy AWQL (AdWords Query Language), GAQL operates on strict resource schemas, field naming, and segmentation rules.
Core Resources and Attributed Fields
To identify conversion drops at the query level, we primarily query the searchtermview resource. This resource links actual user search queries to campaigns, ad groups, and performance metrics.
Here are the critical fields required for conversion crash detection:
• searchtermview.searchterm: The exact query entered by the user.
• searchtermview.status: Shows whether the query is added, excluded, or none.
• campaign.id & campaign.name: Identifies the parent campaign.
• adgroup.id & adgroup.name: Identifies the ad group context.
• metrics.clicks: Click volume generated by the query.
• metrics.conversions: Recorded conversion actions.
• metrics.conversionsvalue: Total value generated.
• metrics.costmicros: Ad spend represented in micro-units (divide by 1,000,000 for local currency).
• segments.date: Partition dates for baseline and intraday comparisons.
Constructing the Query
A production-ready GAQL query to extract search term performance across today's traffic looks like this:
sql
SELECT
campaign.id,
campaign.name,
adgroup.id,
adgroup.name,
searchtermview.searchterm,
metrics.clicks,
metrics.conversions,
metrics.costmicros
FROM searchtermview
WHERE segments.date = 'TODAY'
AND metrics.clicks = 15
AND campaign.status = 'ENABLED'
AND adgroup.status = 'ENABLED'
ORDER BY metrics.clicks DESC
By filtering for metrics.clicks = 15, we immediately eliminate low-volume search term noise that would otherwise skew conversion percentages and trigger false alarms.
---
Statistical Framework: Distinguishing Normal Variance from a True Collapse
Detecting conversion anomalies requires a clear statistical threshold. A search term that typically converts at 10% can easily experience zero conversions over 10 consecutive clicks without any systemic technical failure. If your script fires an alert on every 10-click dry spell, alert fatigue will quickly render the automation useless.
Normal Variance vs. True Conversion Collapse
Standard Baseline: [100 Clicks] --- 10 Conversions (10.0% CVR)
Normal Dip: [ 15 Clicks] --- 0 Conversions (0.0% CVR) -- Expected Binomial Variance
Severe Anomaly: [ 60 Clicks] --- 0 Conversions (0.0% CVR) -- 99.8% Probability of Failure
Minimum Click Thresholds and Binomial Distribution
Conversion events follow a binomial distribution. Let $p$ equal the historical conversion rate of a search term. The probability $P$ of recording zero conversions over $n$ clicks is given by:
$P(X = 0) = (1 - p)^n$
Consider a top-tier search term with a historical conversion rate of 8% ($p = 0.08$):
• After 15 clicks with 0 conversions: $(1 - 0.08)^{15} = 0.286$ (28.6% probability). This is normal intraday fluctuation.
• After 35 clicks with 0 conversions: $(1 - 0.08)^{35} = 0.054$ (5.4% probability). Borderline anomaly.
• After 60 clicks with 0 conversions: $(1 - 0.08)^{60} = 0.006$ (0.6% probability). Severe anomaly; 99.4% likelihood that something is broken.
Establishing Dynamic Baseline Rules
Rather than applying a flat rule across all search terms, an enterprise-grade alert script calculates each search term's historical baseline over the preceding 30 days and compares it to today's intraday data.
| Historical Search Term CVR | Minimum Intraday Clicks | Intraday CVR Alert Trigger | Alert Priority |
| :--- | :--- | :--- | :--- |
| 12.0% | $\ge 20$ clicks | $0.0\%$ conversions | CRITICAL (P1) |
| 6.0% - 12.0% | $\ge 35$ clicks |
lt; 1.0\%$ conversions | HIGH (P2) || 3.0% - 5.9% | $\ge 50$ clicks |
lt; 0.5\%$ conversions | MEDIUM (P3) || < 3.0% | $\ge 80$ clicks | $0.0\%$ conversions | ELEVATED (P4) |
By enforcing minimum click requirements proportional to baseline conversion rates, your script eliminates false positives while instantly detecting true performance crashes.
---
Complete GAQL Script: Detection and Webhook Dispatcher
Below is the complete, production-ready Google Ads Script. It queries historical performance over the last 30 days (LAST30DAYS) to build a baseline conversion profile for high-volume queries, analyzes today's performance (TODAY), flags sudden intraday conversion collapses, and issues an immediate JSON payload to a webhook URL (compatible with Slack, Zapier, Make, or custom API endpoints).
javascript
/
• Google Ads Script: Intraday Search Term Conversion Collapse Alert
• Monitors high-velocity search queries and triggers webhook alerts
• when conversion rates fall below acceptable statistical tolerances.
/
const CONFIG = {
WEBHOOKURL: 'https://hooks.slack.com/services/YOUR/WEBHOOK/URL',
MINHISTORICALCLICKS: 50,
MININTRADAYCLICKS: 25,
DROPPERCENTAGETHRESHOLD: 0.70, // Triggers if CVR drops by 70% or more
ACCOUNTLABEL: 'Production E-Commerce US',
CURRENCYSYMBOL: '