{
  "name": "Meta Ads Analyzer to Google Sheets",
  "nodes": [
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "16b86611-5c91-4fc6-9098-64af9ed500e9",
              "name": "urls",
              "value": "={{ $json.urls.split(/\\r?\\n/).map(u => u.trim()).filter(u => u.length > 0).map(u => ({ url: u })) }}",
              "type": "string"
            },
            {
              "id": "7254e32c-2e55-45ab-a83f-ea9b16d4969d",
              "name": "max_ads",
              "value": 3,
              "type": "number"
            },
            {
              "id": "c0bd1b10-3b17-45bd-bc0e-fc3f70542440",
              "name": "max_images_per_ad",
              "value": 1,
              "type": "number"
            },
            {
              "id": "f5e0d47d-3f27-41a1-8a8d-40d8029c76cc",
              "name": "copy_analysis_prompt",
              "value": "You are a marketing analyst. Analyze the advertisement copy and return a concise, practical assessment covering:\n1. Target audience and intent\n2. Main value proposition and offer\n3. Copywriting angle, tone, and calls to action\n4. Strengths, weaknesses, and one actionable improvement",
              "type": "string"
            },
            {
              "id": "89532a53-5f13-478f-a5c2-648a9a752460",
              "name": "image_analysis_prompt",
              "value": "You are a marketing creative analyst. Describe the product in the image, its design style, dominant colors, visual hierarchy, setting, and the advertising angle. Keep the analysis concise and practical.",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        -384,
        -16
      ],
      "id": "52c25a81-e213-4637-8b7b-fc78ea74e8bd",
      "name": "Prepare Search Settings"
    },
    {
      "parameters": {
        "authentication": "n8nUserAuth",
        "formTitle": "Form Facebook Ads ",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Meta Ad Library URL or Facebook Page URL",
              "fieldType": "textarea",
              "fieldName": "urls",
              "defaultValue": "https://www.facebook.com/SHEINOFFICIAL\nhttps://www.facebook.com/ads/library/?active_status=active&ad_type=all&content_languages[0]=en&country=ALL&is_targeted_country=false&media_type=image&publisher_platforms[0]=instagram&publisher_platforms[1]=facebook&search_type=page&view_all_page_id=15087023444",
              "requiredField": true
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.6,
      "position": [
        -624,
        -16
      ],
      "id": "25532f89-33c4-4b93-8fc0-b927012b9c79",
      "name": "Receive Meta Ad URLs",
      "webhookId": "f0024c60-64a5-4c1e-aba8-5c74c3d20a68"
    },
    {
      "parameters": {
        "operation": "Run actor and get dataset",
        "actorSource": "store",
        "actorId": {
          "__rl": true,
          "value": "https://console.apify.com/actors/Gfha2sfvhewpncTEB/input",
          "mode": "url"
        },
        "customBody": "={\n  \"enrichWithEcommerceData\": false,\n  \"includeAboutPage\": false,\n  \"isDetailsPerAd\": false,\n  \"onlyTotal\": false,\n  \"resultsLimit\": 1,\n  \"startUrls\": {{ $json.urls }}\n  \n}",
        "authentication": "apifyOAuth2Api"
      },
      "type": "@apify/n8n-nodes-apify.apify",
      "typeVersion": 1,
      "position": [
        -160,
        -16
      ],
      "id": "614ca6fd-ddaf-467f-8737-803988cd14ca",
      "name": "Retrieve Meta Ads from Apify",
      "credentials": {
        "apifyOAuth2Api": {
          "id": "7Ne0IgNEnYBFUO80",
          "name": "Apify account 2"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "22966edc-5213-42ef-8609-676feba759cc",
              "name": "runtime_days",
              "value": "={{ \n  Math.max(\n    1, \n    Math.round(\n      (($json.isActive || !$json.endDateFormatted) \n        ? DateTime.now() \n        : DateTime.fromISO($json.endDateFormatted))\n      .diff(DateTime.fromISO($json.startDateFormatted), 'days').days\n    )\n  ) \n}}",
              "type": "number"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        64,
        -16
      ],
      "id": "71d7175c-1187-49a1-8eba-0400f386fade",
      "name": "Calculate Ad Runtime"
    },
    {
      "parameters": {
        "sortFieldsUi": {
          "sortField": [
            {
              "fieldName": "runtime_days",
              "order": "descending"
            },
            {
              "fieldName": "snapshot.pageLikeCount"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.sort",
      "typeVersion": 1,
      "position": [
        272,
        -16
      ],
      "id": "4513adfd-d48d-4aa2-a3ea-ef0d8ecb1ea5",
      "name": "Rank Ads by Runtime & Reach"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "1f82193e-f596-4489-97aa-4eada56d7670",
              "leftValue": "={{ \n  // 1. Ensure the video array is empty\n  (!$json.snapshot.videos || $json.snapshot.videos.length === 0) &&\n  \n  // 2. Ensure the first card is not a video\n  (!$json.snapshot.cards || !$json.snapshot.cards[0]?.videoHdUrl) &&\n  \n  // 3. Ensure at least one valid image URL exists\n  (Boolean($json.snapshot.cards?.[0]?.originalImageUrl) || Boolean($json.snapshot.images?.[0]))\n}}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.3,
      "position": [
        736,
        -16
      ],
      "id": "af0fda77-932b-4d92-ba59-7265b05a3288",
      "name": "Keep Image-Based Ads"
    },
    {
      "parameters": {
        "jsCode": "const config = $('Prepare Search Settings').first().json;\nconst maxImages = Math.max(1, Number(config.max_images_per_ad || 1));\n\nreturn $input.all().map(item => {\n  const data = item.json;\n  const snap = data.snapshot || {};\n  const cards = snap.cards || [];\n\n  const cardImages = cards\n    .map(card => card.originalImageUrl || card.resizedImageUrl)\n    .filter(Boolean);\n  const directImages = (snap.images || []).filter(Boolean);\n  const extraImages = (snap.extraImages || []).filter(Boolean);\n  const imageUrls = [...new Set([...cardImages, ...directImages, ...extraImages])]\n    .slice(0, maxImages);\n  const allHeadlines = cards.map(c => c.title).filter(Boolean);\n\n  return {\n    json: {\n      adId: data.adArchiveID || data.adArchiveId,\n      brandName: data.pageName,\n      brandCategory: snap.pageCategories?.[0] || null,\n      pageLikes: snap.pageLikeCount || 0,\n      primaryText: snap.body?.text || cards[0]?.body || \"\",\n      headlines: allHeadlines.length > 0 ? allHeadlines : [snap.title || \"\"].filter(Boolean),\n      ctaText: snap.ctaText || cards[0]?.ctaText || \"\",\n      landingPageUrl: snap.linkUrl || cards[0]?.linkUrl || \"\",\n      imageUrls,\n      totalImages: imageUrls.length,\n      displayFormat: snap.displayFormat || \"CAROUSEL_OR_DPA\",\n      runtimeDays: data.runtime_days || 0,\n      platforms: data.publisherPlatform || [],\n      isActive: data.isActive\n    }\n  };\n});"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        960,
        -16
      ],
      "id": "ca907458-2342-4cb0-84b7-8df950e4bc23",
      "name": "Extract Ad Metadata"
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "gpt-5-mini",
          "mode": "list",
          "cachedResultName": "GPT-5-MINI"
        },
        "responses": {
          "values": [
            {
              "content": "={{ $('Prepare Search Settings').first().json.copy_analysis_prompt }}\n\nAdvertisement to analyze:\n- Primary Text: {{ $json.primaryText }}\n- Headlines: {{ $json.headlines.join(', ') }}\n- Brand: {{ $json.brandName }}"
            }
          ]
        },
        "builtInTools": {},
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 2.3,
      "position": [
        1408,
        80
      ],
      "id": "ad1c3c1a-35ca-41ad-b5c6-5134141569b6",
      "name": "Analyze Ad Copy with OpenAI",
      "credentials": {
        "openAiApi": {
          "id": "PovI9tpU4yPK9oV6",
          "name": "n8n free OpenAI API credits"
        }
      }
    },
    {
      "parameters": {
        "mode": "combine",
        "fieldsToMatchString": "adId",
        "options": {}
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        2320,
        64
      ],
      "id": "9ee49d02-2fdf-44a8-be2e-763ddd695166",
      "name": "Combine Ad and Image Data"
    },
    {
      "parameters": {
        "fieldToSplitOut": "imageUrls",
        "include": "selectedOtherFields",
        "fieldsToInclude": "adId, brandName",
        "options": {
          "destinationFieldName": "imageUrl"
        }
      },
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        1200,
        -176
      ],
      "id": "a90d299f-02f6-4e9a-9191-980f06eca434",
      "name": "Split Ad Image URLs"
    },
    {
      "parameters": {
        "url": "={{ $json.imageUrl }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.5,
      "position": [
        1424,
        -176
      ],
      "id": "8d7ba021-5bf1-4a65-9907-d11dc83431d7",
      "name": "Download Ad Image"
    },
    {
      "parameters": {
        "name": "={{ $json.brandName }}_{{ $json.adId }}_{{ $itemIndex }}.jpg",
        "driveId": {
          "__rl": true,
          "value": "My Drive",
          "mode": "list",
          "cachedResultName": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive"
        },
        "folderId": {
          "__rl": true,
          "value": "root",
          "mode": "list",
          "cachedResultName": "/ (Root folder)",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1ufWVU-dxp_oNfOV2Nz9LwmdUdNp20muX"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        1664,
        -336
      ],
      "id": "f6ae90c4-bf50-447a-8409-90e229e7685b",
      "name": "Upload Image to Google Drive",
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "aLzOXwYodsZTsrTH",
          "name": "Google Drive account 2"
        }
      }
    },
    {
      "parameters": {
        "resource": "image",
        "operation": "analyze",
        "modelId": {
          "__rl": true,
          "value": "gpt-5.6-luna",
          "mode": "list",
          "cachedResultName": "GPT-5.6-LUNA"
        },
        "text": "={{ $('Prepare Search Settings').first().json.image_analysis_prompt }}",
        "inputType": "base64",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 2.3,
      "position": [
        1664,
        -176
      ],
      "id": "6b1c7f80-0bd7-4c68-9de5-be429a24dedd",
      "name": "Analyze Ad Creative with OpenAI",
      "credentials": {
        "openAiApi": {
          "id": "PovI9tpU4yPK9oV6",
          "name": "n8n free OpenAI API credits"
        }
      }
    },
    {
      "parameters": {
        "mode": "combine",
        "combineBy": "combineByPosition",
        "options": {}
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        1920,
        -240
      ],
      "id": "8404c0c2-6f33-498c-a708-581b522320a6",
      "name": "Combine Image Upload & Analysis"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "171d7506-1b43-40aa-9b14-b818d28b1ce2",
              "name": "adId",
              "value": "={{ $('Split Ad Image URLs').item.json.adId }}",
              "type": "string"
            },
            {
              "id": "8b425965-b862-482b-8bbe-bcbef199d2d5",
              "name": "brandName",
              "value": "={{ $('Split Ad Image URLs').item.json.brandName }}",
              "type": "string"
            },
            {
              "id": "b167a0eb-7e05-4148-a009-e51d3c6faf13",
              "name": "webViewLink",
              "value": "={{ $json.webViewLink }}",
              "type": "string"
            },
            {
              "id": "d53b5a84-0283-4305-9798-b5c8e30cd3b5",
              "name": "imageDescription",
              "value": "={{ $json['1'].content[0].text }}",
              "type": "string"
            },
            {
              "id": "97f6fc19-deb7-4378-a80e-771a17b1c2a7",
              "name": "imageUrl",
              "value": "={{ $('Download Ad Image').item.json.imageUrl }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        2096,
        -240
      ],
      "id": "476abf9c-f363-4351-9ce6-25fa071893a2",
      "name": "Normalize Image Analysis"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "2eea578d-bf79-4c23-8a95-2785b7e8cd2e",
              "name": "adId",
              "value": "={{ $('Extract Ad Metadata').item.json.adId }}",
              "type": "string"
            },
            {
              "id": "fefcf380-f593-43d0-b5ce-cc816d39b3ea",
              "name": "brandName",
              "value": "={{ $('Extract Ad Metadata').item.json.brandName }}",
              "type": "string"
            },
            {
              "id": "57f8eef7-4b23-4edc-8514-44f46df2ac77",
              "name": "brandCategory",
              "value": "={{ $('Extract Ad Metadata').item.json.brandCategory }}",
              "type": "string"
            },
            {
              "id": "76adb155-4ea8-49d9-a082-98a8f0845ba2",
              "name": "primaryText",
              "value": "={{ $('Extract Ad Metadata').item.json.primaryText }}",
              "type": "string"
            },
            {
              "id": "6c0aea10-8986-44bc-bb7e-35391e68be0b",
              "name": "headlines",
              "value": "={{ $('Extract Ad Metadata').item.json.headlines }}",
              "type": "array"
            },
            {
              "id": "c56566e2-804c-4ad2-bae0-5dd434dd1ee2",
              "name": "landingPageUrl",
              "value": "={{ $('Extract Ad Metadata').item.json.landingPageUrl }}",
              "type": "string"
            },
            {
              "id": "926a2b0e-39af-4beb-8662-24febf4004da",
              "name": "platforms",
              "value": "={{ $('Extract Ad Metadata').item.json.platforms }}",
              "type": "array"
            },
            {
              "id": "16b857cc-b09f-4f6e-8828-3aed86dc0df2",
              "name": "textAnalysis",
              "value": "={{ $json.output[0].content[0].text }}",
              "type": "string"
            },
            {
              "id": "78763d36-9ace-4236-86e1-2d9f1f2c3f12",
              "name": "runtimeDays",
              "value": "={{ $('Extract Ad Metadata').item.json.runtimeDays }}",
              "type": "number"
            },
            {
              "id": "e6da1e56-ce01-4a15-8492-e8dc4622ef90",
              "name": "isActive",
              "value": "={{ $('Extract Ad Metadata').item.json.isActive }}",
              "type": "boolean"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        1776,
        80
      ],
      "id": "92e2db1b-d41a-4bc3-93bf-f1cdef7a39ea",
      "name": "Normalize Copy Analysis"
    },
    {
      "parameters": {
        "jsCode": "const items = $input.all();\nconst grouped = {};\n\nconst compact = (value) => String(value || '')\n  .replace(/\\*+/g, '')\n  .replace(/\\s+/g, ' ')\n  .trim();\n\nconst escapeFormula = (value) => String(value || '').replace(/\"/g, '\"\"');\n\nconst makeLink = (url, label) =>\n  url ? `=HYPERLINK(\"${escapeFormula(url)}\",\"${escapeFormula(label)}\")` : '—';\n\nfor (const item of items) {\n  const data = item.json;\n  const adId = data.adId;\n\n  if (!adId) continue;\n\n  if (!grouped[adId]) {\n    grouped[adId] = {\n      adId,\n      brandName: data.brandName || '—',\n      brandCategory: data.brandCategory || '—',\n      primaryText: data.primaryText || '',\n      headlines: data.headlines || [],\n      landingPageUrl: data.landingPageUrl || '',\n      platforms: data.platforms || [],\n      runtimeDays: data.runtimeDays || 0,\n      isActive: Boolean(data.isActive),\n      textAnalysis: data.textAnalysis || '',\n      images: [],\n    };\n  }\n\n  grouped[adId].images.push({\n    webViewLink: data.webViewLink || '',\n    imageUrl: data.imageUrl || '',\n    imageDescription: data.imageDescription || '',\n  });\n}\n\nreturn Object.values(grouped).map((group) => {\n  const images = group.images.filter((image) => image.webViewLink || image.imageUrl);\n  const primaryImageUrl = images[0]?.webViewLink || images[0]?.imageUrl || '';\n\n  const imageDetails = images.map((image, index) => {\n    const description = compact(image.imageDescription);\n    const shortDescription = description.length > 260\n      ? `${description.slice(0, 257)}...`\n      : (description || 'No description available');\n\n    return `${index + 1}. ${shortDescription}\\n${image.webViewLink || image.imageUrl}`;\n  }).join('\\n\\n');\n\n  return {\n    json: {\n      adId: group.adId,\n      brandName: group.brandName,\n      brandCategory: group.brandCategory,\n      primaryText: compact(group.primaryText),\n      headlines: group.headlines.filter(Boolean)\n        .map((headline, index) => `${index + 1}. ${compact(headline)}`)\n        .join('\\n'),\n      landingPageUrl: makeLink(group.landingPageUrl, 'Open landing page'),\n      platforms: group.platforms.filter(Boolean).join(', ') || '—',\n      runtimeDays: Number(group.runtimeDays || 0),\n      isActive: group.isActive ? 'Active' : 'Inactive',\n      textAnalysis: compact(group.textAnalysis),\n      images: makeLink(primaryImageUrl, `Open ${images.length} image${images.length === 1 ? '' : 's'}`),\n      'Image count': images.length,\n      'Image details': imageDetails || '—',\n    },\n  };\n});"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        2608,
        64
      ],
      "id": "d808eb43-1563-4416-8350-56df3b10a373",
      "name": "Format Google Sheets Record"
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "=",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "=",
          "mode": "url"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {},
          "matchingColumns": [],
          "schema": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        2848,
        64
      ],
      "id": "02ec28b7-3bbc-474b-a960-18617311f2c5",
      "name": "Append Ad Report to Google Sheets",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "e2Pnm650gfp5b8Gb",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "maxItems": "={{ Number($('Prepare Search Settings').first().json.max_ads || 10) }}"
      },
      "id": "e3efb300-684b-4f3d-bf75-ef22f0b75771",
      "name": "Limit Top Ads",
      "type": "n8n-nodes-base.limit",
      "typeVersion": 1,
      "position": [
        496,
        -16
      ]
    },
    {
      "parameters": {
        "content": "## Setup before running\n1. Create your own credentials: Apify API, OpenAI API, Google Drive OAuth2, and Google Sheets OAuth2.\n2. Assign your credentials to the corresponding nodes. Do not paste API keys into a Form or Set node.\n3. In **Prepare Search Settings**, set `max_ads`, `max_images_per_ad`, and optionally customize the two English analysis prompts.\n4. Select your spreadsheet in **Append Ad Report to Google Sheets**; optionally select a folder in **Upload Image to Google Drive**.\n5. Test with one URL before increasing the limits.",
        "height": 250,
        "width": 480,
        "color": 5
      },
      "id": "16cd5a53-3353-4a72-a471-a6e3cd347314",
      "name": "Template Setup — Read First",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -528,
        -320
      ]
    }
  ],
  "pinData": {},
  "connections": {
    "Receive Meta Ad URLs": {
      "main": [
        [
          {
            "node": "Prepare Search Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve Meta Ads from Apify": {
      "main": [
        [
          {
            "node": "Calculate Ad Runtime",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Ad Runtime": {
      "main": [
        [
          {
            "node": "Rank Ads by Runtime & Reach",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Keep Image-Based Ads": {
      "main": [
        [
          {
            "node": "Extract Ad Metadata",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Ad Metadata": {
      "main": [
        [
          {
            "node": "Split Ad Image URLs",
            "type": "main",
            "index": 0
          },
          {
            "node": "Analyze Ad Copy with OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Ad Copy with OpenAI": {
      "main": [
        [
          {
            "node": "Normalize Copy Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Ad Image URLs": {
      "main": [
        [
          {
            "node": "Download Ad Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Ad Image": {
      "main": [
        [
          {
            "node": "Analyze Ad Creative with OpenAI",
            "type": "main",
            "index": 0
          },
          {
            "node": "Upload Image to Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Image to Google Drive": {
      "main": [
        [
          {
            "node": "Combine Image Upload & Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Ad Creative with OpenAI": {
      "main": [
        [
          {
            "node": "Combine Image Upload & Analysis",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Combine Image Upload & Analysis": {
      "main": [
        [
          {
            "node": "Normalize Image Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Image Analysis": {
      "main": [
        [
          {
            "node": "Combine Ad and Image Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Copy Analysis": {
      "main": [
        [
          {
            "node": "Combine Ad and Image Data",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Combine Ad and Image Data": {
      "main": [
        [
          {
            "node": "Format Google Sheets Record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Google Sheets Record": {
      "main": [
        [
          {
            "node": "Append Ad Report to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Rank Ads by Runtime & Reach": {
      "main": [
        [
          {
            "node": "Limit Top Ads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit Top Ads": {
      "main": [
        [
          {
            "node": "Keep Image-Based Ads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Search Settings": {
      "main": [
        [
          {
            "node": "Retrieve Meta Ads from Apify",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": true
  },
  "versionId": "a302d089-301f-4fc4-827e-da17249c1b0a",
  "meta": {
    "templateCredsSetupCompleted": true,
    "aiBuilderAssisted": true,
    "builderVariant": "mcp",
    "instanceId": "a85215dbcd5118a28488b45890bcc61780a5dda16a631101d27c7f3665771d59"
  },
  "nodeGroups": [],
  "id": "rqh6TC5C5DhX2AlL",
  "tags": []
}