Account Anomaly Detector
Compares today’s account performance against the same weekday across previous weeks and alerts when impressions, clicks, conversions, or cost move outside expected bounds.
Script code
Use this when you want a lightweight account-health alerting script based on simple historical baselines rather than a full BI setup.
Preview is public. Unlock full code with name and email.
/**
* ==========================================================
* Account Anomaly Detector
* ==========================================================
* Description: Compares today's cumulative account stats to
* historical weekday averages and alerts on anomalies.
*
* Copyright (c) 2026 TwoSquares. All Rights Reserved.
* Developed by Kiril Ivanov
*/
const CONFIG = {
spreadsheet_url: "YOUR_SPREADSHEET_URL",
reporting_options: { apiVersion: "v22" }
};
// ... preview shortened
}За този script
Account Anomaly Detector is a monitoring script that compares today’s performance against the same weekday across prior weeks to identify unusual drops or spikes. It is useful for surfacing tracking outages, budget issues, feed problems, policy disruption, or unexpected spend behaviour early in the day.
This version is updated from older Google examples to use a current report API version and more consistent metrics handling. It still relies on a spreadsheet-driven configuration model so non-technical users can control thresholds and recipients without editing code frequently.
The logic is intentionally simple: if today’s cumulative stats up to the current hour diverge materially from the historical weekday average, the script records the anomaly and optionally emails a warning. It is not a forecasting system, but it is a practical early-warning layer.
Implementation notes
- Create a copy of your monitoring spreadsheet template and replace YOUR_SPREADSHEET_URL.
- Set threshold cells for impressions, clicks, conversions, cost, number of weeks, and alert email.
- Run the script manually once to validate named ranges and spreadsheet permissions.
- Review output for a few days before trusting alerts operationally.
- Schedule it hourly or at a cadence that matches your account monitoring routine.
Още scripts в библиотеката
Campaign Underspending Alert
Flags campaigns and shared budgets that are underspending against expected budget pace, with support for yesterday or intraday checks.
Broken Final URL Checker
Checks enabled ad and keyword final URLs for 4xx/5xx errors, with optional sheet logging and daily alerting.
Campaign Budget Limited Monitor
Surfaces enabled Search campaigns losing impression share due to budget, with optional sheet output and alerting.
Campaign Name Export
Exports all campaigns with status and channel type into a Google Sheet for quick account documentation and review.
Account Anomaly Detector FAQs
Чести setup, usage и troubleshooting въпроси за този script.