AutomationFlowsAI & RAG › Automated Meta Ads Analysis with Gemini Ai, Scrapingflash, and Google Sheets

Automated Meta Ads Analysis with Gemini Ai, Scrapingflash, and Google Sheets

ByPaul-François GORIAUX @pfgope on n8n.io

This workflow acts as your personal AI-powered analyst for Meta Ads.

Event trigger★★★★☆ complexityAI-powered17 nodesGoogle SheetsHTTP RequestChain LlmGoogle Gemini ChatOutput Parser Structured
AI & RAG Trigger: Event Nodes: 17 Complexity: ★★★★☆ AI nodes: yes Added:

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

This workflow follows the Chainllm → Google Sheets 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": "84fd2525-1a80-42e8-b0c1-d179b96d5d31",
      "name": "README",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1520,
        -2400
      ],
      "parameters": {
        "width": 500,
        "height": 980,
        "content": "## AI Meta Ads Analyst\n\n### This workflow automates the analysis of Meta (Facebook) ads. It scrapes ads from a provided list of Facebook Ad Library URLs, uses Gemini AI to perform an in-depth analysis of each ad creative and text, and then stores the structured results in a Google Sheet.\n\n### How it works\n1.  **Trigger & Fetch URLs:** The workflow starts on a schedule (e.g., daily) and fetches a list of Facebook Ad Library URLs from a Google Sheet.\n2.  **Scrape Ads:** It uses the ScrapingFlash API to scrape the ads found at each URL.\n3.  **Process Ads:** The workflow splits the scraped data into individual ads and loops through them (limited to 10 per run in this template to manage costs).\n4.  **AI Analysis with Gemini:** For each ad, it sends the image and text to Google's Gemini AI model. A detailed prompt guides the AI to act as an expert analyst, evaluating strengths, weaknesses, and suggesting improvements.\n5.  **Structured Output:** A Structured Output Parser ensures the AI's response is in a clean, consistent JSON format.\n6.  **Save to Google Sheets:** The final, structured analysis for each ad is appended as a new row in a designated Google Sheet.\n\n### How to use\n1.  **Set up Credentials:**\n    * **ScrapingFlash:** Create a Header Auth credential for ScrapingFlash. Set the `Name` to `x-api-key` and the `Value` to your actual API key.\n    * **Google Gemini:** Add your Google Gemini API key credential.\n    * **Google Sheets:** Authenticate your Google account for the Sheets nodes.\n2.  **Configure Google Sheets:**\n    * In the \"Get URL to scrap\" node, select your Sheet and specify the column with the Facebook Ad Library URLs.\n    * In the \"Add row in Sheet\" node, select the Sheet and worksheet where you want to save the analysis. Map the columns to the output from the Gemini node.\n3.  **Activate Workflow:** Enable the workflow. It will run automatically based on the schedule set in the \"Schedule Trigger\" node. You can also run it manually using the \"When clicking \u2018Execute workflow\u2019\" button for testing.\n\n### Requirements\n* A ScrapingFlash account and API key.\n* A Google account with access to the Gemini API.\n* A Google account for Google Sheets.\n\n\n### Need Help?\nJoin the [Discord](https://discord.com/invite/XPKeKXeB7d) or ask in the [Forum](https://community.n8n.io/)!\n\nHappy Hacking!"
      },
      "typeVersion": 1
    },
    {
      "id": "501e6350-a65e-4e61-a9ca-0ec2efcb9c8b",
      "name": "When clicking \u2018Execute workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -848,
        -1920
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "6b82376a-d57a-4be2-9354-6f891f474238",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -848,
        -2128
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "38c384ad-f9ad-4ccd-8a20-3ceefc8eec82",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -848,
        -2400
      ],
      "parameters": {
        "color": 7,
        "width": 316,
        "height": 240,
        "content": "## 1. Trigger & Get URLs\n\nThis workflow can be triggered manually or on a schedule.\n\nThe Google Sheets node fetches a list of Facebook Ad Library URLs that you want to analyze. Make sure your sheet has a column with these URLs."
      },
      "typeVersion": 1
    },
    {
      "id": "54543b50-a2cb-44c7-8152-4be093167276",
      "name": "Get URL to scrap",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -560,
        -2032
      ],
      "parameters": {
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "2edfce52-e8c7-41a3-ae21-8516cf7e8957",
      "name": "Request to scrapingflash.com",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -288,
        -2032
      ],
      "parameters": {
        "url": "https://api.scrapingflash.com/v1/facebook_ads",
        "method": "POST",
        "options": {},
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "headerAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "c70a0c61-d6f6-44e1-9ab2-da906b67a9c7",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        -2400
      ],
      "parameters": {
        "color": 7,
        "width": 332,
        "height": 224,
        "content": "## 2. Scrape Meta Ads\n\nThe HTTP Request node calls the ScrapingFlash API to scrape the ads from the URL provided by the previous step.\n\n**Important:** You must create a \"Header Auth\" credential and add your ScrapingFlash API key there."
      },
      "typeVersion": 1
    },
    {
      "id": "b020da3e-8f9a-4af0-8f2e-0986725bbd45",
      "name": "Split all the ads",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -48,
        -2032
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "body.ads"
      },
      "typeVersion": 1
    },
    {
      "id": "0765638f-61e9-40d3-b1a1-dd5b261566b6",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        160,
        -2032
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "d42b014e-63cc-41d8-8741-b7b028e74d02",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        64,
        -2400
      ],
      "parameters": {
        "color": 7,
        "width": 444,
        "height": 224,
        "content": "## 3. Process & Loop Through Ads\n\n- **Split all the ads:** This node takes the list of ads from the scraper and creates a separate item for each one.\n- **Loop Over Items:** This utility node processes each ad one by one.\n- **Limit:** To control costs and execution time, this node limits the workflow to analyzing only the first 10 ads per run. You can adjust or remove this."
      },
      "typeVersion": 1
    },
    {
      "id": "9e197a15-e01f-479a-a149-76887d4f2fcc",
      "name": "Limit to 10 ads",
      "type": "n8n-nodes-base.limit",
      "position": [
        368,
        -2032
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "cbf96cba-eccb-4e5a-ba88-f8a6dd9a6fd7",
      "name": "Categorise every Meta Ads",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        608,
        -2032
      ],
      "parameters": {
        "text": "Analyse this D2C newsletter",
        "messages": {
          "messageValues": [
            {
              "message": "=You are a highly skilled Meta Ads Analyst, possessing a deep understanding of advertising principles, consumer psychology, and Meta's advertising platform. Your expertise lies in evaluating ad creatives (images and text) to predict their performance and provide actionable insights. Your analysis will culminate in a score (out of 5) and a concise TL;DR summarizing the ad's strengths and weaknesses.\n\nHere's the format you will use to analyze the provided Meta ad and deliver your assessment:\n\n---\n\n## Meta Ad Analysis\n\n**Ad Image:**\n**Ad Text:** \n\n\n**Analysis:**\n\n* **Strengths:** [Identify at least three strengths of the ad, explaining why they are effective. Consider elements like visual appeal, clarity of message, value proposition, call to action, and relevance to the target audience.]\n* **Weaknesses:** [Identify at least three weaknesses of the ad, explaining why they might hinder performance. Consider elements like confusing messaging, lack of visual appeal, weak call to action, irrelevance to the target audience, and potential for misinterpretation.]\n* **Potential Improvements:** [Suggest specific, actionable improvements to address the identified weaknesses. Be practical and consider the limitations of the Meta Ads platform.]\n\n**Scoring:**\n\n* **Overall Score (out of 5):** [Provide a score between 1 and 5, with 5 being an exceptionally strong ad and 1 being a very weak ad.]\n* **Justification:** [Briefly explain the reasoning behind your score, highlighting the key factors that influenced your assessment.]\n\n**TL;DR:** [Provide a concise summary (one or two sentences) of the ad's overall effectiveness and key areas for improvement.]\n\n---\n\nHere is the Meta Ad you are tasked with analyzing: [ENTER META AD IMAGE DESCRIPTION AND TEXT HERE]"
            },
            {
              "type": "HumanMessagePromptTemplate",
              "imageUrl": "=",
              "messageType": "imageUrl"
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.4
    },
    {
      "id": "ac7d5925-9115-4fbf-8108-0c8a1c17a9fb",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        592,
        -2400
      ],
      "parameters": {
        "color": 7,
        "width": 348,
        "height": 224,
        "content": "## 4. Analyze Ad with Gemini AI\n\nThis is the core of the workflow. The LangChain chain sends the ad image and text to Google's Gemini model.\n\nA detailed prompt instructs the AI on how to perform the analysis, and a Structured Output Parser ensures the response is in a usable JSON format."
      },
      "typeVersion": 1
    },
    {
      "id": "303cc507-4916-4340-a824-85ca0a90b9af",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        608,
        -1792
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-pro-vision"
      },
      "typeVersion": 1
    },
    {
      "id": "23e184a4-81a9-49bf-9d62-618e8c2febc5",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        864,
        -1792
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"ad_image\": {\n      \"type\": \"string\",\n      \"description\": \"Description of the ad image.\"\n    },\n    \"ad_text\": {\n      \"type\": \"string\",\n      \"description\": \"Text used in the Meta ad.\"\n    },\n    \"analysis\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"strengths\": {\n          \"type\": \"array\",\n          \"items\": { \"type\": \"string\" },\n          \"description\": \"List of at least 3 strengths with explanations.\"\n        },\n        \"weaknesses\": {\n          \"type\": \"array\",\n          \"items\": { \"type\": \"string\" },\n          \"description\": \"List of at least 3 weaknesses with explanations.\"\n        },\n        \"potential_improvements\": {\n          \"type\": \"array\",\n          \"items\": { \"type\": \"string\" },\n          \"description\": \"Specific, actionable improvement suggestions.\"\n        }\n      },\n      \"required\": [\"strengths\", \"weaknesses\", \"potential_improvements\"]\n    },\n    \"scoring\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"overall_score\": {\n          \"type\": \"number\",\n          \"minimum\": 1,\n          \"maximum\": 5,\n          \"description\": \"Overall score from 1 to 5.\"\n        },\n        \"justification\": {\n          \"type\": \"string\",\n          \"description\": \"Reasoning behind the given score.\"\n        }\n      },\n      \"required\": [\"overall_score\", \"justification\"]\n    },\n    \"tldr\": {\n      \"type\": \"string\",\n      \"description\": \"One or two sentence summary of effectiveness and key improvements.\"\n    }\n  },\n  \"required\": [\"ad_image\", \"ad_text\", \"analysis\", \"scoring\", \"tldr\"]\n}\n"
      },
      "typeVersion": 1.2
    },
    {
      "id": "08482067-31af-4586-a89e-48f493149b21",
      "name": "Add row in Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1152,
        -2032
      ],
      "parameters": {
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "4304793b-6545-4cd8-b35f-9143090a4897",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        992,
        -2400
      ],
      "parameters": {
        "color": 7,
        "width": 412,
        "height": 224,
        "content": "## 5. Save Analysis to Google Sheets\n\nThe final step takes the structured output from the Gemini AI analysis and appends it as a new row to your Google Sheet.\n\nYou'll need to configure this node to point to your desired sheet and map the data from the AI node to the correct columns."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Limit to 10 ads": {
      "main": [
        [
          {
            "node": "Categorise every Meta Ads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Limit to 10 ads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get URL to scrap": {
      "main": [
        [
          {
            "node": "Request to scrapingflash.com",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get URL to scrap",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split all the ads": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Categorise every Meta Ads",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Categorise every Meta Ads",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Categorise every Meta Ads": {
      "main": [
        [
          {
            "node": "Add row in Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Request to scrapingflash.com": {
      "main": [
        [
          {
            "node": "Split all the ads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Get URL to scrap",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

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

About this workflow

This workflow acts as your personal AI-powered analyst for Meta Ads.

Source: https://n8n.io/workflows/6276/ — 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

Transform a single quote into a fully-rendered cinematic short video — with voice-over, visuals, and music — then publish it directly to TikTok, Instagram Reels, and YouTube Shorts. This isn’t just au

Agent, HTTP Request, Jwt +7
AI & RAG

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

HTTP Request, Google Sheets, OpenRouter Chat +5
AI & RAG

Stop manually digging through Meta Ads data and spending hours trying to connect the dots.

Google Gemini Chat, Output Parser Structured, Google Sheets +3
AI & RAG

Automate your lead intake, scoring, and outreach pipeline. This workflow collects leads from forms, enriches and scores them using Relevance AI, routes them by quality, and triggers the right follow-u

Form Trigger, HTTP Request, Chain Llm +6
AI & RAG

This workflow automates the entire process of creating and publishing culturally rich social media content about Hindu festivals. It starts by building a comprehensive festival calendar for the year i

Google Sheets, Chain Llm, Output Parser Structured +4