---
title: "Your GA4 Dashboard Won't Tell You When Tracking Breaks. A BigQuery Query Will."
description: "Dashboards show you problems after someone notices them. A scheduled BigQuery query can score yesterday's events against a 28 day baseline and post broken tags to Slack before your weekly report does."
author: LETSGROW Dev Team
date: 2026-11-09
category: Analytics
tags: ["GA4", "BigQuery", "Anomaly Detection", "Analytics Engineering", "Slack Alerts"]
url: "https://letsgrow.dev/blog/ga4-anomaly-alerts-bigquery-scheduled-query"
---
Your GA4 dashboard is not an alerting system. It is a place where you discover on Thursday that purchases dropped to zero on Monday. If the first person to notice a broken tag is the CEO looking at a weekly report, your measurement stack has no immune system.

The fix does not require a paid monitoring vendor. If you already export GA4 to BigQuery, a single scheduled query can compare yesterday against a trailing baseline, flag the outliers, and post to Slack. It takes about an hour to build and it will pay for itself the first time a deploy silently breaks your checkout event.

## Why Dashboards and Built-In Insights Fail

GA4 ships with automated insights, and they are fine for curiosity. They are not fine for operations. They fire on their own schedule, you cannot tune the threshold per event, and they say nothing about the thing that actually hurts: an event that stopped arriving at all.

Three failure patterns cause most of the damage:

- **Tag regressions.** A release renames a button or removes a data layer push, and a key event drops to zero while pageviews look healthy.
- **Consent and CMP changes.** A banner update shifts the opt-in rate, and sessions fall 30 percent with no change in real demand.
- **Upstream traffic shifts.** A bot wave, a referral spam burst, or a paid campaign pause moves volume in ways that look like performance changes.

None of these show up as a red number in a dashboard. They show up as a quiet slide that someone has to notice. Detection has to be automated, and it has to be about deviation from expectation, not absolute thresholds.

::stat-block
title: "What a Basic Detector Catches"
stats:
  - value: "1 query"
    label: "scheduled daily in BigQuery"
  - value: "28 days"
    label: "trailing baseline window"
  - value: "3 sigma"
    label: "starting alert threshold"
  - value: "Under 1 hour"
    label: "typical build time"
::

## The Pattern: Baseline, Score, Alert

The detector has three parts, and each is plain SQL.

**Baseline.** For each event name, compute the daily count over the last 28 days, excluding yesterday. Calculate the mean and standard deviation. Do it by day of week if your traffic is seasonal, because a Sunday compared to a Wednesday is a false alarm waiting to happen.

**Score.** Compare yesterday's count to the baseline and compute a z-score: yesterday minus the mean, divided by the standard deviation. A score below -3 means the event dropped far more than normal variation explains. A score above 3 means a spike worth a look, which is often bot traffic or a double-firing tag.

**Alert.** Write rows that cross the threshold to a small results table, then have the scheduled query's destination or a Cloud Function push them to Slack with the event name, yesterday's count, the expected range, and a link to the relevant dashboard.

The query itself is short. Read from your events_ table using a date filter, group by event_name and event_date, then use window functions over a 28 row frame to get the mean and standard deviation. Filter to your handful of revenue critical events first: purchase, generate_lead, sign_up, begin_checkout. Monitoring forty events creates noise. Monitoring five creates trust.

Also include a zero check. A z-score is useless when the baseline itself is tiny, so add a rule that any critical event with a nonzero trailing average and a count of zero yesterday alerts immediately, regardless of statistics.

::compare-table
title: "Detection Approaches Compared"
columns: ["Approach", "Per-event tuning", "Catches zero events", "Cost", "Setup effort"]
rows:
  - ["GA4 automated insights", "No", "Unreliable", "Free", "None"]
  - ["Fixed threshold in a dashboard", "Manual", "Only if you set it", "Free", "Low"]
  - ["Scheduled BigQuery z-score query", "Yes", "Yes, with a zero rule", "Pennies per run", "About an hour"]
  - ["BigQuery ML ARIMA_PLUS detection", "Automatic", "Yes", "Low, model training cost", "A few hours"]
  - ["Paid observability vendor", "Yes", "Yes", "Subscription", "Medium"]
::

## Tune It Before You Trust It

The first week will be noisy, and that is normal. Treat it as calibration, not failure.

Start with a threshold of 3 sigma and review every alert for seven days. For each one, write down whether it was real. If weekends keep triggering, switch the baseline to same weekday comparisons. If low volume events keep flapping, require a minimum baseline count before scoring them. If a known campaign launch causes a legitimate spike, add an annotation table the query can join against so planned changes stay quiet.

When you outgrow the manual approach, BigQuery ML offers ARIMA_PLUS with built-in anomaly detection that handles seasonality and holidays for you. It is a sensible second step, not a first one. Learn what your normal looks like with simple statistics before you hand the job to a model you cannot easily explain to a stakeholder.

Whatever you build, route alerts to a channel with an owner. An alert nobody is responsible for is just another notification to mute. Assign a named person per event family, and have them acknowledge within the business day.

::checklist
title: "Anomaly Alerting Launch Checklist"
items:
  - "GA4 BigQuery export is running daily and verified"
  - "Five or fewer revenue critical events selected"
  - "28 day baseline excludes yesterday and respects day of week"
  - "Zero count rule added for events with a nonzero average"
  - "Alerts post to a Slack channel with a named owner"
  - "Seven day calibration review scheduled"
  - "Planned launches logged in an annotation table"
::

## Build It This Week

Do not wait for a measurement outage to justify this. Pick your three most valuable events, write the baseline query, and schedule it for 7 a.m. daily. Post results to Slack, even if the first version is ugly. Next week, add the zero rule. The week after, add day of week baselines.

The goal is not statistical elegance. The goal is that the next time a tag breaks, you hear about it from a bot message the following morning instead of from a confused executive three days later.