Daily GA4 anomaly alerts in Slack with Search Console

By General Input

Every weekday at 8am, scan yesterday's GA4 traffic against a 28-day baseline and post a ranked Slack alert when channels or pages move sharply. Silent otherwise.

Integrations

  • Google Analytics
  • Google Search Console
  • Slack

Type

Agentic Task

Categories

  • Marketing
  • Operations

Build me an agent workflow that watches my Google Analytics 4 property every weekday morning and only pings Slack when something is meaningfully off. It should be silent by default and stay out of my channel on normal days.

Trigger: cron, every weekday (Monday through Friday) at 8am in my local timezone. Expose the time and timezone as user-editable inputs.

Step 1. Pull yesterday's traffic from Google Analytics 4 using Batch Run Reports for my configured GA4 property. I want two breakdowns in one batch: (a) sessions, conversions, and total revenue by default channel grouping, and (b) the same metrics by landing page plus hostname for the top 50 landing pages by sessions. Date range is yesterday in the property's timezone.

Step 2. In the same Batch Run Reports call (or a second one if needed), pull a 28-day prior baseline for the exact same dimensions and metrics, ending the day before yesterday. Compute the trailing daily average per channel and per landing page so seasonality and growth are baked in.

Step 3. For each channel and each top landing page, compare yesterday's number to its 28-day average. Flag it as an anomaly if it moves outside the configured thresholds AND clears a minimum-volume floor so dead pages do not spam alerts. Pick reasonable defaults but expose them as user-editable inputs: percent_down_threshold default 30, percent_up_threshold default 50, min_sessions_floor default 50 sessions per day, baseline_window_days default 28.

Step 4. If any flagged anomaly is on the Organic Search channel (or on a landing page where the bulk of yesterday's traffic came from Organic Search), call Google Search Console Search Analytics Query for the same yesterday vs prior 28-day window, scoped to the affected URLs. Pull clicks, impressions, CTR, and average position. Use the deltas to decide the likely diagnosis: a real ranking drop (position got worse, impressions down), a tracking break (Search Console clicks steady but GA4 sessions dropped), a CTR collapse (impressions steady, clicks down), or a genuine demand shift.

Step 5. If there is at least one real anomaly, post one Slack message via Send a Message to the configured Slack channel. Format it as a short ranked list, biggest move first, with one line per anomaly: which channel or page, the metric, yesterday vs the 28-day average with percent change and absolute numbers, the agent's best diagnosis, and a one-line suggested next step (for example check pixel firing, review recent publish, confirm campaign budget). Keep the whole message tight enough to read on a phone.

Step 6. If nothing clears the thresholds, do not post anything. No 'all green' message, no heartbeat, no daily noise. Silent is the success state.

User-editable inputs to expose at the top of the workflow: ga4_property_id, search_console_site_url, slack_channel, percent_down_threshold, percent_up_threshold, min_sessions_floor, baseline_window_days, run_time, timezone, optional slack_mention for who to ping on a critical drop.

Important: GA4 data lags a few hours and Search Console lags 2 to 3 days, so when comparing GA4 'yesterday' against Search Console, the agent should account for Search Console's freshness window when forming the diagnosis (note it in the alert if Search Console data is not yet complete for the relevant day).

Related prompts

Explore more prompts
Call overdue Xero customers with an AI collections agentWin back LiveChat visitors whose chats went unansweredChat quality review board for LiveChat support leadsWin back no-show and cancelled appointments every morningLive Loop returns analytics with product-level drill-downNewsletter pre-flight and approval board for Mailjet sendsTurn a prospect spreadsheet into personalized sequence enrollmentsMailjet email delivery lookup console for support teamsCatch feature flags that never got switched on in productionKajabi customer support console for member access fixes