Python CLI
# Run via google-ads-agents CLI
python scripts/gads_anomalies.py \
--customer 123-456-7890 \
--days 30 \
--baseline-days 14 \
--z 2 \
--jsonHow it works
- Calculates mean and standard deviation for key metrics (Spend, CTR, CPC, Conversions) over a 14-day rolling window.
- Computes Z-score distance from historical baseline.
- Flags any date where the Z-score exceeds 2.0 (statistically significant anomaly at p < 0.05).
Step-by-step installation
- Clone repository: git clone https://github.com/arcbaslow/google-ads-agents
- Install dependencies: uv pip install -r scripts/requirements.txt
- Authenticate: python scripts/gads_auth.py --adc
- Run the anomaly command with your customer ID.
Frequently asked questions
Can this run in CI?
Pass --json and it writes machine-readable output to stdout, which is enough for a GitHub Actions step or a cron job to parse.