8
n8n 中文网amn8n.com

广告分析

高级

这是一个Market Research, AI Summarization领域的自动化工作流,包含 25 个节点。主要使用 If, Set, Code, Merge, SplitOut 等节点。 基于GPT-4和Gemini AI对比的Meta广告效果分析

前置要求
  • Google Sheets API 凭证
  • OpenAI API Key
  • Facebook Graph API 凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "YrhmqkmhYl2ghAKN",
  "meta": {
    "instanceId": "d5e1aee00419f7d76c99b6815681c983a5e0b4d87bfcf461d2e125e2786ef532",
    "templateCredsSetupCompleted": true
  },
  "name": "广告分析",
  "tags": [
    {
      "id": "tITAFvUSOpVVIBvI",
      "name": "MetaAds",
      "createdAt": "2025-07-05T02:24:26.705Z",
      "updatedAt": "2025-07-05T02:24:26.705Z"
    },
    {
      "id": "8ZOxg8cY0fPL8g0s",
      "name": "ReadyToUse",
      "createdAt": "2025-07-10T04:08:19.089Z",
      "updatedAt": "2025-07-10T04:08:19.089Z"
    }
  ],
  "nodes": [
    {
      "id": "02512611-49a2-4319-9423-2a8c84cda262",
      "name": "定时触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        -432
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "46d2cd63-dd9b-41de-a050-a7b0106ec6c7",
      "name": "获取广告",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        672,
        -544
      ],
      "parameters": {
        "edge": "ads",
        "node": "={{ $json.campaign_id ?? $('Set parameters').item.json.campaign_id }}",
        "options": {
          "fields": {
            "field": [
              {
                "name": "=id,name,adset_id,creative{id,object_story_id,object_type,image_url,video_id,object_story_spec{video_data{video_id,image_url}}}"
              }
            ]
          }
        },
        "graphApiVersion": "v22.0"
      },
      "credentials": {
        "facebookGraphApi": {
          "id": "jF7Lc9HyK76Jr9Xm",
          "name": "KH | Facebook Graph"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "90adc41b-f6bf-4a03-894d-3ae50067f64d",
      "name": "获取洞察数据",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        1120,
        -480
      ],
      "parameters": {
        "edge": "insights",
        "node": "={{ $json.id }}",
        "options": {
          "fields": {
            "field": [
              {
                "name": "ad_id,ad_name,adset_id,campaign_id,spend,impressions,clicks,reach,frequency,actions,action_values,video_p25_watched_actions,video_p50_watched_actions,video_p75_watched_actions,video_p100_watched_actions"
              }
            ]
          }
        },
        "graphApiVersion": "v22.0"
      },
      "credentials": {
        "facebookGraphApi": {
          "id": "jF7Lc9HyK76Jr9Xm",
          "name": "KH | Facebook Graph"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e9ef5bb7-b017-4068-abe2-937c077d9630",
      "name": "广告拆分输出",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        896,
        -544
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "data"
      },
      "executeOnce": false,
      "typeVersion": 1
    },
    {
      "id": "bdff8dcb-4319-484a-b7b9-6a25c3a957df",
      "name": "洞察数据拆分输出",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1344,
        -480
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "data"
      },
      "typeVersion": 1
    },
    {
      "id": "a4b5eb06-0a3b-4092-b682-dbb77ef9f7a6",
      "name": "设置指标",
      "type": "n8n-nodes-base.set",
      "position": [
        1792,
        -672
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "8bb35599-d421-4f61-a4c7-f77c60233ba9",
              "name": "spend",
              "type": "string",
              "value": "={{ $json.spend }}"
            },
            {
              "id": "28321e91-fd2f-49e7-92e1-c45a89f67702",
              "name": "impressions",
              "type": "string",
              "value": "={{ $json.impressions }}"
            },
            {
              "id": "0c9319e6-b233-456b-878b-d30515473326",
              "name": "link_click",
              "type": "string",
              "value": "={{ $json.actions.find(action => action.action_type.includes('link_click'))?.value || 0 }}"
            },
            {
              "id": "52248e0e-c428-4d5d-a593-5c43d84398ee",
              "name": "app_installs",
              "type": "string",
              "value": "={{ $json.actions.find(action => action.action_type.includes('app_install'))?.value || 0 }}"
            },
            {
              "id": "0e8282f2-a9cd-4209-87f7-1f10d794b65b",
              "name": "complete_registration",
              "type": "string",
              "value": "={{ $json.actions.find(action => action.action_type.includes('complete_registration'))?.value || 0 }}"
            },
            {
              "id": "709915f4-b44b-434e-9193-39ea390ccbb0",
              "name": "add_to_cart",
              "type": "string",
              "value": "={{ $json.actions.find(action => action.action_type.includes('add_to_cart'))?.value || 0 }}"
            },
            {
              "id": "62420b81-8f39-4c88-ae1e-8a20c4d1a13f",
              "name": "initiate_checkout",
              "type": "string",
              "value": "={{ $json.actions.find(action => action.action_type.includes('initiate_checkout'))?.value || 0 }}"
            },
            {
              "id": "9bc0b5fe-6639-4b6d-b31d-924b25b6818d",
              "name": "purchase",
              "type": "string",
              "value": "={{ $json.actions.find(action => action.action_type.includes('purchase'))?.value || 0 }}"
            },
            {
              "id": "96859718-a1f3-4678-8b40-110e0e38964f",
              "name": "value",
              "type": "string",
              "value": "={{ $json.action_values ? $json.action_values.find(action => action.action_type.includes('purchase'))?.value || 0 : 0 }}"
            },
            {
              "id": "82193e6a-e80c-429c-9066-56ac3985647f",
              "name": "ad_id",
              "type": "string",
              "value": "={{ $json.ad_id }}"
            },
            {
              "id": "04316c4e-1417-46d5-9368-5335f9899dd6",
              "name": "ad_name",
              "type": "string",
              "value": "={{ $json.ad_name }}"
            },
            {
              "id": "114d6153-66ff-4087-b82e-df19abbd52dc",
              "name": "campaign_id",
              "type": "string",
              "value": "={{ $json.campaign_id }}"
            },
            {
              "id": "58d3f46a-ecd5-4590-9194-76cfe4541dc3",
              "name": "adset_id",
              "type": "string",
              "value": "={{ $json.adset_id }}"
            },
            {
              "id": "fa3c43ea-17f4-41ab-94e5-d75d9b386c23",
              "name": "video_image_url",
              "type": "string",
              "value": "={{ $json.creative.object_story_spec.video_data.image_url }}"
            },
            {
              "id": "000a2f08-6fca-4790-bcaf-d0937c2b70f0",
              "name": "image_url",
              "type": "string",
              "value": "={{ $json.creative.image_url }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f891f10b-02c3-4eab-ad22-e01f8c6d3e20",
      "name": "设置参数",
      "type": "n8n-nodes-base.set",
      "position": [
        224,
        -432
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a2f4de51-3c9b-41dd-94bd-cdab162261ba",
              "name": "source",
              "type": "string",
              "value": "Sheets"
            },
            {
              "id": "3c3bb838-3411-4347-b98c-f05d1ff60a8d",
              "name": "campaign_id",
              "type": "string",
              "value": ""
            },
            {
              "id": "418cf02d-3573-4f78-8495-553b5a0f47e3",
              "name": "benchmarks_data",
              "type": "string",
              "value": "=Ad ID,Ad name,Ad delivery,Frequency,Reach,Impressions,CTR (link click-through rate),\"CPM (cost per 1,000 impressions) (USD)\",Link clicks,CPC (cost per link click) (USD),IPM,App Installs,Cost per App Install (USD),CR install to reg,Registrations completed,Cost per registration completed (USD),Results,Result indicator,Cost per results,Amount spent (USD),Adds to cart,Cost per add to cart (USD),Checkouts initiated,Cost per checkout initiated (USD),Purchases,Searches,Checkouts initiated conversion value\n120222559945080510,How-to-fly-earn.mp4,not_delivering,2.253171,1312196,2956602,0.787593,2.876305,23286,0.365202,5.80598944,17166,0.495403,0.25381568,4357,1.951822,4357,actions:app_custom_event.fb_mobile_complete_registration,1.95182235,8504.09,515,16.512796,136,62.530074,,19042,7666249.29\n120227998563210510,EASY JUNE 13.jpg,active,2.044556,892309,1824376,1.141212,2.786471,20820,0.244168,3.96354699,7231,0.703024,0.19941917,1442,3.525361,82,actions:app_custom_event.fb_mobile_initiated_checkout,61.9947561,5083.57,360,14.121028,83,61.247831,,9336,4367509.01\n120218673707160510,EASY MARCH ITALY - 1.jpg,not_delivering,1.800396,818312,1473286,0.84505,1.963522,12450,0.232356,2.63356877,3880,0.745575,0.23840206,925,3.127384,925,actions:app_custom_event.fb_mobile_complete_registration,3.12738378,2892.83,194,14.911495,61,47.423443,,5721,2333824.7\n120216673487350510,Flying20Private.mp4,not_delivering,1.915076,301010,576457,0.468899,2.564927,2703,0.547011,2.84496502,1640,0.901567,0.28414634,466,3.172897,459,actions:app_custom_event.fb_mobile_complete_registration,3.2212854,1478.57,121,12.219587,35,42.244857,,2904,1238511.1\n120226828283920510,DJoPkbKzfcU.mp4,not_delivering,1.713265,517876,887259,0.837636,2.505728,7432,0.299143,4.41133874,3914,0.56802,0.25038324,980,2.268602,980,actions:app_custom_event.fb_mobile_complete_registration,2.26860204,2223.23,110,20.211182,29,76.663103,,4559,1405339.92\n120215360661600510,EASY-1 New.jpg,inactive,1.796525,382927,687938,0.715035,2.079548,4919,0.290831,1.89697327,1305,1.096245,0.27126437,354,4.041243,354,actions:app_custom_event.fb_mobile_complete_registration,4.04124294,1430.6,75,19.074667,29,49.331034,,2295,688904.04"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "423b6343-a63c-42b3-9804-4088e8e1694a",
      "name": "条件判断",
      "type": "n8n-nodes-base.if",
      "position": [
        448,
        -432
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e682854e-6f62-4016-8406-897dc46e2837",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.source }}",
              "rightValue": "Meta"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "104f7e12-094c-4f7f-8ec4-420866771334",
      "name": "获取广告详情",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        896,
        -288
      ],
      "parameters": {
        "node": "={{ $json.AdID }}",
        "options": {
          "fields": {
            "field": [
              {
                "name": "id,name,adset_id,creative{id,object_story_id,object_type,image_url,video_id,object_story_spec{video_data{video_id,image_url}}}"
              }
            ]
          }
        },
        "graphApiVersion": "v22.0"
      },
      "credentials": {
        "facebookGraphApi": {
          "id": "jF7Lc9HyK76Jr9Xm",
          "name": "KH | Facebook Graph"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b1111c61-bb8a-4f7d-958f-8a09dc75c910",
      "name": "合并",
      "type": "n8n-nodes-base.merge",
      "position": [
        1568,
        -480
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "advanced": true,
        "mergeByFields": {
          "values": [
            {
              "field1": "id",
              "field2": "ad_id"
            }
          ]
        }
      },
      "typeVersion": 3.2
    },
    {
      "id": "b5b5eb35-4402-471e-a15c-7b6f38a46c18",
      "name": "拆分输出",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        2416,
        -480
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "message.content.creatives"
      },
      "typeVersion": 1
    },
    {
      "id": "2a067c01-1113-41f1-8165-484f83e2c86c",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2224,
        64
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"ad_id\": \"9847213\",\n  \"evaluation\": \"high\",\n  \"significance\": \"yes\",\n  \"summary\": \"CTR and CPC are significantly better than benchmarks, with a strong funnel down to Checkouts Initiated.\",\n  \"recommendation\": \"scale\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "62321b02-c786-4397-96dd-c86532968664",
      "name": "Google Gemini 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        2032,
        48
      ],
      "parameters": {
        "options": {
          "temperature": 0.4
        }
      },
      "credentials": {
        "googlePalmApi": {
          "id": "ZIfu0CPV4qEzGAfw",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b599b087-9f76-4183-8b39-c15cba123e0c",
      "name": "为OpenAI准备CSV",
      "type": "n8n-nodes-base.code",
      "position": [
        1792,
        -480
      ],
      "parameters": {
        "jsCode": "// Определяем заголовки CSV один раз, они будут одинаковыми для всех строк.\nconst header = \"ad_name,ad_id,spend,impressions,clicks,app_installs,registrations,purchases,purchase_value\";\n\n// Используем .map() для преобразования КАЖДОГО входящего элемента\n// Метод .map() вернет новый массив той же длины, что и items\nreturn items.map(item => {\n  // Внутри .map() мы работаем с одним 'item' за раз.\n  // Получаем его json-содержимое\n  const currentJson = item.json;\n\n  // Извлекаем данные для ТЕКУЩЕГО элемента, создавая строку со значениями\n  const row = [\n    `\"${currentJson.name.replace(/\"/g, '\"\"')}\"`, // Экранируем кавычки\n    currentJson.ad_id || 0,\n    currentJson.spend || 0,\n    currentJson.impressions || 0,\n    currentJson.clicks || 0,\n    currentJson.actions?.find(a => a.action_type.includes('app_install'))?.value || 0,\n    currentJson.actions?.find(a => a.action_type.includes('complete_registration'))?.value || 0,\n    currentJson.actions?.find(a => a.action_type.includes('purchase'))?.value || 0,\n    currentJson.action_values?.find(a => a.action_type.includes('purchase'))?.value || 0\n  ].join(',');\n\n  // Возвращаем новую структуру для ТЕКУЩЕГО элемента.\n  // Она будет содержать все старые данные + новое поле с CSV.\n  return {\n    json: {\n      ...currentJson, // Сохраняем все исходные данные\n      creative_csv_data: `${header}\\n${row}` // Добавляем новое поле с CSV\n    }\n  };\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "5dac1e5f-a814-48a7-beaf-b0657d1ff926",
      "name": "为Gemini准备CSV",
      "type": "n8n-nodes-base.code",
      "position": [
        1808,
        -160
      ],
      "parameters": {
        "jsCode": "// Определяем заголовки CSV один раз, они будут одинаковыми для всех строк.\nconst header = \"ad_name,ad_id,spend,impressions,clicks,app_installs,registrations,purchases,purchase_value\";\n\n// Используем .map() для преобразования КАЖДОГО входящего элемента\n// Метод .map() вернет новый массив той же длины, что и items\nreturn items.map(item => {\n  // Внутри .map() мы работаем с одним 'item' за раз.\n  // Получаем его json-содержимое\n  const currentJson = item.json;\n\n  // Извлекаем данные для ТЕКУЩЕГО элемента, создавая строку со значениями\n  const row = [\n    `\"${currentJson.name.replace(/\"/g, '\"\"')}\"`, // Экранируем кавычки\n    currentJson.ad_id || 0,\n    currentJson.spend || 0,\n    currentJson.impressions || 0,\n    currentJson.clicks || 0,\n    currentJson.actions?.find(a => a.action_type.includes('app_install'))?.value || 0,\n    currentJson.actions?.find(a => a.action_type.includes('complete_registration'))?.value || 0,\n    currentJson.actions?.find(a => a.action_type.includes('purchase'))?.value || 0,\n    currentJson.action_values?.find(a => a.action_type.includes('purchase'))?.value || 0\n  ].join(',');\n\n  // Возвращаем новую структуру для ТЕКУЩЕГО элемента.\n  // Она будет содержать все старые данные + новое поле с CSV.\n  return {\n    json: {\n      ...currentJson, // Сохраняем все исходные данные\n      creative_csv_data: `${header}\\n${row}` // Добавляем новое поле с CSV\n    }\n  };\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "9d019e72-f72f-4e52-8ec2-cdf83fb57700",
      "name": "来自Gemini的广告数据",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2432,
        -160
      ],
      "parameters": {
        "columns": {
          "value": {
            "AdID": "={{ $json.output.ad_id }}",
            "summary G": "={{ $json.output.summary }}",
            "evaluation G": "={{ $json.output.evaluation }}",
            "significance G": "={{ $json.output.significance }}",
            "recommendation G": "={{ $json.output.recommendation }}"
          },
          "schema": [
            {
              "id": "FileName",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "FileName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "CreativeID",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "CreativeID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Type",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Timestamp",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "campaign_id",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "campaign_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "AdsetID",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "AdsetID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "AdID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "AdID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Image",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Image",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Impressions",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Impressions",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "spend",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "spend",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "link_click",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "link_click",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "app_install",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "app_install",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "complete_registration",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "complete_registration",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "add_to_cart",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "add_to_cart",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "initiate_checkout",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "initiate_checkout",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "purchase",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "purchase",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "value",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "value",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "evaluation",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "evaluation",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "significance",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "significance",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "summary",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "recommendation",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "recommendation",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "evaluation G",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "evaluation G",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "significance G",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "significance G",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "summary G",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "summary G",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "recommendation G",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "recommendation G",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "AdID"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1gwBOLHpez5fFX9C2m6PoZcsw5LLcjjbR7448jn6cimw/edit#gid=0",
          "cachedResultName": "Creatives"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "=1gwBOLHpez5fFX9C2m6PoZcsw5LLcjjbR7448jn6cimw"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "0drwHzGo1eKmiTc6",
          "name": "KH | Google Sheets "
        }
      },
      "typeVersion": 4.6,
      "alwaysOutputData": true
    },
    {
      "id": "4214e518-1d16-4d4f-83c1-271fe0ab4e61",
      "name": "来自OpenAI的广告数据",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2640,
        -480
      ],
      "parameters": {
        "columns": {
          "value": {
            "AdID": "={{ $json.ad_id }}",
            "summary": "={{ $json.summary }}",
            "evaluation": "={{ $json.evaluation }}",
            "significance": "={{ $json.significance }}",
            "recommendation": "={{ $json.recommendation }}"
          },
          "schema": [
            {
              "id": "FileName",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "FileName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "CreativeID",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "CreativeID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Type",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Timestamp",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "campaign_id",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "campaign_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "AdsetID",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "AdsetID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "AdID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "AdID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Image",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Image",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Impressions",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Impressions",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "spend",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "spend",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "link_click",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "link_click",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "app_install",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "app_install",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "complete_registration",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "complete_registration",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "add_to_cart",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "add_to_cart",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "initiate_checkout",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "initiate_checkout",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "purchase",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "purchase",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "value",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "value",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "evaluation",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "evaluation",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "significance",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "significance",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "summary",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "recommendation",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "recommendation",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "AdID"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1gwBOLHpez5fFX9C2m6PoZcsw5LLcjjbR7448jn6cimw/edit#gid=0",
          "cachedResultName": "Creatives"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "=1gwBOLHpez5fFX9C2m6PoZcsw5LLcjjbR7448jn6cimw"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "0drwHzGo1eKmiTc6",
          "name": "KH | Google Sheets "
        }
      },
      "typeVersion": 4.6,
      "alwaysOutputData": true
    },
    {
      "id": "bed8d683-fe25-4910-98c4-23ae96418579",
      "name": "发送数据到4.1-NANO",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        2016,
        -480
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-nano",
          "cachedResultName": "GPT-4.1-NANO"
        },
        "options": {
          "maxTokens": 6000,
          "temperature": 0.4
        },
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "=You are the lead performance marketer at Digital Agency, a Meta Ads specialist.\nYour core strength is deep, objective analysis of creatives using funnel metrics (Impressions → Clicks → Installs → Registrations → Add to Cart → Checkouts Initiated).\nYou compare test creatives with internal benchmarks and give clear recommendations on whether to scale, keep testing, or stop a creative.\nYour goal is to help make decisions, not just repeat the data."
            },
            {
              "content": "=**BENCHMARKS_DATA (top-performing creatives with calculated metrics like CTR, CPC, CPA, ROAS, etc.)**\n*This is a CSV string with data from your top-performing creatives. All key metrics are pre-calculated here.*\n{{ $('Set parameters').item.json.benchmarks_data }}\n\n**ANALYSIS_DATA (raw test data without calculated metrics)**:\n\n{{ $json.creative_csv_data }}\n\n*Context*:\n\t•\tEasyBusy is a business aggregator.\n\t•\tDue to a long sales cycle (~30 days) and high average order value, there are no Purchases in the data.\n\t•\tWe use Checkouts Initiated as a proxy conversion metric and also track the full funnel.\n\n**Your task**:\n\t1.\tCalculate the same metrics for the test creatives as in the benchmark data (CTR, CPC, CPA, ROAS, etc.).\n\t2.\tCompare each test creative against the benchmarks:\n\t•\tMetric-by-metric (e.g. higher CTR but worse CPC)\n\t•\tFunnel quality (is there drop-off or strength at any step?)\n\t3.\tAnswer the following:\n\t•\tDo we have enough data to draw conclusions for each creative?\n\t•\tWhich creatives are ready to scale now? Why?\n\t•\tWhich creatives should continue testing?\n\t•\tWhich creatives should be stopped?\n\nOUTPUT FORMAT — ONLY JSON ARRAY OF CREATIVES:\n\nDo not write any explanation, markdown, or formatting outside of the array. Just return a single JSON array like this:\nYou must include ALL creatives in a SINGLE JSON array — not split across multiple responses. \nRespond in ONE single message. Do NOT return one object per message.\n\n**Each object must follow this structure**:\n{\n  \"ad_id\": \"string (ad_id from ANALYSIS_DATA dataset)\",\n  \"evaluation\": \"high | medium | low\",\n  \"significance\": \"yes | no\",\n  \"summary\": \"2–3 sentence explanation of why this creative got this score\",\n  \"recommendation\": \"scale | optimize | stop\"\n}\n\n*Example*:\n[\n  {\n    \"ad_id\": \"1202153606616005\",\n    \"evaluation\": \"high\",\n    \"significance\": \"yes\",\n    \"summary\": \"CTR and CPC are significantly better than benchmarks, with a strong funnel down to Checkouts Initiated.\",\n    \"recommendation\": \"scale\"\n  },\n  {\n    \"ad_id\": \"92021533361600510\",\n    \"evaluation\": \"low\",\n    \"significance\": \"yes\",\n    \"summary\": \"Low CTR and high CPC. Almost no meaningful downstream activity.\",\n    \"recommendation\": \"stop\"\n  }\n]\n\nIf there isn’t enough data, set \"significance\": \"no\" and clearly explain the reason in summary. Still provide the other fields.\n\n**Important**:\n\t•\tNo markdown\n\t•\tNo extra text\n\t•\tOutput = only one clean JSON array"
            },
            {
              "role": "assistant",
              "content": "=Do not return each creative in a separate message. You must return a SINGLE JSON array that includes ALL creatives from the dataset."
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "id": "ev7u8Pmik6FUikE1",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "acbba7e0-6a6f-4138-981e-7bc7b7d6e82c",
      "name": "发送数据到Gemini",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2032,
        -160
      ],
      "parameters": {
        "text": "=You are the lead performance marketer at Digital Agency, a Meta Ads specialist.\nYour 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.\nYour goal is to help make decisions, not just repeat the data.\n\nINPUT DATA\n**1. BENCHMARKS_DATA**:\n*This is a CSV string with data from your top-performing creatives. All key metrics are pre-calculated here.*\n{{ $('Set parameters').item.json.benchmarks_data }}\n\n**2. ANALYSIS_DATA (raw test data without calculated metrics)**:\n{{ $json.creative_csv_data }}\n\nContext:\n\t•\tEasyBusy is a business aggregator.\n\t•\tDue to a long sales cycle (~30 days) and high average order value, there are no Purchases in the data.\n\t•\tWe use Checkouts Initiated as a proxy conversion metric and also track the full funnel.\n\n**Your task:**\n1. Calculate metrics for each creative in ANALYSIS_DATA. Use the following formulas:\n- CTR (link click-through rate) = Link clicks / Impressions\n- CPC (cost per link click) = Amount spent (USD) / Link clicks\n- IPM (Installs per 1000 impressions) = App Installs / (Impressions / 1000)\n- Cost per App Install = Amount spent (USD) / App Installs\n- CR install to reg = Registrations completed / App Installs\n- Cost per registration completed = Amount spent (USD) / Registrations completed\n- Cost per add to cart = Amount spent (USD) / Adds to cart\n- Cost per checkout initiated = Amount spent (USD) / Checkouts initiated\n- If a denominator is zero, the resulting metric should be 0 or null.\n2. Analyze each creative from ANALYSIS_DATA according to the following rules:\n- Rule for determining statistical significance (significance):\n--Consider the data sufficient (\"significance\": \"yes\") if BOTH of the following conditions are met:\n--- Amount spent (USD) > 49\n--- Impressions > 10,000\nOtherwise, set \"significance\": \"no\".\n-Rule for evaluation (evaluation):\n-- 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.\n-- \"high\": The creative significantly outperforms the benchmark averages on key funnel metrics (e.g., higher CTR, and lower CPC and Cost per checkout initiated).\n-- \"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.\n-- \"low\": The creative significantly underperforms the benchmarks on most key metrics.\n3. 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.",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.1,
      "alwaysOutputData": true
    },
    {
      "id": "c763d9da-66e1-41a6-881f-6f3f210395aa",
      "name": "广告指标",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2112,
        -672
      ],
      "parameters": {
        "columns": {
          "value": {
            "AdID": "={{ $json.ad_id }}",
            "Type": "={{ $('Merge').item.json.creative.object_type }}",
            "Image": "==IMAGE(\"{{ $json.video_image_url ?? $json.image_url }}\",1)",
            "spend": "={{ $json.spend }}",
            "value": "={{ $json.value }}",
            "AdsetID": "={{ $json.adset_id }}",
            "FileName": "={{ $json.ad_name }}",
            "purchase": "={{ $json.purchase }}",
            "CreativeID": "={{ $('Merge').item.json.creative.id }}",
            "link_click": "={{ $('Insights Split Out').item.json.clicks }}",
            "Impressions": "={{ $json.impressions }}",
            "add_to_cart": "={{ $json.add_to_cart }}",
            "app_install": "={{ $json.app_installs }}",
            "campaign_id": "={{ $json.campaign_id }}",
            "initiate_checkout": "={{ $json.initiate_checkout }}",
            "complete_registration": "={{ $json.complete_registration }}"
          },
          "schema": [
            {
              "id": "FileName",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "FileName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "CreativeID",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "CreativeID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Type",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Timestamp",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "campaign_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "campaign_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "AdsetID",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "AdsetID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "AdID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "AdID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Image",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Image",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Impressions",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Impressions",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "spend",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "spend",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "link_click",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "link_click",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "app_install",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "app_install",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "complete_registration",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "complete_registration",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "add_to_cart",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "add_to_cart",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "initiate_checkout",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "initiate_checkout",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "purchase",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "purchase",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "value",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "value",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "evaluation",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "evaluation",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "significance",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "significance",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "summary",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "recommendation",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "recommendation",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "AdID"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1gwBOLHpez5fFX9C2m6PoZcsw5LLcjjbR7448jn6cimw/edit#gid=0",
          "cachedResultName": "Creatives"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "=1gwBOLHpez5fFX9C2m6PoZcsw5LLcjjbR7448jn6cimw"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "0drwHzGo1eKmiTc6",
          "name": "KH | Google Sheets "
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "1b303d83-c74f-44a9-89e3-3963d707048f",
      "name": "从表格获取广告",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        672,
        -288
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1754847770,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1gwBOLHpez5fFX9C2m6PoZcsw5LLcjjbR7448jn6cimw/edit#gid=1754847770",
          "cachedResultName": "Test Ads Analysis"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1gwBOLHpez5fFX9C2m6PoZcsw5LLcjjbR7448jn6cimw",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1gwBOLHpez5fFX9C2m6PoZcsw5LLcjjbR7448jn6cimw/edit?usp=drivesdk",
          "cachedResultName": "AutoTest_of_Creatives_v2"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "0drwHzGo1eKmiTc6",
          "name": "KH | Google Sheets "
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "5ab1c7cc-3016-4125-ad8a-20f07fb66731",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        -1200
      ],
      "parameters": {
        "color": 5,
        "width": 672,
        "height": 640,
        "content": "### 使用AI进行广告效果分析"
      },
      "typeVersion": 1
    },
    {
      "id": "0bb38ad0-19df-45c0-a6c1-6f3389989661",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        64,
        -288
      ],
      "parameters": {
        "color": 6,
        "width": 544,
        "height": 352,
        "content": "**⚙️ 1. 主配置**"
      },
      "typeVersion": 1
    },
    {
      "id": "521dc7b9-0c91-4ad6-9deb-782144bf3b72",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1536,
        -912
      ],
      "parameters": {
        "color": 7,
        "width": 528,
        "height": 256,
        "content": "**📈 2. 指标准备**"
      },
      "typeVersion": 1
    },
    {
      "id": "9ce178d1-f191-4ece-8c12-146256cec783",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1952,
        -352
      ],
      "parameters": {
        "color": 4,
        "width": 624,
        "height": 256,
        "content": "**🤖 3. AI评分**"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "8b469281-9218-42b9-95b6-5de9b7e853a8",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Get Ads",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Ads from Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Prepare CSV for OpenAI",
            "type": "main",
            "index": 0
          },
          {
            "node": "Set Metrics",
            "type": "main",
            "index": 0
          },
          {
            "node": "Prepare CSV for Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Ads": {
      "main": [
        [
          {
            "node": "Ads Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Ad data from OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Metrics": {
      "main": [
        [
          {
            "node": "Ad metrics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Insights": {
      "main": [
        [
          {
            "node": "Insights Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ads Split Out": {
      "main": [
        [
          {
            "node": "Get Insights",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Ad Details": {
      "main": [
        [
          {
            "node": "Get Insights",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set parameters": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Set parameters",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Ads from Sheet": {
      "main": [
        [
          {
            "node": "Get Ad Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Insights Split Out": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Send data to Gemini": {
      "main": [
        [
          {
            "node": "Ad data from Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send data to 4.1-NANO": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare CSV for Gemini": {
      "main": [
        [
          {
            "node": "Send data to Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare CSV for OpenAI": {
      "main": [
        [
          {
            "node": "Send data to 4.1-NANO",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Send data to Gemini",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Send data to Gemini",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 市场调研, AI 摘要总结

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量25
分类2
节点类型13
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

外部链接
在 n8n.io 查看

分享此工作流