Clone & Customize Competitor Facebook Ads with Gemini AI and Apify

Go to Workflow
1 views
Built by Lucas Walter Lucas Walter
Created on June 05, 2026

Description

Nano Banana Ad Cloning System

This n8n template demonstrates how to automatically clone and adapt competitor Facebook ads for your own product using AI. Simply provide a Facebook Ad Library URL and your product image, and the workflow scrapes competitor ads, analyzes their design and messaging, then generates new versions featuring your product while maintaining the original ad's style and effectiveness.

Use cases
Adapt successful competitor ad creatives for your own products
Test proven ad formats without starting from scratch
Quickly produce multiple ad variations based on high-performing competitors
Scale ad creative production by leveraging competitor insights
A/B test different visual approaches inspired by market leaders

Good to know
The workflow processes up to 20 ads from the provided Facebook Ad Library URL
Gemini's image generation may occasionally flag content as prohibited (workflow handles this automatically)
Generated ads maintain the original style while swapping product branding and packaging
All competitor reference ads and generated clones are automatically saved to Google Drive
Image generation takes approximately 10-30 seconds per ad

How it works
Form Submission: User submits a Facebook Ad Library URL and uploads their product image
Product Processing: The product image is converted to base64 for AI processing
Ad Scraping: Apify's Facebook Ad Library Scraper extracts up to 20 ads from the provided URL
Iteration Setup: The workflow processes each scraped ad individually
Image Download: Each competitor ad image is downloaded and converted to base64
Reference Storage: Original competitor ads are uploaded to Google Drive for reference
Prompt Generation: Gemini 2.5 Pro analyzes both images and creates detailed instructions for cloning the ad while replacing competitor branding with your product
Ad Generation: Gemini 2.5 Flash Image Preview generates the new ad image based on the instructions
Content Filter: Checks if generation was blocked for prohibited content
Upload & Loop: Successfully generated ads are uploaded to Google Drive, then the workflow moves to the next ad

How to use
Click the form trigger URL to access the submission form
Enter a Facebook Ad Library URL (e.g., from a competitor's page showing active ads)
Upload your product image with clear branding and packaging
Submit the form and wait for processing to complete
Find your cloned ads and reference images organized in Google Drive folders
Review generated ads and select the best performers for your campaigns

Requirements
Apify** account for Facebook Ad Library scraping
Google Gemini API** account for ad analysis and image generation
Google Drive** account for storing reference ads and generated clones
Valid Facebook Ad Library URL with accessible ads

Customizing this workflow
Adjust the number of ads scraped in the scrape_ads node (currently set to 20 per source)
Modify the prompt instructions in build_prompt node to emphasize different aspects (e.g., color schemes, layouts, text placement)
Change the Google Drive folders in upload_ad_reference and upload_image nodes to organize by campaign or product line
Add text overlay generation to include custom headlines or CTAs on generated images
Implement quality scoring to automatically filter and rank generated ad variations
Add Slack/email notifications when ad generation completes or fails
Include metadata extraction to capture ad copy and targeting insights from scraped adsRetryClaude does not have the ability to run the code it generates yet.

Nodes Used (2)

Google Drive
n8n-nodes-base.googleDrive
HTTP Request
n8n-nodes-base.httpRequest