Back to Home
Automation

How to Build a Weekly Google Analytics Report That Posts to Google Chat with n8n

Mark Borden
March 3, 2026
10 min read

Tired of manually pulling analytics every Monday? This walkthrough shows you how to build an n8n workflow that automatically fetches your Google Analytics data, compares it week-over-week, and posts a rich summary card to Google Chat. Every Monday at 9 AM, hands-free.

Download the Workflow
Import this JSON file directly into n8n. Configure your credentials and you're live.
Download .json

What the Workflow Does

Every Monday morning, this workflow:

  1. Pulls this week's GA4 metrics (users, sessions, page views, bounce rate, engagement rate)
  2. Pulls the previous week's metrics for comparison
  3. Grabs your top 5 traffic sources
  4. Merges all three data streams together
  5. Runs JavaScript to calculate percentage changes and build a rich card
  6. Posts the card to Google Chat via webhook
Workflow Architecture
                      ┌─────────────────┐
                 ┌───►│ GA4 This Week   │───┐
                 │    └─────────────────┘   │
┌──────────┐    │    ┌─────────────────┐   │    ┌───────┐    ┌────────────────┐    ┌──────────────┐
│ Weekly   │────┼───►│ GA4 Last Week   │───┼───►│ Merge │───►│ Build Chat Card│───►│ HTTP Request │
│ Schedule │    │    └─────────────────┘   │    └───────┘    └────────────────┘    │ (Chat API)   │
│ Mon 9 AM │    │    ┌─────────────────┐   │                                      └──────────────┘
└──────────┘    └───►│ GA4 Top Sources │───┘
                     └─────────────────┘

The workflow has 7 nodes total. Let's walk through each one.


Prerequisites

Before you start, make sure you have: an n8n instance running (cloud or self-hosted), a GA4 property with traffic data, Google Analytics OAuth2 credentials configured in n8n, and a Google Chat space with a webhook URL.


Step 1: Import the Workflow

  1. Open your n8n instance
  2. Go to the Overview page where you can see all your workflows
  3. Click Create workflow (top-right corner)
  4. Import the workflow JSON using the menu (⋮ → Import from File)
n8n overview page showing the workflows list with a Create workflow button in the top-right corner
Your n8n overview page showing all workflows. Click "Create workflow" to start.

Step 2: The Full Workflow Canvas

After importing, you'll see all 7 nodes laid out on the canvas, connected in order:

Weekly Schedule → GA4 This Week / GA4 Last Week / GA4 Top Sources → Merge → Build Chat Card → HTTP Request

The complete n8n workflow canvas showing all 7 nodes connected: Schedule Trigger, three GA4 query nodes running in parallel, Merge, Build Chat Card, and HTTP Request
The complete workflow. The Schedule Trigger fires on Monday, three GA4 queries run in parallel, data is merged, transformed into a card, and posted to Google Chat.

Step 3: Configure the Schedule Trigger

Double-click the Weekly Schedule node to open its settings. This node controls when the workflow runs:

  • Trigger Interval: Weeks
  • Weeks Between Triggers: 1
  • Trigger on Weekdays: Monday
  • Trigger at Hour: 9am
  • Trigger at Minute: 0

You can adjust these to suit your needs. Change the day, time, or frequency.

Schedule Trigger node configuration showing weekly interval, Monday, 9am
The Schedule Trigger set to fire every Monday at 9:00 AM.

Step 4: GA4 This Week (Current Period) Metrics

Double-click GA4 This Week to see its configuration. This node fetches your current week's analytics:

  • Credential: Your Google Analytics OAuth2 account
  • Resource: Report
  • Operation: Get
  • Property Type: Google Analytics 4
  • Property: Select your GA4 property from the dropdown
  • Date Range: Last 7 Days
  • Metrics: Total Users, Sessions, Page Views, Session Duration
GA4 This Week node configuration showing Report resource, Get operation, Google Analytics 4 property type, Last 7 Days date range, and metrics including Total Users, Sessions, Page Views, and Session Duration
GA4 This Week pulls the current 7-day window of metrics from your property.

Step 5: GA4 Last Week (Previous Period) for Comparison

The GA4 Last Week node is nearly identical but fetches the previous week's data so the Code node can calculate percentage changes.

Key differences:

  • Date Range: Custom (set to the 7-day window before "this week")
  • Start / End: Dynamically calculated to cover the previous 7-day period
  • Metrics: Same as GA4 This Week: Total Users, Sessions, etc.

This gives you the baseline to compare against.

GA4 Last Week node configuration showing Custom date range with dynamic start and end dates for the previous week period
GA4 Last Week fetches the previous period for week-over-week comparison.

