Automated Meta Video Ad Analysis with n8n & Google Gemini

paid
3 min read
Automated Meta Video Ad Analysis with n8n & Google Gemini

I created this n8n-Workflow to build my own personal library of successful video ads to use for inspiration or even as a a training set for ai-based story board writing. I've recently shared a similar workflow, but improved it significantly. It now also saves the videos to google drive and should generally work better than the old one.

What This Workflow Does

This n8n workflow creates an end-to-end automation that:

  1. Scrapes the Meta Ad Library for active ads based on a specified URL
  2. Filters for video ads and sorts them by reach or duration
  3. Downloads the video files and saves them to Google Drive.
  4. Uses Google Gemini to analyze the video content
  5. Parses the analysis into structured data
  6. Saves all information in a Google Sheet

The beauty of this workflow is that it requires minimal manual intervention once set up, allowing you to regularly analyze competitor ads or monitor your own ad performance.

Setting Up the Workflow

Prerequisites

To use this workflow, you'll need:

  • An n8n account
  • An Apify account (for the Meta Ad Library scraper)
  • A Google account (for Google Drive and Sheets)
  • A Google Gemini API key

Configuration Steps

The workflow begins with a "Settings" node where you can configure:

  1. Meta Ad Library URL: The specific URL of the Facebook Ad Library you want to analyze
  2. Maximum Ads to Scrape: How many ads to collect from the library
  3. Maximum Ads to Analyze: How many of the scraped ads to process through AI analysis
  4. Analysis Prompt: The instructions for the AI to follow when analyzing each video

The prompt is particularly comprehensive, instructing the AI to analyze:

  • Hook effectiveness
  • Full transcript
  • Ad format identification
  • Concept summary
  • Narrative breakdown (beginning, middle, end)

How the Workflow Functions

1. Data Collection

The workflow first connects to Apify to scrape the Meta Ad Library using the URL you provided. It calculates how long each ad has been running and sorts them by reach or duration to prioritize the most important ads.

2. Processing the Videos

For each video ad:

  1. The workflow downloads the video file
  2. Saves it to Google Drive (you'll need to specify a folder)
  3. Prepares the video for AI analysis by generating upload URLs for Google Gemini

3. AI Analysis

Google Gemini processes each video according to the detailed prompt, which instructs it to:

  • Analyze the hook (first few seconds)
  • Transcribe all spoken content
  • Identify the ad format (testimonial, before/after, etc.)
  • Summarize the concept
  • Break down the narrative structure

4. Structured Data Output

The analysis is then parsed into a structured format with:

  • Hook (max 120 characters)
  • Transcript
  • Ad format
  • Overall concept
  • Beginning, middle, and end descriptions

5. Data Storage

Finally, all this information is stored in a Google Sheet, along with:

  • Ad ID
  • Video URL
  • EU reach metrics
  • Landing page URL
  • Page name
  • Link to the ad in the Ad Library

Business Applications

This workflow can be invaluable for:

  1. Competitive Analysis: Understand what your competitors are doing with their most successful ads
  2. Creative Inspiration: Identify effective hooks and narrative structures
  3. Performance Tracking: Monitor which of your own ads are performing best
  4. Industry Trends: Track changes in advertising approaches over time

Customization Options

The workflow is highly customizable:

  • You can modify the AI prompt to focus on specific aspects of the ads
  • Adjust the sorting criteria to prioritize different metrics
  • Change the output format in Google Sheets
  • Scale the number of ads analyzed based on your needs

Limitations to Consider

While powerful, this workflow has some limitations:

  1. Apify has usage limits depending on your subscription
  2. Google Gemini API also has rate limits and costs
  3. Video analysis can take significant time for large numbers of ads
  4. The analysis is only as good as the AI prompt you provide

Downloads

This is a resource for paid members of my newsletter – you'll receive the needed file and updates whenever I publish new content. I don't have the time to spam you – I just want to share my knowledge and build a community of like-minded people. And you can obviously unsubscribe anytime if I happen to not deliver on my promise.

Once you've subscribed the article is unlocked and you can directly download the files to get started with this workflow.