---
name: google-ads-anomaly-alert
description: "Every morning: the Google Ads campaigns whose spend, clicks or conversions yesterday sat more than two standard deviations from their 28-day norm. Use when the user asks for this, or when it runs on a schedule."
---

# Google Ads anomaly alert

Every morning: the Google Ads campaigns whose spend, clicks or conversions yesterday sat more than two standard deviations from their 28-day norm.

A bid strategy that runs hot, a broad match keyword that wakes up, a feed error that quietly starves Shopping: in Google Ads these show up as one strange day, and the account overview averages them away. Most people find out at the end of the week, after the money is spent.

This skill compares yesterday with each campaign's own last 28 days, metric by metric, and only speaks up when a number sits well outside its usual spread. It also reads the account's change history for that campaign, so the alert arrives with the likely reason attached instead of a bare "spend is up".

## Two ways to get the data

Use the API or MCP route when you have an MCP server, a CLI or an API token for the app. Otherwise, if you can drive a browser the user is signed in to (Claude in Chrome, a Playwright or Chrome DevTools MCP server), use the browser route. Say which one you used.

## Route A: API or MCP server

### What you need

- Read access to the Google Ads account and its customer ID; through a manager account, its ID as `GOOGLE_ADS_LOGIN_CUSTOMER_ID`.
- Google's read-only Google Ads MCP server (`googleads/google-ads-mcp`), whose `search` tool runs GAQL, or Google Ads API OAuth credentials for a user with Read only access.

If something is missing, say what and stop; do not invent numbers.

### Steps

1. **Pull 29 days of campaign metrics** (Google Ads): Run GAQL with the MCP server's `search` tool or `googleAds:searchStream`: `SELECT campaign.id, campaign.name, segments.date, metrics.cost_micros, metrics.clicks, metrics.impressions, metrics.conversions FROM campaign WHERE campaign.status = 'ENABLED' AND segments.date BETWEEN '<29 days ago>' AND '<yesterday>'`. GAQL leaves out rows where every metric is zero, so fill missing dates with 0.
2. **Build each campaign's baseline**: For each campaign and metric, take the mean and standard deviation of the 28 days before yesterday, and score yesterday as `(yesterday - mean) / sd`. Skip campaigns with fewer than 14 days of data or under $20 of average daily spend; their spread is too noisy to judge.
3. **Keep the anomalies that matter**: Flag a metric when the score is 2 or more either way and the gap is material: at least $50 of spend, 30 clicks or 3 conversions. A spike in spend with flat conversions ranks above a spike in both.
4. **Look for the cause** (Google Ads): For each flagged campaign, query `change_event` (`change_event.change_date_time`, `change_event.change_resource_type`, `change_event.changed_fields`, `change_event.user_email`) for the last two days. It needs a date filter within the past 30 days and a `LIMIT`. Name the change if one lines up.
5. **Ask, or stay quiet**: With anomalies, post an action card: campaign, metric, yesterday against the mean, the score, and any matching change. On a normal day, update the same card with "all campaigns within range" and no question.

## Route B: the browser

### What you need

- Signed in to Google with a user that has at least Read only access to the Google Ads account; through a manager account, pick the client account first.

If something is missing, say what and stop; do not invent numbers.

### Steps

Start at https://ads.google.com/aw/campaigns. The user is signed in already; never type passwords or codes, and ask if a sign-in page appears.

1. **Open the campaigns table for the last 29 days**: In Google Ads, open **Campaigns** and pick the account if more than one is listed. In the date picker, choose **Custom** from 29 days ago to yesterday. Set **Filter** to `Campaign status: Enabled`.
2. **Split the table by day**: Click **Segment** and choose **Time > Day**. Under **Columns**, make sure `Cost`, `Clicks`, `Impr.` and `Conversions` are shown. The table is now one row per campaign per day.
3. **Download instead of scrolling**: With more than a handful of campaigns the segmented table runs to hundreds of rows, so click **Download** and choose `.csv`, then read the file. Days with no activity are missing from the export; treat them as 0.
4. **Score yesterday against the 28 days before**: For each campaign and metric, take the mean and standard deviation of the 28 earlier days and score yesterday as `(yesterday - mean) / sd`. Skip campaigns averaging under $20 a day. Flag scores of 2 or more either way when the gap is at least $50, 30 clicks or 3 conversions.
5. **Check the change history**: For each flagged campaign, open **Campaigns > Change history** (`https://ads.google.com/aw/changehistory`), set the date range to the last 2 days and filter by that campaign. Note the change, who made it and when.

