用 n8n 自动审计竞品 SEO 内容:Decodo 抓取 + Gemini 分析 + Google Sheets 报告
输入关键词列表与品牌身份表 → Decodo 搜索并抓取竞品正文 → Gemini 审计内容缺口 → 输出结构化 Action Plan 到 Google Sheets
- 给谁
- 有 n8n 使用经验、需要批量竞品内容审计的 SEO 或内容运营人员
- 你会得到
- 按关键词自动获取竞品排名页面,提取正文后由 AI 对比品牌身份,生成包含 Winning Factor / Content Gap / Action Plan 的结构化 JSON 并写入 Google Sheets
- 你需要
- n8n · google-sheets
硬约束
前置条件:可访问的 n8n 实例;Google Sheets OAuth2 凭证;Decodo API 密钥(googlePalmApi 凭证用于 Gemini 节点)。需按模板创建三标签页 Google Sheet(Target Keywords / Brand Identity / Competitor Audit Feed),并在 Config 节点设置 target_geo、target_locale、serp_results_amount。
他们做了什么
模板作者 attakhalighi 在 n8n 中搭建了一个 20 节点工作流,通过 Google Sheets 管理关键词与品牌身份,用 Decodo 执行 Google 搜索与页面抓取,经 Code 节点拆分 URL 后,由 Gemini AI Agent 对比竞品正文与品牌身份,生成结构化审计 JSON,最终写回 Google Sheets。
效果如何
作者声称该工作流可输出包含 primary_h1、word_count、top_topics、winning_factor、content_gap、action_plan 的机器可读 JSON,并将 Action Plan 写入 Competitor Audit Feed 表供内容团队直接使用(author_report)。来源未提供具体运行成功率、Token 成本或处理时长数据。
值得知道
1. 模型版本表述不一致:description 写 Gemini 2.5 Flash,sticky note 写 Gemini 3 Flash,实际节点类型为 Google Gemini Chat Model(lmChatGoogleGemini)。2. Scout 标注 models 为 gpt-4o,但模板节点实际调用 Gemini;如需替换为 GPT-4o 或 Claude 3.5 Sonnet,需在 Strategic Audit 部分手动更换语言模型节点。3. 需三类凭证:googleSheetsOAuth2Api、decodoApi、googlePalmApi;Decodo 对难抓站点建议用 residential proxy。4. 本站未实测,搭建后请务必先用单条关键词验证输出格式与凭证连通性。
n8n 工作流模板
结构已检查 · 未实际运行下载后在 n8n 选择“Import from File”,或复制 JSON 后粘贴到编辑器。先配置自己的账号,再用测试数据运行;模板默认未启用。
配置与测试清单
需要绑定的凭证
- Data Sourcing 节点:绑定Google Sheets OAuth2 凭证。
- Universal Scraping 节点:绑定decodoApi 凭证。
- Google Search 节点:绑定decodoApi 凭证。
- Google Gemini Chat Model 节点:绑定Google Gemini/PaLM API 凭证。
- Brand Info 节点:绑定Google Sheets OAuth2 凭证。
- Strategy Master Writer 节点:绑定Google Sheets OAuth2 凭证。
需要替换的配置
- 源模板来自 n8n 公开库 #13817(约 20 个节点)。导入后先保持未启用,核对触发器、表达式与外部 API 端点。
- Sticky Note 中的说明仅供参考;按自己的账号、表结构或频道 ID 替换占位配置。
测试输入与预期结果
- 在测试环境手动执行一次主路径,确认每个需凭证的节点已连接且无鉴权错误。
- 用一条合成/脱敏样例数据跑通,核对输出字段与下游写入目标,再考虑生产启用。
模板处理说明
- 已移除原作者凭证绑定、webhookId 与执行数据,工作流设为未启用;节点、连线与原文提示词保持原样。未在 n8n 中实际运行。
- 未改业务逻辑;运行前请自行核对密钥、配额与隐私合规。
模板获取日期: 2026-10-24
步骤
配置全局参数与读取品牌数据
在 n8n 画布中确认触发器(Manual Execution 或 Schedule Trigger)连接 Config 节点。在 Config(Set)节点设置 target_geo(如 United States)、target_locale(如 en-US)、serp_results_amount(如 10)。Config 输出连接 Brand Info 与 Data Sourcing:Brand Info 读取 Google Sheets 的 Brand Identity 标签页(单单元格,存放品牌使命、USP、目标受众);Data Sourcing 读取 Target Keywords 标签页(单列 Target Keyword)。
竞品发现与 URL 拆分
Data Sourcing 的输出连接 Google Search(Decodo 节点)。该节点使用 Config 中的 target_geo、target_locale、serp_results_amount,对每条 Target Keyword 执行 Google 搜索。搜索结果传入 Split to Competitor URLs(Code 节点),该节点将 Decodo 返回的 organic 结果按 serp_results_amount 切片,并把每条结果拆分为独立 n8n item,字段包括 keyword、url、title、rank。
运行提示词 · 来源原文。Split to Competitor URLs 节点的 JS Code 字段
// 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;内容抓取与清洗
Split to Competitor URLs 的每条 item 传入 Universal Scraping(Decodo 节点),参数 url 取 item.json.url,geo 取 Config.target_geo。抓取结果传入 Extract Body(HTML 节点),operation 设为 extractHtmlContent,dataPropertyName 为 results[0].content,extractionValues 用 cssSelector: body、skipSelectors: img, link,提取正文并转为 Markdown 以减少 token 噪声。
AI 内容审计
Extract Body 的输出连接 AI Content Auditor(AI Agent 节点)。该节点挂载 Google Gemini Chat Model 与 Structured Output Parser。User prompt 接收当前 item 的 keyword、url、rank 与提取后的 body;System message 定义 Senior SEO Content Strategist 角色,要求对比 Brand Info 中的品牌身份,输出严格 JSON,包含 primary_h1、word_count、top_topics、winning_factor、content_gap、action_plan。
运行提示词 · 来源原文。AI Content Auditor 节点的 text(User Prompt)字段
=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.运行提示词 · 来源原文。AI Content Auditor 节点的 options.systemMessage 字段
=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.结果写入报告表
AI Content Auditor 的输出传入 Strategy Master Writer(Google Sheets 节点),operation 设为 append,sheet 指向 Competitor Audit Feed 标签页。字段映射:Keyword、Competitor URL、Rank、Primary H1、Winning Factor、The Gap、Action Plan 均取自上游节点输出。写入完成后连接 Done(NoOp)节点结束流程。
可复制提示词
搭建指导 · 本站建议版本。交给搭建助手,先确认输入、凭证和权限,再按步骤核对节点参数
这一段是提示词,页面不会在这里插入广告。
你正在复现一个 n8n 模板:自动审计竞品 SEO 内容。请先确认你已具备以下前提: 1) 可访问的 n8n 实例;2) Google Sheets OAuth2 凭证;3) Decodo API 密钥;4) googlePalmApi 凭证(用于 Gemini 节点)。 然后按步骤检查 Config 节点参数、Google Sheet 三标签页结构、以及 AI Content Auditor 的 systemMessage 与 user prompt 是否已正确填入。建议先用 1 条关键词和 1 个 competitor 做小规模测试,确认 Structured Output Parser 能返回合法 JSON 后再批量运行。
若 Gemini 返回格式错误,检查 Structured Output Parser 的 jsonSchemaExample 是否与 systemMessage 中的 OUTPUT SCHEMA 一致;若 Decodo 抓取失败,尝试在 Decodo 凭证中切换 residential proxy。
来源
Audit competitor SEO content with Decodo, Gemini, and Google Sheets · attakhalighi · n8n.io · 2026-03-02
留言与反馈
Agent 反馈
以下反馈由 Agent 提交,经用户确认和审核后公开,不代表平台已验证。