AutomationFlowsAI & RAG › Analyze Website Page Gaps with Gpt-4.1-mini, Perplexity, and Google Docs

Analyze Website Page Gaps with Gpt-4.1-mini, Perplexity, and Google Docs

ByisaWOW @isawow on n8n.io

An AI-powered workflow that analyzes any website to identify missing pages that would improve user experience and business performance. Submit a URL, and the system detects existing pages, researches competitors using Perplexity, and generates a professional gap analysis report…

Event trigger★★★★☆ complexityAI-powered11 nodesForm TriggerHTTP RequestAgentOpenAI ChatPerplexity ToolGoogle Docs
AI & RAG Trigger: Event Nodes: 11 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #13249 — we link there as the canonical source.

This workflow follows the Agent → Form Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "nodes": [
    {
      "id": "d58e5db3-31f4-48ba-8b10-eaf918231f52",
      "name": "Submit Website URL for Analysis",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "options": {},
        "formTitle": "URL",
        "formFields": {
          "values": [
            {
              "fieldLabel": "URL",
              "requiredField": true
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "bac14d84-80ae-4770-a66c-1065d26e94ab",
      "name": "Fetch Website HTML",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        288,
        0
      ],
      "parameters": {
        "url": "={{ $json.URL }}",
        "options": {}
      },
      "typeVersion": 4.3
    },
    {
      "id": "2106129b-fac1-435b-ab55-9437fe44a298",
      "name": "Detect Existing Pages and Business Type",
      "type": "n8n-nodes-base.code",
      "position": [
        528,
        0
      ],
      "parameters": {
        "jsCode": "// Enhanced HTML analysis with better page detection\nlet html = '';\n\ntry {\n  html = $input.first().json.body || \n         $input.first().json.data || \n         $input.first().json || '';\n  \n  if (typeof html !== 'string') {\n    html = String(html);\n  }\n} catch (error) {\n  return {\n    json: {\n      error: 'Failed to get HTML',\n      message: error.message\n    }\n  };\n}\n\nif (!html || html.length === 0) {\n  return {\n    json: {\n      error: 'HTML content is empty'\n    }\n  };\n}\n\nconst url = $('Submit Website URL for Analysis').first().json.URL || '';\n\n// Extract all links more accurately\nconst linkRegex = /<a[^>]+href=[\"']([^\"']+)[\"']/gi;\nconst allLinks = [];\nlet match;\nwhile ((match = linkRegex.exec(html)) !== null) {\n  allLinks.push(match[1].toLowerCase().trim());\n}\n\n// Normalize URLs - remove trailing slashes, query params, anchors\nconst normalizeUrl = (link) => {\n  return link\n    .split('?')[0]    // Remove query params\n    .split('#')[0]    // Remove anchors\n    .replace(/\\/$/, '') // Remove trailing slash\n    .toLowerCase();\n};\n\nconst normalizedLinks = allLinks.map(normalizeUrl);\n\n// Enhanced page detection with multiple patterns\nconst pagePatterns = {\n  home: {\n    patterns: [/(^\\/|^index|^home)$/i, /homepage/i],\n    keywords: ['home', 'homepage']\n  },\n  about: {\n    patterns: [/about[-_]?(us|me|company)?/i, /who[-_]?we[-_]?are/i, /our[-_]?story/i],\n    keywords: ['about us', 'about', 'our story', 'who we are', 'company']\n  },\n  contact: {\n    patterns: [/contact[-_]?(us|me)?/i, /get[-_]?in[-_]?touch/i, /reach[-_]?us/i],\n    keywords: ['contact', 'get in touch', 'reach us', 'contact us']\n  },\n  services: {\n    patterns: [/services?/i, /what[-_]?we[-_]?do/i, /offerings?/i, /solutions?/i],\n    keywords: ['services', 'service', 'what we do', 'solutions', 'offerings']\n  },\n  products: {\n    patterns: [/products?/i, /shop/i, /store/i, /catalog/i],\n    keywords: ['products', 'product', 'shop', 'store', 'catalog']\n  },\n  blog: {\n    patterns: [/blog/i, /news/i, /articles?/i, /insights?/i],\n    keywords: ['blog', 'news', 'articles', 'insights', 'posts']\n  },\n  portfolio: {\n    patterns: [/portfolio/i, /work/i, /projects?/i, /case[-_]?studies/i],\n    keywords: ['portfolio', 'our work', 'projects', 'case studies']\n  },\n  pricing: {\n    patterns: [/pricing/i, /plans?/i, /packages?/i, /rates?/i],\n    keywords: ['pricing', 'plans', 'packages', 'rates']\n  },\n  faq: {\n    patterns: [/faq/i, /frequently[-_]?asked/i, /questions?/i],\n    keywords: ['faq', 'frequently asked', 'questions']\n  },\n  testimonials: {\n    patterns: [/testimonials?/i, /reviews?/i, /feedback/i, /client[-_]?stories/i],\n    keywords: ['testimonials', 'reviews', 'feedback', 'client stories']\n  },\n  team: {\n    patterns: [/team/i, /staff/i, /people/i, /our[-_]?team/i, /meet[-_]?the[-_]?team/i],\n    keywords: ['team', 'our team', 'staff', 'people', 'meet the team']\n  },\n  careers: {\n    patterns: [/careers?/i, /jobs?/i, /join[-_]?us/i, /employment/i, /hiring/i],\n    keywords: ['careers', 'jobs', 'join us', 'employment', 'hiring']\n  },\n  privacy: {\n    patterns: [/privacy[-_]?policy/i, /privacy/i],\n    keywords: ['privacy policy', 'privacy']\n  },\n  terms: {\n    patterns: [/terms[-_]?(and[-_]?conditions|of[-_]?service)?/i, /conditions/i],\n    keywords: ['terms', 'terms and conditions', 'terms of service']\n  }\n};\n\nconst existingPages = [];\nconst missingPages = [];\nconst detectionDetails = {};\n\n// Check each page type\nObject.entries(pagePatterns).forEach(([pageName, config]) => {\n  let found = false;\n  const matches = [];\n  \n  // Check in URLs\n  for (const link of normalizedLinks) {\n    for (const pattern of config.patterns) {\n      if (pattern.test(link)) {\n        found = true;\n        matches.push(`URL: ${link}`);\n        break;\n      }\n    }\n    if (found) break;\n  }\n  \n  // Check in HTML content for keywords\n  if (!found) {\n    for (const keyword of config.keywords) {\n      const keywordRegex = new RegExp(`<a[^>]+>\\\\s*${keyword}\\\\s*</a>`, 'gi');\n      if (keywordRegex.test(html)) {\n        found = true;\n        matches.push(`Keyword: ${keyword}`);\n        break;\n      }\n    }\n  }\n  \n  detectionDetails[pageName] = {\n    found: found,\n    matches: matches\n  };\n  \n  if (found) {\n    existingPages.push(pageName);\n  } else {\n    missingPages.push(pageName);\n  }\n});\n\n// Detect business type with better logic\nlet businessType = 'general';\nif (html.match(/shop|ecommerce|cart|buy\\s*now|add\\s*to\\s*cart|checkout/i)) {\n  businessType = 'ecommerce';\n} else if (html.match(/portfolio|designer|developer|freelance|creative\\s*agency/i)) {\n  businessType = 'portfolio / agency';\n} else if (html.match(/blog|article|post|news/i) && !html.match(/services|products/i)) {\n  businessType = 'blog / content site';\n} else if (html.match(/saas|software|subscription|cloud\\s*platform/i)) {\n  businessType = 'saas / software';\n} else if (html.match(/consulting|agency|marketing|media/i)) {\n  businessType = 'service / agency';\n}\n\n// Extract metadata\nconst titleMatch = html.match(/<title>(.*?)<\\/title>/i);\nconst title = titleMatch ? titleMatch[1].trim() : 'No title found';\n\nconst descMatch = html.match(/<meta\\s+name=[\"']description[\"']\\s+content=[\"']([^\"']+)[\"']/i);\nconst description = descMatch ? descMatch[1].trim() : '';\n\nreturn {\n  json: {\n    url: url,\n    title: title,\n    description: description,\n    business_type: businessType,\n    existing_pages: existingPages,\n    missing_pages: missingPages,\n    detection_details: detectionDetails,\n    total_links: allLinks.length,\n    html_length: html.length,\n    ready_for_ai: true\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "b2eaa0a2-ae8c-414a-bb5a-b9ca52e04a4b",
      "name": "Generate Gap Analysis Report with AI",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        848,
        0
      ],
      "parameters": {
        "text": "=# ROLE\nYou are a Website Gap Analysis Expert specializing in identifying missing pages that would genuinely improve a website's user experience and business goals.\n\n---\n\n# INPUT DATA\n\n**Website URL:** {{ $('Submit Website URL for Analysis').item.json.URL }}\n\n**Business Type:** {{ $('Detect Existing Pages and Business Type').item.json.business_type }}\n\n**Title:** {{ $('Detect Existing Pages and Business Type').item.json.title }}\n\n**Description:** {{ $('Detect Existing Pages and Business Type').item.json.description }}\n\n**EXISTING PAGES (Already detected - DO NOT RECOMMEND):**\n{{ $('Detect Existing Pages and Business Type').item.json.existing_pages.join(', ') }}\n\n**PRELIMINARY MISSING PAGES:**\n{{ $('Detect Existing Pages and Business Type').item.json.missing_pages.join(', ') }}\n\n---\n\n# CRITICAL RULES\n\n1. **NEVER recommend pages that are in the \"EXISTING PAGES\" list above**\n2. **DO NOT recommend technical files** (sitemap.xml, robots.txt, .htaccess, RSS feeds)\n3. **DO NOT recommend admin/backend pages** (login, dashboard, admin panel)\n4. **DO NOT recommend generic pages without business value**\n5. **Only recommend user-facing pages that genuinely add value**\n6. **Each recommendation must have a clear business justification**\n\n---\n\n# YOUR TASK\n\n## Step 1: Deep Website Analysis\nUse Perplexity to thoroughly crawl and analyze {{ $('Submit Website URL for Analysis').item.json.URL }}:\n- Main navigation structure\n- Footer links and secondary navigation\n- All internal page links\n- Service/product pages\n- Content sections\n- Any hidden or dropdown menus\n\n## Step 2: Competitor Research\nUse Perplexity to research 5-7 top competitors in the \"{{ $('Detect Existing Pages and Business Type').item.json.business_type }}\" industry:\n- Identify their complete page structure\n- Note which pages are consistently present across competitors\n- Understand industry-standard pages for this business type\n\n## Step 3: Gap Analysis\nCompare the website's existing pages against:\n- Industry standard pages for this business type\n- Common pages across all competitors\n- User journey and conversion funnel needs\n\n**IMPORTANT FILTERING:**\n- Cross-reference with the \"EXISTING PAGES\" list\n- Remove any page that might already exist under a different name\n- Verify that each recommended page is truly absent\n- Exclude technical/system pages\n\n## Step 4: Generate Recommendations\nFor ONLY the genuinely missing pages that would add business value:\n- Prioritize based on impact (High/Medium/Low)\n- Explain why this page is important for this specific business\n- Provide actionable content suggestions\n\n---\n\n# OUTPUT FORMAT\n\n**Website Page Recommendation Report**\n\n**Website Overview**\nURL: {{ $('Detect Existing Pages and Business Type').item.json.url }}\nBusiness Type: {{ $('Detect Existing Pages and Business Type').item.json.business_type }}\nAnalysis Date: [Current Date]\n\n**Pages Confirmed as Existing:**\n[List the pages from \"EXISTING PAGES\" - formatted nicely]\n\n**Gap Analysis Summary:**\nTotal Pages Analyzed: [number]\nExisting Pages: [number]\nMissing High-Value Pages: [number]\n\n---\n\n**RECOMMENDED PAGES TO ADD**\n[Only list genuinely missing pages with business value]\n\n**Page 1: [Name]**\nPriority: High / Medium / Low\nWhy This Page is Missing: [Specific observation]\nBusiness Value: [Clear explanation of value]\nContent Suggestions:\n  \u2022 [Specific suggestion 1]\n  \u2022 [Specific suggestion 2]\n  \u2022 [Specific suggestion 3]\nCompetitor Examples: [Which competitors have this and how they use it]\n\n**Page 2: [Name]**\n[Same format...]\n\n---\n\n**IMPLEMENTATION PRIORITY SUMMARY**\n\nHigh Priority Recommendations: [number]\n- [List page names only]\n\nMedium Priority Recommendations: [number]\n- [List page names only]\n\nLow Priority Recommendations: [number]\n- [List page names only]\n\n**Next Steps:**\n[Provide 2-3 actionable next steps for implementing these pages]\n\n---\n\n# QUALITY CHECKS BEFORE OUTPUT\n\nBefore finalizing your report, verify:\n- [ ] No pages from \"EXISTING PAGES\" list are recommended\n- [ ] No technical files (sitemap.xml, robots.txt, etc.) are recommended\n- [ ] No admin/backend pages are recommended\n- [ ] Each recommendation has clear business value\n- [ ] Priority levels are justified\n- [ ] Content suggestions are specific and actionable\n- [ ] Competitor research supports each recommendation\n\n---\n\n**OUTPUT ONLY THE REPORT TEXT - NO CODE, NO JSON, NO MARKDOWN FORMATTING**",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "3ec5f91c-f498-4531-8476-465bee4d47ee",
      "name": "OpenAI GPT-4.1 Mini with Web Search",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        848,
        192
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "gpt-4.1-mini"
        },
        "options": {},
        "builtInTools": {
          "webSearch": {
            "searchContextSize": "medium"
          }
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "53b2ed9d-1028-4590-a751-ced5d6dba47a",
      "name": "Perplexity Competitor Research Tool",
      "type": "n8n-nodes-base.perplexityTool",
      "position": [
        944,
        368
      ],
      "parameters": {
        "options": {},
        "messages": {
          "message": [
            {
              "content": "=Analyze the website {{ $('Submit Website URL for Analysis').item.json.URL }} in detail.\n\n1. Crawl and list ALL pages available on this website\n2. Research 5-7 top competitor websites in the \"{{ $('Detect Existing Pages and Business Type').item.json.business_type }}\" industry\n3. For each competitor, list their main pages and structure\n4. Identify industry-standard pages that most successful sites in this niche have\n\nFocus on user-facing pages only. Ignore technical files like sitemap.xml, robots.txt, or admin pages.\n\nProvide a comprehensive analysis including:\n- Complete page inventory of the target website\n- Competitor page structures\n- Industry best practices for this business type"
            }
          ]
        },
        "requestOptions": {}
      },
      "credentials": {
        "perplexityApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "54ce92d6-2cef-40c5-a432-575b968a05c4",
      "name": "Save Report to Google Docs",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        1216,
        0
      ],
      "parameters": {
        "actionsUi": {
          "actionFields": [
            {
              "text": "={{ $json.output }}",
              "action": "insert"
            }
          ]
        },
        "operation": "update",
        "documentURL": "1xSDUxPlpSXj2dM3vQtUMHQjVXPE4-XtoB9h4peCFRys"
      },
      "credentials": {
        "googleDocsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "2f2112b9-681a-41fd-a492-75e466c04ccb",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        -416
      ],
      "parameters": {
        "width": 416,
        "height": 848,
        "content": "## AI-Powered Website Gap Analysis Tool\n\nThis workflow analyzes any website and identifies missing pages\nthat would improve user experience and business goals. Submit a\nURL via form, and the system fetches the site's HTML, detects\nwhich standard pages already exist (about, contact, services,\nblog, etc.), then uses AI with Perplexity to research competitors\nand industry standards. The final output is a professional gap\nanalysis report saved to Google Docs with prioritized\nrecommendations for pages you should add.\n\n## How it works\n1. User submits a website URL through a simple form.\n2. System fetches the complete HTML of the website.\n3. Code analyzes HTML to detect 15 common page types already present.\n4. AI identifies business type and preliminary missing pages.\n5. Perplexity researches 5-7 competitors in the same industry.\n6. AI generates a detailed gap analysis report with priorities.\n7. Final report is saved to Google Docs automatically.\n\n## Setup steps\n1. Connect Google Docs OAuth credentials.\n2. Add OpenAI API key for GPT-4.1-mini model.\n3. Add Perplexity API key for competitor research.\n4. Update Google Docs document URL in the save node.\n5. Share the form link to start analyzing websites."
      },
      "typeVersion": 1
    },
    {
      "id": "378bb25d-1565-44b5-a06f-0df15d12aad0",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 384,
        "height": 208,
        "content": "## URL Submission & HTML Fetch\n\nReceives website URL via form, then fetches\nthe complete HTML source code of the site\nfor analysis and page detection."
      },
      "typeVersion": 1
    },
    {
      "id": "c7f0c6bd-6de2-4c63-883b-d402d69b9f2c",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 544,
        "height": 208,
        "content": "## Page Detection & AI Analysis\n\nAnalyzes HTML to detect existing pages and\nbusiness type, then uses AI with Perplexity\nto research competitors and generate gap report."
      },
      "typeVersion": 1
    },
    {
      "id": "2e8a61b6-9922-4d2a-9fc5-e48c384cd8a6",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1136,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 208,
        "content": "## Report Generation & Save\n\nAI creates a comprehensive gap analysis\nreport with prioritized recommendations\nand saves it directly to Google Docs."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Fetch Website HTML": {
      "main": [
        [
          {
            "node": "Detect Existing Pages and Business Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Submit Website URL for Analysis": {
      "main": [
        [
          {
            "node": "Fetch Website HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI GPT-4.1 Mini with Web Search": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Gap Analysis Report with AI",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Perplexity Competitor Research Tool": {
      "ai_tool": [
        [
          {
            "node": "Generate Gap Analysis Report with AI",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Generate Gap Analysis Report with AI": {
      "main": [
        [
          {
            "node": "Save Report to Google Docs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Detect Existing Pages and Business Type": {
      "main": [
        [
          {
            "node": "Generate Gap Analysis Report with AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

An AI-powered workflow that analyzes any website to identify missing pages that would improve user experience and business performance. Submit a URL, and the system detects existing pages, researches competitors using Perplexity, and generates a professional gap analysis report…

Source: https://n8n.io/workflows/13249/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This is an automated blog post generation system that: Researches topics using AI agents and web search tools Writes complete blog posts with proper SEO structure Generates custom images for each post

Output Parser Structured, Google Gemini Chat, HTTP Request Tool +11
AI & RAG

This workflow creates an automated Product Intelligence Engine that continuously collects signals from multiple product sources and generates structured PRD updates using AI. It ingests conversations,

Slack Trigger, Form Trigger, HTTP Request +9
AI & RAG

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

Form Trigger, HTTP Request, Agent +6
AI & RAG

Ce template permet de transformer un document (PDF, TXT, DocX...) en post LinkedIn engageant, prêt à être publié ou validé par email, le tout avec l’aide d’une IA spécialisée en copywriting LinkedIn.

Form Trigger, Agent, OpenAI Chat +5
AI & RAG

Who’s it for

Form Trigger, HTTP Request, Google Docs +3