Automated Google Analytics Reporting and AI-Powered SEO Analysis using Baserow - n8n Workflow

Analyze Google Analytics data weekly using an n8n workflow. Extract page engagement, search console, and country data, utilize OpenRouter AI for SEO insights, and save reports to Baserow. Get started with n8n templates.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

SEO Specialists: Users needing automated, weekly comparisons of key performance indicators (KPIs) to quickly identify trends.
Digital Marketers: Professionals looking to leverage large language models (LLMs) to generate actionable insights from raw traffic data.
Data Analysts: Individuals seeking a repeatable n8n automation for processing and structuring complex Google Analytics 4 (GA4) reports.
n8n Users: Developers looking for advanced n8n templates involving complex data transformation via the Code n8n node and external AI APIs.

Overview

Manually comparing weekly Google Analytics data can be tedious and time-consuming. This specialized n8n workflow solves this by fully automating the extraction, comparison, and analysis process. It leverages the power of n8n to connect Google Analytics 4 (GA4) with a sophisticated AI model (via OpenRouter) to generate executive summaries, markdown tables detailing changes between the last two weeks, and five specific SEO improvement suggestions. By implementing this n8n automation, users gain instant, data-driven, and highly readable reports saved directly into Baserow, turning raw data into strategic direction. This robust n8n workflow is a perfect example of how powerful custom n8n templates can streamline business intelligence.

How it Works

The entire n8n workflow is designed to run automatically via a weekly n8n trigger or manually for testing:


  1. Trigger: The process initiates using the 'Schedule Trigger' n8n trigger, configured to run weekly, or manually via the 'When clicking ‘Test workflow’' n8n trigger.

  2. Data Retrieval: The workflow simultaneously extracts three key datasets from Google Analytics (GA4) for both the current week and the prior week (7 days vs. 7 days):

Page engagement statistics.
Google Search Console metrics (clicks, impressions, average position).
* Country-level views and user metrics.

  1. Data Preparation (Code n8n node): The JSON output from the Google Analytics n8n node is complex. Multiple 'Code' n8n node instances are used to parse, simplify, and URL-encode the data. This transformation ensures the large dataset can be reliably passed as a single string argument within the API request body to the AI.

  2. AI Analysis: Three separate 'HTTP Request' n8n node calls are made to the OpenRouter AI service (using the Llama 3.1 model). Each request contains the current week's and previous week's corresponding urlString data. The prompt instructs the AI to analyze the differences, provide a comparative markdown table, and list 5 SEO recommendations.

  3. Storage: Finally, the 'Save A.I. output to Baserow' n8n node collects the three separate AI-generated reports (Page, Search, Country) and creates a single, structured entry in the designated Baserow database table, concluding the execution of the n8n workflow.

Installation Guide

To deploy and run this highly efficient n8n workflow, follow these setup steps:


  1. Import the n8n Workflow: Copy the provided JSON code and import it directly into your self-hosted or cloud n8n instance using the 'New' -> 'Import from JSON' function.

  2. Google Analytics Credentials: Configure your Google Analytics OAuth2 credentials. Ensure you enter your specific GA4 Property ID in all 'Google Analytics' n8n node settings, as indicated by the sticky note.

  3. OpenRouter AI Setup: The workflow uses OpenRouter for LLM access. Set up a Generic HTTP Header Authentication credential for OpenRouter:

Username: Authorization
Password: Bearer YOURAPIKEY (Remember the space after 'Bearer'). This credential must be linked to the three 'Send data to A.I.' HTTP Request n8n node instances.

  1. Baserow Database Configuration: Before running the n8n template, create a Baserow database and table with columns matching the expected output (Name, Country Views, Page Views, Search Report, Blog). Update the Baserow n8n node parameters with your Database ID and Table ID, and ensure the correct field IDs are mapped to the respective AI output streams.

  2. Activation: Once credentials and configurations are set, activate the n8n workflow to enable the weekly schedule n8n trigger.

Node Details

Schedule Trigger (n8n trigger): Sets the automation to run weekly, ensuring timely reporting.
Google Analytics n8n node (Multiple Instances): Used six times to fetch current and prior week data for Page Engagement, Google Search Results, and Country Views. Key metrics like screenPageViews, organicGoogleSearchClicks, and activeUsers are extracted using dynamic date ranges for comparison.
Code n8n node (Multiple Instances): Crucial for data preprocessing. These n8n nodes transform the verbose GA4 API response into a simplified, flat JSON structure suitable for AI consumption, then URL-encode the string (e.g., urlString) to embed it efficiently into the API payload.
HTTP Request n8n node (OpenRouter API): Three instances are used to send the prepared comparative data to the AI model. The configuration specifies a POST request, uses the Llama 3.1 model, and defines a user prompt instructing the AI to perform the SEO expert analysis and markdown output.


  • Baserow n8n node: The final action in this n8n workflow. It takes the output (markdown reports) from the three upstream AI analysis nodes and creates a new row in the specified Baserow table, archiving the weekly SEO report.

Related n8n Workflows

Free

Nodes: 7 Nodes
Updated: December 26 2025
View all
Created by

I create automations with A.I. for SEO content and other smart automations.

Featured*