Step 6: GA4 Top Sources: Where Traffic Comes From

The GA4 Top Sources node adds context by showing where your visitors are coming from.

  • Date Range: Last 7 Days
  • Metric: Sessions
  • Dimension: Source / Medium (e.g., "google / organic", "direct / none")
  • Return All: Off (limited to top results)
  • Sorted descending by session count
GA4 Top Sources node configuration showing Sessions metric, Source/Medium dimension, sorted descending by session count
GA4 Top Sources breaks down traffic by source/medium for the top traffic channels.

Step 7: The Merge Node: Combining Data Streams

Since the three GA4 nodes run in parallel, the Merge node combines their outputs into a single data stream for the Code node.

  • Mode: Append
  • Number of Inputs: 3 (one for each GA4 node)

The left panel shows all three inputs: GA4 This Week (Input 1), GA4 Last Week (Input 2), GA4 Top Sources (Input 3).

Merge node set to Append mode with 3 inputs, showing GA4 This Week, GA4 Last Week, and GA4 Top Sources as inputs
The Merge node set to Append mode, combining all 3 GA4 data streams.

Step 8: Build Chat Card (The JavaScript Engine)

This is where the magic happens. The Build Chat Card node is a Code node running JavaScript that:

  1. Pulls data from all three GA4 nodes using $('GA4 This Week').all()
  2. Aggregates daily data into weekly totals (users, sessions, page views)
  3. Calculates weighted averages for rates (bounce rate, engagement rate)
  4. Computes week-over-week percentage changes
  5. Builds a Google Chat Card V2 JSON structure with an overview section, engagement section, and top traffic sources
Build Chat Card Code node showing JavaScript that aggregates GA4 data from all three nodes and builds a Google Chat card V2 JSON structure
The Code node showing the JavaScript that aggregates GA4 data and builds the Google Chat card.
How the Code Works

The JavaScript uses n8n's $() function to reference data from other nodes by name. It calculates percentage change with a simple helper function, formats numbers with toLocaleString(), and outputs the entire card as a single JSON object that the HTTP Request node sends directly to the Google Chat API.


Step 9: HTTP Request (Posting to Google Chat)

The final node sends the formatted card to Google Chat using a webhook URL.

  • Method: POST
  • URL: Your Google Chat space webhook URL
  • Body Content Type: JSON
  • JSON Body: {{ JSON.stringify($json) }}, which passes the card structure built by the Code node

How to get your Google Chat webhook URL

  1. Open Google Chat
  2. Go to the space where you want reports posted
  3. Click the space name → Apps & IntegrationsWebhooks
  4. Click Create webhook, give it a name, and copy the URL
  5. Paste it into the URL field in n8n
HTTP Request node configured to POST JSON to a Google Chat webhook URL, with Body Content Type set to JSON and the expression passing the card structure
The HTTP Request node configured to POST the card JSON to your Google Chat webhook.

Step 10: Activate the Workflow

Once everything is configured:

  1. Click Execute workflow (bottom center) to test it manually
  2. Check your Google Chat space. You should see the analytics card appear
  3. When satisfied, click Publish (top-right) to make it live

The workflow will now run automatically every Monday at 9 AM.

n8n workflow canvas showing the Publish button in the top-right and the Execute workflow button at the bottom center
The canvas view showing the Publish button and workflow controls in the top-right.

The End Result

Every Monday morning, your Google Chat space will receive a rich card that looks something like this:

Google Chat Card
┌──────────────────────────────────────┐
│  Weekly Analytics Report             │
│  Feb 24 - Mar 2, 2026               │
│──────────────────────────────────────│
│  OVERVIEW                            │
│  Active Users    1,234    +12.5%     │
│  Sessions        2,345    -2.1%      │
│  Page Views      5,678    +15.7%     │
│──────────────────────────────────────│
│  ENGAGEMENT                          │
│  Bounce Rate     42.3%              │
│  Engagement Rate 57.7%              │
│──────────────────────────────────────│
│  TOP TRAFFIC SOURCES                 │
│  1. google / organic    890 sessions │
│  2. direct / none       456 sessions │
│  3. twitter / social    234 sessions │
└──────────────────────────────────────┘

No more manual reporting. No more Monday morning spreadsheet pulls. Just automate it and move on with your week.

Download the Workflow
Import this JSON file directly into n8n. Configure your credentials and you're live.
Download .json
n8n Google Analytics GA4 Google Chat Automation Workflows
Mark Borden
Mark Borden

CTO & Technology Consultant. Building the systems behind 10x faster eLearning at KnowledgeNow.

Want More Workflows Like This?

Get In Touch