ChatGPTCreativeWritingAI score · PendingAI-assisted edit · no obvious prompt-injection riskn8n.io

Automate Competitor SEO Content Audits with n8n: Decodo Scraping + Gemini Analysis + Google Sheets Reporting

Input keyword list and brand identity sheet → Decodo searches and scrapes competitor pages → Gemini audits content gaps → outputs structured Action Plan to Google Sheets

ExperiencedStepsWorkflowPromptTip
Who
SEO or content operators with n8n experience who need batch competitor content audits
You get
Automatically fetch top-ranking competitor pages per keyword, extract body text, and have AI compare against your brand identity to generate structured JSON with Winning Factor, Content Gap, and Action Plan, written to Google Sheets
You need
n8n · google-sheets

Constraints

Prerequisites: accessible n8n instance; Google Sheets OAuth2 credentials; Decodo API key; googlePalmApi credentials for the Gemini node. Create a Google Sheet with three tabs (Target Keywords, Brand Identity, Competitor Audit Feed) and configure target_geo, target_locale, and serp_results_amount in the Config node.

What they did

Template author attakhalighi built a 20-node n8n workflow that manages keywords and brand identity via Google Sheets, uses Decodo for Google search and page scraping, splits URLs via a Code node, and runs a Gemini AI Agent to compare competitor content against brand identity, producing structured audit JSON that is written back to Google Sheets.

How it went

The author claims the workflow outputs machine-readable JSON containing primary_h1, word_count, top_topics, winning_factor, content_gap, and action_plan, and writes the Action Plan into the Competitor Audit Feed sheet for direct use by content teams (author_report). The source does not provide specific success rates, token costs, or processing duration.

Worth knowing

1. Model version inconsistency: description mentions Gemini 2.5 Flash, sticky note mentions Gemini 3 Flash, while the actual node type is Google Gemini Chat Model (lmChatGoogleGemini). 2. Scout lists models as gpt-4o, but the template node calls Gemini; to swap in GPT-4o or Claude 3.5 Sonnet, manually replace the language model node in the Strategic Audit section. 3. Three credential types required: googleSheetsOAuth2Api, decodoApi, googlePalmApi; Decodo suggests residential proxy for difficult sites. 4. Not tested by this site; after setup, always validate with a single keyword first to check output format and credential connectivity.

n8n workflow template

Structure checked · Not run-tested

Use “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.

Setup and test checklist

Credentials to connect

  • Data Sourcing node: connect Google Sheets OAuth2 credentials.
  • Universal Scraping node: connect decodoApi credentials.
  • Google Search node: connect decodoApi credentials.
  • Google Gemini Chat Model node: connect Google Gemini/PaLM API credentials.
  • Brand Info node: connect Google Sheets OAuth2 credentials.
  • Strategy Master Writer node: connect Google Sheets OAuth2 credentials.

Configuration to replace

  • Source template is n8n public workflow #13817 (~20 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
  • Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.

Test input and expected output

  • Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
  • Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.

Template changes

  • Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
  • No business-logic edits; verify keys, quotas and privacy compliance before use.

Template retrieved: 2026-10-24

