workflows.fit
Back to n8n workflows
n8n template$5By Artur

Ga4 anomaly detection with automated Slack & email alerts

Who’s it for Teams that monitor traffic, signups, or conversions in Google Analytics 4 and want automatic Slack/email alerts when a channel suddenly spikes or drops. What it does This n8n template pulls daily GA4 metr...

DevelopmentCore NodesCommunicationHITLCodeSetHttp RequestSticky Note
Open checkout
Loading interactive preview...

Template notes

Who’s it for

Teams that monitor traffic, signups, or conversions in Google Analytics 4 and want automatic Slack/email alerts when a channel suddenly spikes or drops.

What it does

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.

How it works

HTTP Request (GA4 Data API) fetches sessions, newUsers, conversions, bounceRate by date + channel. Code calculates 7-day moving average and z-scores, flags anomalies, and builds QuickChart links. If filters on alert === true and optional ALERTME toggle. Slack posts an alert + chart. Email sends one summary email (subject + HTML table + charts).

Requirements

GA4 OAuth2 credential in n8n. Slack API credential (bot with chat\:write). Email credential (SMTP or service). GA4 property ID and at least several recent days of data.