Send weekly GA4 WoW email reports with Gemini AI executive summary

Go to Workflow
0 views
Built by AppStoneLab Technologies LLP AppStoneLab Technologies LLP
Created on June 05, 2026

Description

Weekly Google Analytics 4 Report - Full WoW Tracking & Auto-Generated with Gemini AI

Stop manually building weekly analytics reports. This workflow automatically fetches your GA4 data every Monday morning, generates an AI-written executive summary using Gemini, builds a premium formatted HTML email with deep Week-over-Week (WoW) comparisons for every metric, and delivers it straight to your stakeholders' inboxes — fully hands-free.

👤 Who is this for?

Marketing teams* and *agency owners** who report GA4 metrics weekly to clients
Product managers* and *founders** who want a Monday morning performance digest
Freelancers** managing analytics for multiple clients who want to automate reporting
Anyone who spends 30–60 minutes every week manually pulling GA4 numbers and calculating WoW changes

🚩 What problem does this solve?

Manual GA4 reporting is repetitive, error-prone, and time-consuming. This template eliminates that entirely — every Monday at 8:00 AM in your configured timezone, a fully formatted report lands in your inbox. With the new dual-node architecture, it automatically calculates accurate WoW trends for your overall metrics, specific pages, traffic sources, and more, all contextualized by a Gemini-generated executive summary.

⚙️ What this workflow does

⏰ Triggers every Monday at 8:00 AM via the Schedule Trigger node
📡 Fetches 14 GA4 reports in parallel - pulling both Current Week and Previous Week data simultaneously for speed:
Overview metrics
Top 5 Screens / Pages by views
Top 5 Traffic Sources / Referrals
Top 5 Events by count
Top 5 Countries by sessions
Device breakdown (mobile / desktop / tablet)
New vs Returning users


🔀 Merges all 14 responses and passes the complete historical dataset forward
🤖 Gemini writes a 3-5 bullet point summary analyzing the full WoW dataset to highlight performance trends, audience behaviour, and actionable recommendations
🧮 Code node processes all data - aligns current vs. previous week data, calculates WoW % changes for every single category, handles new/dropped entries, and builds the full inline-CSS HTML email
📧 Sends the report via standard SMTP / Email node to your configured recipients

📧 What the email report includes

Header** - dark luxury card with 4 KPI tiles (Users, Sessions, Bounce Rate, Avg Duration) and WoW arrows
AI Executive Summary** - 3-5 bullet point Gemini-generated insight (hidden automatically if Gemini fails)
Overview Table** - all 5 core metrics with This Week / Last Week / WoW % change pill badges
Audience** - New vs Returning users with visual progress bars and WoW changes
Top Screens** - ranked by views, including previous week values and WoW trend pills. (not set) and (empty) rows are preserved for transparency
Traffic Sources** - top referral channels with WoW changes; direct traffic auto-labelled as Direct / App Open
Top Events** - tracks interaction trends with WoW changes; system events (first_open, os_update, etc.) are filtered out automatically
Geography** - top 5 countries by sessions with WoW comparisons
Devices** - mobile / desktop / tablet with visual progress bars and WoW trend pills

🛠️ Setup Instructions

Step 1 - Google Analytics 4 Credential

Go to n8n Credentials → Add new → search Google Analytics OAuth2
Sign in with the Google account that has access to your GA4 property
Assign this credential to all 14 GA4 nodes

Step 2 - Set your GA4 Property ID

Open each of the 14 GA4 nodes
In the Property ID field, replace {YOUR_PROPERTY_ID} with your GA4 numeric property ID
Find your Property ID at: GA4 Admin → Property Settings → Property ID (looks like 123456789)

Step 3 - Gemini API Credential

Get your free API key at aistudio.google.com
Go to n8n Credentials → Add new → search Google Gemini
Paste your API key and assign it to the Generate AI Summary node

Step 4 - Email / SMTP Credential

Go to n8n Credentials → Add new → search SMTP (or swap the node for Gmail OAuth2 if preferred)
Enter your email host, port, and login credentials
Assign to the Send Weekly Report node

Step 5 - Set Recipients

Open the Send Weekly Report node (or the Code node depending on your mapping preference)
Update the To Email field with your recipient address(es): '[email protected], [email protected]'
Alternatively, update the recipients: line at the bottom of the Build Report & Email HTML Code node.

Step 6 - Set Timezone

Open the Weekly Monday Trigger node
Update the workflow settings to match your local timezone so the 8:00 AM trigger fires correctly.

🔧 How to Customise

Change the schedule** → Open the trigger node, adjust the day and time to any cadence you need (daily, bi-weekly, monthly)
Change the client brand in the footer** → Search for AppStoneLab Technologies in the Code node and replace it with your client or company name
Filter or change events** → In the Code node, find the EXCLUDE_EVENTS array and add/remove event names to control which events appear in the report
Change the AI summary language or tone** → Edit the prompt inside the Generate AI Summary Gemini node to match your client's preferred reporting style

📦 Requirements

| Service | Purpose | Free Tier Available |
| --- | --- | --- |
| Google Analytics 4 | Source of all report data | ✅ Yes |
| Google Gemini API | AI executive summary generation | ✅ Yes (via AI Studio) |
| SMTP / Email | Email delivery | ✅ Yes |

⚠️ Notes

Mobile app properties** - If your GA4 property tracks a mobile app, the workflow uses unifiedScreenName instead of pagePath, which works correctly for both web and app properties
WoW calculations** - Bounce rate change is intentionally inverted (a decrease is shown as positive/green). If a metric like a specific page or country is new this week, the workflow dynamically tags it as "New" instead of breaking the calculation.
Gemini failure handling** - If the Gemini node fails for any reason, the AI summary section is automatically hidden and the rest of the report sends normally
Execute Once** - All 14 GA4 nodes have Execute Once enabled to prevent duplicate rows from the merge operation

Nodes Used (4)

Code
n8n-nodes-base.code
Google Analytics
n8n-nodes-base.googleAnalytics
Google Gemini
@n8n/n8n-nodes-langchain.googleGemini
Send Email
n8n-nodes-base.emailSend