Automate Google Analytics Reporting with n8n Workflow

This n8n workflow automates weekly Google Analytics reporting by aggregating page engagement, country views, and search console data. Save hours of manual reporting by automatically generating and emailing detailed comparative reports.
googleAnalytics
code
gmail
+4
Workflow Identifier: 2052
NODES in Use: Manual Trigger, Sticky Note, Google Analytics, Code, Set, Schedule Trigger, Gmail
Automate Google Analytics with n8n and Gmail

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What This Workflow Does

This workflow automatically collects Google Analytics and Google Search Console data every week.
It saves time by removing manual report making.
It fetches page engagement, search clicks, and country user stats.
It compares current week and prior week data.
Finally, it sends a clear HTML report by email.

The goal is to save hours of work and stop mistakes from manual data copying.


Who Should Use This Workflow

People managing Google Analytics data for marketing or business reporting benefit most.
Users who want accurate, repeated weekly reports without doing extra work will find this helpful.


Tools and Services Used

  • Google Analytics API: Provides page engagement and country-level data.
  • Google Search Console data: Accessed via Google Analytics for search metrics.
  • n8n automation platform: Runs the workflow and handles data processing.
  • Gmail API with OAuth2: Sends the weekly email report securely.

Beginner Step-by-Step: How to Use This Workflow in n8n

Step 1: Import the Workflow

  1. Download the workflow file by clicking the Download button on this page.
  2. Go to the n8n editor where you want to run this automation.
  3. Use “Import from File” option in n8n to load the downloaded workflow.

Step 2: Configure Required Settings

  1. Add your Google Analytics OAuth2 credentials in n8n.
  2. Add Gmail OAuth2 credentials in n8n for email sending.
  3. Look through Google Analytics nodes and update the Property ID if different from default.
  4. Change email recipient address in the Gmail node to who should get reports.

Step 3: Test the Workflow

  1. Run the workflow manually using the Manual Trigger to check data pulls and email output.

Step 4: Activate for Production

  1. Enable the workflow in n8n and, if scheduled, make sure the Schedule Trigger is activated.
  2. Check regularly that the workflow runs without errors.

For users running on own servers, consider reliable self-host n8n options.


Inputs, Processing, and Outputs

Inputs

  • Google Analytics property ID.
  • OAuth2 credentials for Google Analytics and Gmail APIs.
  • Scheduled trigger or manual trigger to start workflow.

Processing Steps

  • Pull current week’s page engagement, search clicks, and country stats from Google Analytics API.
  • Pull prior week’s matching data with adjusted date ranges.
  • Use multiple Code nodes to parse raw API JSON data into simple, clean JSON arrays.
  • Collect all parsed data strings in a Set node for aggregation.
  • Decode, parse, and merge the JSON strings into one combined data object for easier use.
  • Format the full data object into color-coded HTML tables with inline CSS styling in a Code node.

Outputs

  • An email sent via the Gmail node with the full HTML report to specified recipient(s).

Edge Cases and Common Problems

  • If Google Analytics data is missing or empty, the parsing Code nodes might fail. Fix by checking if the configured property ID and date ranges are correct.
  • Google API limits may cause incomplete data. Retry after waiting or check API quota.
  • The Gmail sending node may fail if OAuth2 credentials are not authorized properly. Refresh or reauthenticate tokens.
  • Schedule triggers must be enabled and workflows activated to run automatically.

Customization Ideas

  • Change how often reports run by adjusting the Schedule Trigger.
  • Add or remove metrics in Google Analytics nodes’ metric fields to get different insights.
  • Update recipient emails to notify different or multiple users in the Gmail node.
  • Tweak report HTML and CSS styling inside the formatting Code node to change colors or layout.
  • Swap out the hardcoded Google Analytics property ID for other accounts as needed.

Summary and Final Results

✓ Saves 3 to 5 hours weekly by automating Google Analytics data fetching and reporting.
✓ Removes errors from manual copying and formatting of analytics data.
✓ Delivers easy to read, color-coded weekly reports by email automatically.
✓ Compares current week vs prior week on page engagement, search data, and user country stats.
✓ Lets users focus on analysis and decisions instead of report making.


Automate Google Analytics with n8n and Gmail

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

The workflow uses Google Analytics nodes with date ranges set for current week and prior week. It pulls metrics separately for each week.
The workflow requires Google Analytics OAuth2 credentials for data access and Gmail OAuth2 credentials for sending emails.
Yes, the recipient email can be updated directly in the Gmail node parameters after importing the workflow.
Make sure the Schedule Trigger node is active, the workflow is activated and saved in n8n. Check schedule configuration matches intended timing.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.