Teams that monitor traffic, signups, or conversions in Google Analytics 4 and want automatic Slack/email alerts when a channel suddenly spikes or drops.
This n8n template pulls daily GA4 metrics, detects outliers with a rolling mean and z-score, and sends alerts with a sparkline chart. It supports per-channel analysis (e.g., sessionDefaultChannelGroup
) and consolidates multiple anomalies into a single email while posting each one to Slack.
sessions
, newUsers
, conversions
, bounceRate
by date
+ channel.alert === true
and optional ALERT_ME
toggle.In the GA UI:
481356553
).From the URL (quick way):
When you’re inside the GA4 property, the URL looks like:
…/analytics/web/#/p123456789/…
→ the digits after p
are your Property ID (123456789
in this example).
What not to use:
G-XXXXXXX
) — that’s the data stream ID, not the property ID.UA-XXXXX-Y
) — those are legacy and won’t work with GA4 Data API.In this template:
Put that numeric ID into the Set → PROPERTY_ID
field. The HTTP node path properties/{{ $json.PROPERTY_ID }}:runReport
expects only the number, no prefixes.
PROPERTY_ID
, LOOKBACK_DAYS
, ALERT_PCT
, Z_THRESHOLD
, CHANNEL_DIM
, ALERT_ME
.Subject
→ {{$json.emailSubject}}
and HTML body → {{$json.emailHtml}}
. Keep Execute once enabled.WINDOW/MA_WINDOW
) and chart range (LAST_N_DAYS_CHART
).CHANNEL_DIM
(e.g., source/medium) to analyze different dimensions.Z_THRESHOLD
or ALERT_PCT
.