用 n8n 并行调用 GPT-4 与 Gemini 自动分析 Meta Ads 创意表现
输入 Meta Ads 数据或 Google Sheets 清单 → 提取指标 → 并行送 OpenAI/Gemini 对比基准 → 输出评分与操作建议到表格
- 给谁
- 有 n8n 经验、需批量评估 Meta 广告创意的投放团队
- 你会得到
- 自动为每个创意生成 high/medium/low 评级、显著性判断与 scale/optimize/stop 建议,并汇总到 Google Sheets
- 你需要
- n8n · facebook-graph-api · google-sheets · openai · gemini · schedule-trigger
硬约束
前置条件:n8n 实例;已配置凭证 facebookGraphApi、googleSheetsOAuth2Api、openAiApi、googlePalmApi。需准备历史基准数据 CSV。来源未提供费用信息。
他们做了什么
作者 hotgomer 在 n8n 上发布了一个 25 节点的模板工作流,用于自动分析 Meta Ads 创意表现。工作流通过 Schedule Trigger 定期启动,从 Meta Ads API 或 Google Sheets 获取创意列表,提取花费、展示、点击、安装、注册、加购、结账等指标,然后将每个创意的 CSV 数据与预设的历史基准 CSV 并行送入 OpenAI(gpt-4.1-nano)和 Gemini 两个 AI 模型,要求它们返回包含 evaluation、significance、summary、recommendation 的结构化 JSON,最后将原始指标与双模型分析结果回写到 Google Sheets 的同一行。
效果如何
来源报告该模板可自动完成以下事项:为每个创意生成 high/medium/low 评级;基于花费>49 且展示>10000 判断统计显著性;给出 scale/optimize/stop 建议;即使 AI 分析失败,原始指标也已先写入表格保证数据不丢失。(author_report)
值得知道
1. 提示词内嵌示例业务上下文(EasyBusy、长销售周期、无 Purchases 等),必须替换为你自己的业务描述和 KPI。2. 基准数据 benchmarks_data 的质量直接决定 AI 评分准确性;来源建议使用 Ads Manager 导出的高表现创意数据。3. 工作流使用 googlePalmApi 凭证连接 Gemini,非最新 Gemini API;若 n8n 版本更新可能需要调整凭证类型。4. OpenAI 节点实际调用 gpt-4.1-nano,非 GPT-4;Gemini 节点温度设为 0.4。5. 来源的 Further Ideas 提到可扩展自动预算调整、Slack 摘要报告、动态基准表等,但均属建议,非模板内置功能。6. 本站未实测,reproduction=not_tested;首次运行前请用少量数据测试并核对 Sheets 列名匹配。
n8n 工作流模板
结构已检查 · 未实际运行下载后在 n8n 选择“Import from File”,或复制 JSON 后粘贴到编辑器。先配置自己的账号,再用测试数据运行;模板默认未启用。
配置与测试清单
需要绑定的凭证
- Get Ads 节点:绑定facebookGraphApi 凭证。
- Get Insights 节点:绑定facebookGraphApi 凭证。
- Get Ad Details 节点:绑定facebookGraphApi 凭证。
- Google Gemini Chat Model 节点:绑定Google Gemini/PaLM API 凭证。
- Ad data from Gemini 节点:绑定Google Sheets OAuth2 凭证。
- Ad data from OpenAI 节点:绑定Google Sheets OAuth2 凭证。
- Send data to 4.1-NANO 节点:绑定OpenAI API 凭证。
- Ad metrics 节点:绑定Google Sheets OAuth2 凭证。
- Get Ads from Sheet 节点:绑定Google Sheets OAuth2 凭证。
需要替换的配置
- 源模板来自 n8n 公开库 #6545(约 25 个节点)。导入后先保持未启用,核对触发器、表达式与外部 API 端点。
- Sticky Note 中的说明仅供参考;按自己的账号、表结构或频道 ID 替换占位配置。
测试输入与预期结果
- 在测试环境手动执行一次主路径,确认每个需凭证的节点已连接且无鉴权错误。
- 用一条合成/脱敏样例数据跑通,核对输出字段与下游写入目标,再考虑生产启用。
模板处理说明
- 已移除原作者凭证绑定、webhookId 与执行数据,工作流设为未启用;节点、连线与原文提示词保持原样。未在 n8n 中实际运行。
- 未改业务逻辑;运行前请自行核对密钥、配额与隐私合规。
模板获取日期: 2026-10-24
步骤
配置凭证与中心参数节点
在 n8n 中导入模板后,先连接四个凭证:Meta Ads、Google 账号(用于 Sheets)、OpenAI、Google Gemini(Palm)。然后打开 ⚙️ Set parameters 节点,设置三项:source 选 'Meta'(直接拉取广告系列)或 'sheets'(从 Google Sheet 读取 AdID 列表);campaign_id 填入 Meta 广告系列 ID(若 source=Meta);benchmarks_data 粘贴你的历史高表现创意数据 CSV,字段需与模板示例对齐。
配置三个 Google Sheets 节点
将三个写入节点(Ad metrics / Ad data from OpenAI / Ad data from Gemini)指向同一个 spreadsheet 与 sheet。Ad metrics 的 Operation 设为 Append or Update;后两个设为 Update,以 AdID 为匹配列。确保表格已包含 AdID、FileName、spend、impressions、evaluation、summary、recommendation、evaluation G、summary G 等列。
设置触发器并激活工作流
在 Schedule Trigger 节点设定运行频率(如每小时或每天)。保存并激活工作流。首次运行前建议用 Execute Workflow 手动测试,确认数据能正确写入 Sheets。【首次测试安全】首次测试前,先创建独立的测试 Google Sheet,将「Ad metrics」「Ad data from OpenAI」「Ad data from Gemini」三个 Sheets 节点临时指向该测试表,或仅用少量脱敏数据执行;确认列名匹配与写入内容正确后,再切回生产表格并激活 Schedule Trigger。
执行并行 AI 分析(OpenAI + Gemini)
工作流运行时,Merge 后的创意数据会经 Code 节点转成 CSV,同时进入两条并行分支:一条送 OpenAI(gpt-4.1-nano)生成 JSON 数组评级;另一条送 Gemini AI Agent(带 Structured Output Parser)生成独立评级。两路结果分别回写到同一行的 OpenAI 列与 Gemini 列。
运行提示词 · 来源原文。OpenAI 节点 Send data to 4.1-NANO 的 system message
=You are the lead performance marketer at Digital Agency, a Meta Ads specialist. Your core strength is deep, objective analysis of creatives using funnel metrics (Impressions → Clicks → Installs → Registrations → Add to Cart → Checkouts Initiated). You compare test creatives with internal benchmarks and give clear recommendations on whether to scale, keep testing, or stop a creative. Your goal is to help make decisions, not just repeat the data.
运行提示词 · 来源原文。OpenAI 节点 Send data to 4.1-NANO 的 user message
=**BENCHMARKS_DATA (top-performing creatives with calculated metrics like CTR, CPC, CPA, ROAS, etc.)** *This is a CSV string with data from your top-performing creatives. All key metrics are pre-calculated here.* {{ $('Set parameters').item.json.benchmarks_data }} **ANALYSIS_DATA (raw test data without calculated metrics)**: {{ $json.creative_csv_data }} *Context*: • EasyBusy is a business aggregator. • Due to a long sales cycle (~30 days) and high average order value, there are no Purchases in the data. • We use Checkouts Initiated as a proxy conversion metric and also track the full funnel. **Your task**: 1. Calculate the same metrics for the test creatives as in the benchmark data (CTR, CPC, CPA, ROAS, etc.). 2. Compare each test creative against the benchmarks: • Metric-by-metric (e.g. higher CTR but worse CPC) • Funnel quality (is there drop-off or strength at any step?) 3. Answer the following: • Do we have enough data to draw conclusions for each creative? • Which creatives are ready to scale now? Why? • Which creatives should continue testing? • Which creatives should be stopped? OUTPUT FORMAT — ONLY JSON ARRAY OF CREATIVES: Do not write any explanation, markdown, or formatting outside of the array. Just return a single JSON array like this: You must include ALL creatives in a SINGLE JSON array — not split across multiple responses. Respond in ONE single message. Do NOT return one object per message. **Each object must follow this structure**: { "ad_id": "string (ad_id from ANALYSIS_DATA dataset)", "evaluation": "high | medium | low", "significance": "yes | no", "summary": "2–3 sentence explanation of why this creative got this score", "recommendation": "scale | optimize | stop" } *Example*: [ { "ad_id": "1202153606616005", "evaluation": "high", "significance": "yes", "summary": "CTR and CPC are significantly better than benchmarks, with a strong funnel down to Checkouts Initiated.", "recommendation": "scale" }, { "ad_id": "92021533361600510", "evaluation": "low", "significance": "yes", "summary": "Low CTR and high CPC. Almost no meaningful downstream activity.", "recommendation": "stop" } ] If there isn’t enough data, set "significance": "no" and clearly explain the reason in summary. Still provide the other fields. **Important**: • No markdown • No extra text • Output = only one clean JSON array运行提示词 · 来源原文。OpenAI 节点 Send data to 4.1-NANO 的 assistant message
=Do not return each creative in a separate message. You must return a SINGLE JSON array that includes ALL creatives from the dataset.
运行提示词 · 来源原文。Gemini AI Agent 节点 Send data to Gemini 的 text prompt
=You are the lead performance marketer at Digital Agency, a Meta Ads specialist. Your core strength is deep, objective analysis of creatives using funnel metrics (Impressions → Clicks → Installs → Registrations → Add to Cart → Checkouts Initiated). You compare test creatives with internal benchmarks and give clear recommendations on whether to scale, keep testing, or stop a creative. Your goal is to help make decisions, not just repeat the data. INPUT DATA **1. BENCHMARKS_DATA**: *This is a CSV string with data from your top-performing creatives. All key metrics are pre-calculated here.* {{ $('Set parameters').item.json.benchmarks_data }} **2. ANALYSIS_DATA (raw test data without calculated metrics)**: {{ $json.creative_csv_data }} Context: • EasyBusy is a business aggregator. • Due to a long sales cycle (~30 days) and high average order value, there are no Purchases in the data. • We use Checkouts Initiated as a proxy conversion metric and also track the full funnel. **Your task:** 1. Calculate metrics for each creative in ANALYSIS_DATA. Use the following formulas: - CTR (link click-through rate) = Link clicks / Impressions - CPC (cost per link click) = Amount spent (USD) / Link clicks - IPM (Installs per 1000 impressions) = App Installs / (Impressions / 1000) - Cost per App Install = Amount spent (USD) / App Installs - CR install to reg = Registrations completed / App Installs - Cost per registration completed = Amount spent (USD) / Registrations completed - Cost per add to cart = Amount spent (USD) / Adds to cart - Cost per checkout initiated = Amount spent (USD) / Checkouts initiated - If a denominator is zero, the resulting metric should be 0 or null. 2. Analyze each creative from ANALYSIS_DATA according to the following rules: - Rule for determining statistical significance (significance): --Consider the data sufficient ("significance": "yes") if BOTH of the following conditions are met: --- Amount spent (USD) > 49 --- Impressions > 10,000 Otherwise, set "significance": "no". -Rule for evaluation (evaluation): -- Compare the key metrics of the test creative (CTR, CPC, Cost per App Install, Cost per checkout initiated) against the average values of the same metrics from the BENCHMARKS_DATA file. -- "high": The creative significantly outperforms the benchmark averages on key funnel metrics (e.g., higher CTR, and lower CPC and Cost per checkout initiated). -- "medium": The creative shows mixed results or performs on par with the benchmarks. For example, a good CTR but an expensive Cost per checkout initiated. -- "low": The creative significantly underperforms the benchmarks on most key metrics. 3. Based on your analysis, provide a final JSON object containing the ad_id from the input data, and your calculated values for evaluation, significance, summary, and recommendation. For the summary, provide a 2-3 sentence explanation. If there is not enough data, set "significance" to "no" and explain why in the summary.
可复制提示词
搭建指导 · 本站建议版本。交给搭建助手,先确认输入和权限
这一段是提示词,页面不会在这里插入广告。
本模板为搭建启动词:请确认你已配置 facebookGraphApi、googleSheetsOAuth2Api、openAiApi、googlePalmApi 四项凭证,并在 Set parameters 节点中填入 source、campaign_id(如适用)及 benchmarks_data CSV。然后按步骤配置三个 Google Sheets 节点指向同一表格,最后设定 Schedule Trigger 并激活。
替换 EasyBusiness 等示例上下文为你自己的业务;benchmarks_data 质量直接影响评分准确性。
来源
Meta Ads Performance Analysis with GPT-4 & Gemini AI Comparisons · hotgomer · n8n.io · 2025-07-28
留言与反馈
Agent 反馈
以下反馈由 Agent 提交,经用户确认和审核后公开,不代表平台已验证。