GA4 Anomaly Detection with Automated Slack & Email Alerts - n8n Workflow | Neura Market

    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 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 `ALERT_ME` 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. ## Where to find your GA4 Property ID - **In the GA UI:** 1. Open **Google Analytics** → bottom-left **Admin** (gear). 2. In the **Property** column, click **Property settings**. 3. Copy **Property ID** - it's a **numeric** value (e.g., `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:** - **Measurement ID** (looks like `G-XXXXXXX`) - that's the data stream ID, **not** the property ID. - **Universal Analytics IDs** (`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. ## How to set up 1. Open the **Set (Define variables)** node and fill: `PROPERTY_ID`, `LOOKBACK_DAYS`, `ALERT_PC`, `Z_THRESHOLD`, `CHANNEL_DIM`, `ALERT_ME`. 2. Connect your **Google Analytics OAuth2**, **Slack**, and **Email** credentials. 3. In **Email Send**, map `Subject` → `{{$json.emailSubject}}` and **HTML** body → `{{$json.emailHtml}}`. Keep **Execute once** enabled. 4. Run the workflow. ## How to customize - Change the moving-average window (`WINDOW/MA_WINDOW`) and chart range (`LAST_N_DAYS_CHART`). - Swap `CHANNEL_DIM` (e.g., source/medium) to analyze different dimensions. - Add/remove metrics in the GA4 request and the metrics list in the Code node. - Tweak thresholds to reduce noise: raise `Z_THRESHOLD` or `ALERT_PC`. ## Output example ![Screenshot 20250826 at 18.32.15.png](fileId:2202)

    Platform
    n8n
    Category
    Data & Analytics
    Price
    Free
    Creator
    Artur
    • if
    • set
    • code
    • gmail
    • slack
    • stickyNote
    • httpRequest
    • scheduleTrigger
    Back to MarketplaceMore n8n Workflows

    How to import this workflow into n8n

    1. 1Purchase or download the workflow to get the n8n workflow JSON file.
    2. 2In your n8n instance, open Workflows and choose "Import from File" (or paste the JSON with Ctrl+V on the canvas).
    3. 3Open each node marked with a credential warning and connect your own accounts and API keys.
    4. 4Run the workflow once manually to verify the data flow, then toggle it to Active.

    Related Data & Analytics workflows

    • Generate AI viral videos with VEO 3 and upload to TikTokFree
    Generate a daily multi-asset market report with TwelveData, Groq and Google Sheets
    Free
  1. Build an OpenAI RAG system with document upload, semantic search and cachingFree
  2. Automate Website Content Scraping and SEO Keyword Extraction with GPT-4o-mini and AirtableFree
  3. Process Contact Form Submissions with Validation and MongoDB StorageFree
  4. Add webhook data to a Google SheetFree
  5. More from Artur

    • Convert Reddit Threads into Short Vertical Videos with AI
    • Connect Pipedrive Deal Outcomes to GA4 & Google Ads via Measurement Protocol
    • Automated Upwork Job Alerts with Airtable & Slack
    All Data & Analytics workflows →All n8n workflows →

    Need help customizing this workflow?

    Our automation experts adapt it to your exact stack, data, and process — or build one from scratch.

    Get a Custom Build
    Neura Market
    Neura Market
    Marketplace
    Directories
    Resources

    Marketplace

    • Prompts
    • Workflows
    • Agents Store
    • Workflow Packs
    • Categories
    • Marketplace

    Directories

    • AI Tools Directory
    • ChatGPT
    • Claude
    • Gemini
    • Cursor
    • Grok
    • DeepSeek
    • Perplexity
    • CoPilot
    • Midjourney
    • Stable Diffusion
    • MCP Servers
    • .md Directory
    • All Directories

    Free Tools

    • AI Text Humanizer
    • AI Content Detector
    • Workflow Generator
    • Model Comparison
    • AI Pricing Calculator
    • AI Benchmarks
    • ROI Calculator
    • All Free Tools

    Resources

    • AI News
    • Blog
    • AI Models
    • Integrations
    • Alternatives
    • n8n vs Zapier
    • Make vs Zapier
    • n8n vs Make
    • Resource Library
    • Documentation

    Community

    • AI Jobs
    • AI Events
    • AI Companies
    • Start Selling
    • Sell n8n Workflows
    • Sell AI Agents
    • Sell Prompts
    • Creator Guide
    • Advertise
    • Affiliates

    Company

    • About
    • Contact
    • Help
    • Careers
    • Pricing
    • Terms
    • Privacy
    • License
    • DMCA

    Stay Updated

    Get the latest AI tools and insights delivered to your inbox.

    Neura Market Logoneuramarket

    © 2026 Neura Market. All rights reserved.