get_meta_anomaly_signal
Detect daily Meta campaign performance anomalies with a rolling-baseline Z-score model, flagging spikes or drops in CTR, CPM, CPC, CPA, spend, and conversions for quick triage.
Instructions
Detects daily anomalies in Meta campaign performance using a rolling-baseline Z-score model — equivalent in intent to Meta's MCP ads_insights_anomaly_signal but computed locally from /insights daily data (no new endpoint). For each campaign × metric (CTR, CPM, CPC, CPA, spend, conversions), evaluates the trailing days against a baseline of the prior baseline_days (default 14). Flags any day with |z| ≥ z_threshold (default 2.0). Severity: |z| ≥ 2× threshold = severe, ≥ 1.5× = moderate, otherwise mild. Direction: spike vs drop. Sorted severity → most-recent → |z|. Use to triage 'something changed yesterday' before doing a full audit.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| metrics | No | Subset of metrics to evaluate. Defaults to all six when omitted. | |
| client_id | No | Client identifier. | |
| z_threshold | No | Absolute Z-score threshold to flag a daily bucket. Default 2.0. Min 1, max 5. | |
| campaign_ids | No | Filter to specific campaign IDs. | |
| baseline_days | No | Rolling baseline window in days. Default 14. Min 7, max 60. | |
| ad_account_ids | No | Override the client's default Meta ad account IDs. | |
| date_range_end | No | YYYY-MM-DD. Defaults to today. | |
| date_range_start | No | YYYY-MM-DD. Defaults to baseline_days + 14 days ago. |