Get a Slack Alert When Website Traffic Suddenly Spikes
Monitor your Google Analytics real-time users and post a Slack alert whenever traffic spikes far above normal, so you can capitalize on viral moments.
- 1
Poll Real-Time Users
Add a
Schedule Triggerrunning every 10 minutes, then anHTTP Requestto the GA4 Realtime API to fetch current active users. - 2
Compare Against a Baseline
Add a
Codenode that keeps a rolling average in n8n static data and computes whether the current count exceeds, say, 2x the baseline. - 3
Filter Real Spikes
Add an
IFnode that only continues when the spike threshold is crossed, avoiding noisy alerts. - 4
Alert in Slack
Add a
Slacknode posting the current user count, the multiple over baseline, and the top active page so the team knows where to look. - 5
Activate and Tune
Activate the workflow and adjust the threshold over a few days until alerts fire only on genuine surges.
Frequently asked questions
Can I include the traffic source?
Yes. Add source/medium as a dimension in the GA4 request so the alert tells you whether the spike is from social, search or referral.
How do I avoid repeated alerts for one spike?
Store a cooldown timestamp in static data and suppress new alerts for 30 minutes after one fires.