Steps

  1. Configure global parameters and read brand data

    In the n8n canvas, confirm the trigger (Manual Execution or Schedule Trigger) connects to the Config node. In the Config (Set) node, set target_geo (e.g., United States), target_locale (e.g., en-US), and serp_results_amount (e.g., 10). Config outputs to Brand Info and Data Sourcing: Brand Info reads the Brand Identity tab (single cell with brand mission, USPs, and target audience); Data Sourcing reads the Target Keywords tab (single column Target Keyword).

  2. Discover competitors and split URLs

    Data Sourcing output connects to Google Search (Decodo node). This node uses target_geo, target_locale, and serp_results_amount from Config to perform a Google search for each Target Keyword. Results pass to Split to Competitor URLs (Code node), which slices the organic results from Decodo by serp_results_amount and splits each result into its own n8n item with fields keyword, url, title, rank.

    Execution prompt · Source text。JS Code field of the Split to Competitor URLs node

    // 1. Get configuration, keywords, and search results
    const config = $("Config").first().json;
    const allKeywords = $("Data Sourcing").all();
    const allSearchResults = $("Google Search").all();
    
    // Use the limit from Config, or default to 5 if not found
    const resultLimit = config.serp_results_amount || 10; 
    
    let finalOutput = [];
    
    // 2. Loop through every search result set
    allSearchResults.forEach((searchResult, searchIndex) => {
      
      // Get the keyword from the matching index
      const keyword = allKeywords[searchIndex].json["Target Keyword"] || "Keyword Not Found";
      
      // Navigate the deep Decodo path
      let organicResults = searchResult.json.results[0].content.results.results.organic;
    
      // 3. LIMIT THE RESULTS HERE
      // slice(0, X) takes only the first X items from the array
      const limitedResults = organicResults.slice(0, resultLimit);
    
      // 4. Map each URL (up to the limit) to its own n8n item
      limitedResults.forEach(result => {
        finalOutput.push({
          json: {
            keyword: keyword,
            url: result.url,
            title: result.title,
            rank: result.pos
          },
          // Keeps the internal n8n breadcrumb trail alive
          pairedItem: {
            item: searchIndex
          }
        });
      });
    });
    
    return finalOutput;
  3. Scrape and clean content

    Each item from Split to Competitor URLs passes to Universal Scraping (Decodo node) with url from item.json.url and geo from Config.target_geo. Scraping results pass to Extract Body (HTML node) with operation set to extractHtmlContent, dataPropertyName as results[0].content, and extractionValues using cssSelector: body and skipSelectors: img, link to extract body text into Markdown and reduce token noise.

  4. AI content audit

    Extract Body output connects to AI Content Auditor (AI Agent node). This node is connected to Google Gemini Chat Model and Structured Output Parser. The user prompt receives the current item's keyword, url, rank, and extracted body; the system message defines a Senior SEO Content Strategist role, requires comparison against Brand Info, and enforces strict JSON output with primary_h1, word_count, top_topics, winning_factor, content_gap, and action_plan.

    Execution prompt · Source text。AI Content Auditor node text (User Prompt) field

    =Please perform a deep SEO audit on the following competitor content for the keyword: "**{{ $('Split to Competitor URLs').item.json.keyword }}**".
    
    **Competitor URL:** {{ $('Split to Competitor URLs').item.json.url }}
    **Current Rank:** {{ $('Split to Competitor URLs').item.json.rank }}
    
    ---
    **PAGE CONTENT (MARKDOWN):**
    {{ $json.body }}
    ---
    
    Analyze the content and provide the Audit Requirements defined in your system instructions.

    Execution prompt · Source text。AI Content Auditor node options.systemMessage field

    =You are a Senior SEO Content Strategist. Your mission is to perform a "Search Intent Audit" to find the delta between this competitor and our brand.
    
    ### OUR BRAND IDENTITY (THE GOLD STANDARD):
    {{ $("Brand Info").first().json['Brand Info'] }}
    
    ### INPUT CONTEXT:
    - Target Keyword: {{ $('Split to Competitor URLs').item.json.keyword }}
    - SERP Rank: {{ $('Split to Competitor URLs').item.json.rank }}
    - Content Source: Competitor Markdown extraction.
    
    ### STRATEGIC LOGIC RULES:
    1. THE GAP DEFINITION: A "Content Gap" is NOT just missing text. It is a specific angle, data point, or user-need that OUR BRAND provides (based on the Identity above) which is absent in the competitor's text.
    2. WINNING FACTOR: Identify if they are winning due to "Topical Depth" (long-form), "Technical Authority" (tools/data), or "User Experience" (skimmable headers).
    3. ACTION PLAN: This must be a "Checkmate" instruction. If they are broad, we must be specific. If they are technical, we must be accessible.
    
    ### OUTPUT SCHEMA (STRICT JSON ONLY):
    {
      "primary_h1": "String",
      "word_count": Integer,
      "top_topics": ["Topic 1", "Topic 2", "Topic 3"],
      "winning_factor": "Detailed 1-sentence analysis of their SEO moat.",
      "content_gap": "What specific 'Brand Value' from our identity is missing here?",
      "action_plan": "Specific instruction: 'Write a [Section Type] that focuses on [Brand USP] to outperform their [Competitor Section].'"
    }
    
    ### CONSTRAINTS:
    - No conversational filler. 
    - If the Markdown is empty or invalid, return "Error: No Content".
    - Ensure the 'action_plan' uses the brand voice defined in the Brand Identity.
  5. Write results to report sheet

    AI Content Auditor output passes to Strategy Master Writer (Google Sheets node) with operation set to append, sheet pointing to the Competitor Audit Feed tab. Field mapping: Keyword, Competitor URL, Rank, Primary H1, Winning Factor, The Gap, and Action Plan are sourced from upstream node outputs. After writing, the flow connects to Done (NoOp) to finish.

Prompt you can copy

Setup guidance · Editorial suggestion。Hand to setup assistant to confirm inputs, credentials, and permissions before verifying node parameters step by step

This block is the prompt. Ads are never placed here.

You are reproducing an n8n template: automated competitor SEO content audits. Please confirm you have the following prerequisites before starting:
1) An accessible n8n instance; 2) Google Sheets OAuth2 credentials; 3) A Decodo API key; 4) googlePalmApi credentials for the Gemini node.
Then verify the Config node parameters, the three-tab Google Sheet structure, and that the AI Content Auditor's systemMessage and user prompt are correctly filled. Start with a small test using 1 keyword and 1 competitor to ensure the Structured Output Parser returns valid JSON before running at scale.

If Gemini returns format errors, check that the Structured Output Parser's jsonSchemaExample matches the OUTPUT SCHEMA in the systemMessage. If Decodo scraping fails, try switching to residential proxy in the Decodo credentials.

Source

Audit competitor SEO content with Decodo, Gemini, and Google Sheets · attakhalighi · n8n.io · 2026-03-02

Comments & feedback

Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.

Loading…

    Related