Note: The campaigns table cannot compute a standard deviation, so this route depends on the CSV download. Google Ads attributes conversions to the click date and keeps updating recent days, so yesterday's conversions read low in both routes. The web interface loads fully only on desktop.

## The report

- **Anomalies**: campaign, metric, yesterday's value, the 28-day mean and the score.
- **Likely cause** from the change history, when there is one.
- **Direction**: spending more for the same result, or delivering less than usual.
- The ask: which campaign to look into first.

## Post it to Briefkin

When `BRIEFKIN_TOKEN` is set, or `~/.config/briefkin/env` exists (the installer from https://briefkin.dev/docs writes it), also send the result to the user's Briefkin board as one card. Keep the `item_key` the same on every run so the card updates in place, use a new `event_id` per run, and put today's real numbers in place of the example ones. If the request fails, say so once and carry on.

```bash
[ -n "${BRIEFKIN_TOKEN:-}" ] || . ~/.config/briefkin/env
curl -sS -X POST "${BRIEFKIN_URL:-https://briefkin.dev}/v1/events" \
  -H "authorization: Bearer $BRIEFKIN_TOKEN" \
  -H "content-type: application/json" \
  -d @- <<'JSON'
{
  "v": 1,
  "event_id": "google-ads-anomaly-alert/<date of this run, e.g. 2026-10-16>",
  "item_key": "google-ads-anomaly-alert",
  "project": "Acme Store",
  "source": "Google Ads anomaly alert skill",
  "kind": "action",
  "title": "2 campaigns out of pattern yesterday",
  "summary": "**Brand - Search** spent **$1,240** against a 28-day mean of $410. **Shopping - Bestsellers** recorded **3 conversions** against a usual 19 while clicks held steady.",
  "action": {
    "request": "Brand spend tripled after its bid strategy changed to Maximize clicks at 14:20. Want me to dig into either campaign?",
    "options": [
      "Look into Brand",
      "Look into Shopping",
      "Both",
      "Known, skip today"
    ]
  },
  "widget": [
    {
      "type": "Table",
      "props": {
        "columns": [
          "Campaign",
          "Metric",
          "Yesterday",
          "28-day mean",
          "Score"
        ],
        "align": [
          "left",
          "left",
          "right",
          "right",
          "right"
        ],
        "rows": [
          [
            "Brand - Search",
            "Cost",
            "$1,240",
            "$410",
            "+4.1"
          ],
          [
            "Brand - Search",
            "Clicks",
            1890,
            820,
            "+4.1"
          ],
          [
            "Shopping - Bestsellers",
            "Conversions",
            3,
            19,
            "-2.9"
          ]
        ]
      }
    },
    {
      "type": "Callout",
      "props": {
        "text": "Change history: Brand - Search bid strategy set to Maximize clicks by j.lee@acme.com yesterday at 14:20.",
        "tone": "warn"
      }
    }
  ]
}
JSON
```

Widgets come from the Briefkin catalog (https://briefkin.dev/v1/catalog). Without a token, just give the user the report.

## Run it on a schedule

Suggested: Every day at 9:00 (`0 9 * * *`). From cron, with the agent signed in on that machine:

```bash
0 9 * * * claude -p "Run the google-ads-anomaly-alert skill"
# Codex: codex exec, Gemini CLI: gemini -p, Copilot CLI: copilot -p, OpenCode: opencode run
```

Or use the agent's own scheduler (Claude Code routines, Codex automations, Claude or ChatGPT scheduled tasks): https://briefkin.dev/skills/google-ads-anomaly-alert#schedule

Source: https://briefkin.dev/skills/google-ads-anomaly-alert
