Automate SEO Analysis with Google Analytics & n8n AI

This workflow automates the comparison of weekly Google Analytics SEO data and leverages AI to provide actionable SEO improvement suggestions. It saves hours of manual analysis by processing engagement, search console, and country views data into digestible AI-generated reports.
googleAnalytics
httpRequest
code
+4
Workflow Identifier: 2208
NODES in Use: scheduleTrigger, manualTrigger, stickyNote, googleAnalytics, code, httpRequest, baserow

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

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

What This Workflow Does

This workflow gets your Google Analytics and Search Console data for two weeks.

It compares this week and last week on page views, user activity, and countries.

It sends these details to an AI model to get simple SEO ideas.

Finally, it saves AI reports to a Baserow table to keep history.

It saves you about 5 hours of manual work each week.


Tools and Services Used

  • Google Analytics GA4: supplies web traffic and engagement data.
  • Google Search Console: provides search performance data.
  • OpenRouter API: access Meta LLaMA AI for SEO suggestions.
  • Baserow: stores AI generated SEO reports.
  • n8n: builds and runs the automation workflow.

Inputs, Processing, and Output

Inputs

  • Google Analytics GA4 property ID and OAuth2 credentials.
  • OpenRouter API key for AI access.
  • Baserow API key and table for report storage.

Processing Steps

  • Fetch current and prior week page engagement metrics from Google Analytics.
  • Fetch current and prior week search and country data from Google Search Console and GA.
  • Use Code nodes with JavaScript to parse and format this complex data into simple JSON strings.
  • Send parsed data with prompts to AI via HTTP Request nodes using OpenRouter.
  • Receive SEO suggestions and markdown summaries from AI.
  • Save AI results to Baserow database for future reference.

Output

Markdown tables showing trends and SEO improvement ideas.

Stored reports in Baserow for tracking over time.


Who Should Use This Workflow

People managing website SEO but not wanting to spend hours gathering analytics.

Users who want easy-to-understand SEO advice turned from raw data.

Anyone automating weekly SEO reporting without deep coding skills.


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

Step 1: Download and Import Workflow

  1. Click the Download button on this page to get the workflow file.
  2. Inside your n8n editor, use the menu to “Import from File” and select the downloaded workflow.

Step 2: Configure Credentials and IDs

  1. Open the Google Analytics nodes and enter your GA4 property ID.
  2. Set up Google Analytics OAuth2 credentials in n8n and select them in these nodes.
  3. Open the HTTP Request nodes and add your OpenRouter API Key in the Authorization header.
  4. Update Baserow API key in the Baserow node and confirm the correct table and column names.

Step 3: Adjust Code or Prompt If Needed

  1. Copy-paste or edit JavaScript in the Code nodes if your data structure changes.
  2. Modify the AI prompt text in HTTP Request nodes if different SEO questions are wanted.

Step 4: Test the Workflow Once

  1. Run the workflow manually from the Manual Trigger.
  2. Check node outputs step-by-step for data correctness.
  3. Confirm Baserow entry creation with AI data.

Step 5: Activate Workflow for Production

  1. Turn on the workflow.
  2. If desired, enable the Schedule Trigger to run weekly automatically.
  3. Monitor the logs in n8n to catch errors early.

If using self-host n8n this works the same; see self-host n8n for help setting it up.


Code Snippet Example for Parsing Data

This code simplifies the raw GA4 JSON response to key values for AI input.

function transformToUrlString(items) {
  const analyticsData = items[0].json;
  const simplified = analyticsData.rows.map(row => ({
    page: row.dimensionValues[0].value,
    pageViews: parseInt(row.metricValues[0].value) || 0,
    activeUsers: parseInt(row.metricValues[1].value) || 0,
    viewsPerUser: parseFloat(row.metricValues[2].value) || 0,
    eventCount: parseInt(row.metricValues[3].value) || 0
  }));
  return encodeURIComponent(JSON.stringify(simplified));
}
const urlString = transformToUrlString($input.all());
return { json: { urlString } };

Customizations

  • Change AI Model or Prompt Text
    Edit the HTTP Request nodes to use different AI models or adjust SEO question prompts.
  • Include More GA Metrics
    Add session duration or bounce rate metrics in GA nodes and update parsing code accordingly.
  • Change Schedule Frequency
    Modify the Schedule Trigger node to run the workflow daily or monthly.
  • Add Email Notifications
    Insert an email sending node to send SEO reports directly after AI generates them.
  • Adjust Baserow Table Layout
    Change or add columns for extra insights or date aggregations.

Common Issues and Fixes

  • Empty Data from Google Analytics
    Check GA4 property ID correctness and refresh OAuth2 credentials in n8n.
  • AI API Calls Fail
    Verify OpenRouter API URL and Authorization header with correct API Key.
  • Code Node Parsing Errors
    Test GA nodes output separately to confirm the structure. Update parsing code for missing fields.
  • Baserow Save Fails
    Confirm Baserow API key and exact table and column names match those in the workflow.

Summary of Benefits

✓ Saves 5+ hours weekly by automating Google Analytics and Search Console data gathering.

✓ Provides clear, AI-generated SEO suggestions in markdown tables.

✓ Keeps historical SEO insight records in Baserow database.

→ Simplifies complex data into easy actions for SEO teams.


Frequently Asked Questions

Yes, edit the model name inside the HTTP Request nodes to use supported AI models.
Incorrect GA4 property ID or expired OAuth2 credentials usually cause empty data.
Check that Google Analytics nodes return expected JSON with metric and dimension rows, then update code to handle nulls.
Yes, credentials and API keys are stored securely within n8n; do not share keys publicly.

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free