What This Agent Does
This powerful workflow automates your Facebook Ads performance analysis and reporting by combining real-time ad data with AI-powered insights. The agent pulls your latest Facebook Ads metrics, analyzes performance against industry benchmarks, generates strategic recommendations from a Senior Media Buyer perspective, and automatically populates a Google Sheet with actionable insights—all triggered with a single click.
Key benefits and time savings:
-
Eliminate manual reporting: Automatically fetch and analyze ad performance without copy-pasting data
-
AI-powered insights: Leverage advanced AI analysis to identify optimization opportunities instantly
-
Benchmark comparison: Understand how your ads perform against industry standards
-
Centralized reporting: All insights flow directly into your Google Sheet for easy sharing and tracking
-
Save 2-3 hours weekly: Reduce time spent on ad analysis and reporting tasks
Target use cases:
- Digital marketing agencies managing multiple client ad accounts
- E-commerce businesses optimizing ad spend across campaigns
- Marketing teams conducting weekly performance reviews
- Performance marketers seeking data-driven optimization recommendations
Who Is It For
This workflow is ideal for marketing professionals and teams who:
- Run Facebook Ads campaigns and need regular performance analysis
- Want AI-powered recommendations without hiring additional analysts
- Prefer automated reporting over manual spreadsheet updates
- Need to justify ad spend with data-backed insights
- Manage multiple ad accounts and require consistent analysis
Whether you're a solo marketer, agency owner, or part of a larger marketing team, this agent streamlines your workflow and elevates your decision-making with intelligent analysis.
Required Integrations
Facebook Ads
Why it's needed: This integration connects TaskAGI to your Facebook Ads account, enabling the workflow to retrieve real-time performance metrics for all your active campaigns and ads.
Setup steps:
- Navigate to the Integrations section in TaskAGI
- Search for and select Facebook Ads
- Click Connect or Authenticate
- You'll be redirected to Meta's login page—sign in with your Facebook account
- Review and approve the requested permissions (access to ad accounts and insights)
- Confirm the integration is active by seeing a green checkmark
How to obtain API keys/credentials:
- TaskAGI uses OAuth 2.0 authentication, so you don't need manual API keys
- Ensure your Facebook account has Admin or Analyst access to the ad account you want to analyze
- If you manage multiple ad accounts, you can select which account to pull data from during workflow configuration
Configuration in TaskAGI:
- After authentication, select your Ad Account ID from the dropdown menu
- Choose your preferred date range for data retrieval (last 7 days, 30 days, custom range)
- Select metrics to retrieve such as: Impressions, Clicks, Spend, Conversions, ROAS, CPC, CTR
- Test the connection by clicking Verify Connection
Google Gemini
Why it's needed: Google Gemini (powered by Gemini 2.5 Flash) provides the AI analysis engine that transforms raw ad data into strategic, actionable recommendations using advanced language models.
Setup steps:
- Go to Integrations in TaskAGI and search for Google Gemini
- Click Connect or Add Integration
- Sign in with your Google account (use the account associated with Google Cloud)
- Grant TaskAGI permission to access Google Gemini API
- Verify the integration shows as Active
How to obtain API keys/credentials:
- Visit Google Cloud Console
- Create a new project or select an existing one
- Enable the Gemini API in your project
- Generate an API key from the Credentials section
- Copy the API key and paste it into TaskAGI's integration settings
- Alternatively, use OAuth authentication (recommended for security)
Configuration in TaskAGI:
- Select Model:
gemini-2.5-flash (already pre-configured in this workflow)
- Set Temperature:
0.7 (balances creativity with consistency)
- Set Max tokens:
2000 (sufficient for detailed analysis)
- The AI prompt is pre-configured with a Senior Media Buyer persona—you can customize it if needed
Google Sheets
Why it's needed: Google Sheets serves as your centralized repository for all AI-generated insights, creating a permanent record of analysis and recommendations that your team can access, share, and reference.
Setup steps:
- Open Integrations in TaskAGI and find Google Sheets
- Click Connect or Authenticate
- Sign in with your Google account
- Authorize TaskAGI to create, read, and modify spreadsheets
- Confirm the integration is active
How to obtain API keys/credentials:
- Google Sheets uses OAuth authentication (no manual API keys needed)
- Ensure your Google account has Editor access to the spreadsheet you'll use
- If sharing with team members, grant them Editor permissions on the Google Sheet
Configuration in TaskAGI:
- Create a new Google Sheet or use an existing one
- Copy the Sheet URL from your browser's address bar
- In the workflow node "Update Sheet with AI Insights," paste the Sheet URL in the
sheet_url parameter
- Define column headers in your Sheet:
Ad Name, Campaign, Spend, ROAS, AI Insights, Recommendations, Date
- Test by running a workflow execution and verifying data appears in your Sheet
Configuration Steps
Node-by-Node Configuration Guidance
1. Overview Node (core.workflow_note)
- This is a documentation node—no configuration needed
- It displays workflow purpose and instructions to users
- Update the note with your team's specific goals or guidelines
2. Manual Trigger (trigger.manual)
-
Configuration: No setup required
-
How it works: Click the "Run Workflow" button to execute the entire analysis
-
Tip: Schedule regular runs (e.g., every Monday morning) using TaskAGI's scheduling feature
3. Get Facebook Ads Insights (facebookads.getInsightsAdvanced)
-
Parameters to configure:
-
ad_account_id: Select from authenticated Facebook account dropdown
-
date_range: Choose last_7_days, last_30_days, or specify custom dates
-
metrics: Select all relevant metrics (Impressions, Clicks, Spend, Conversions, ROAS, CPC, CTR)
-
breakdown_by: Set to ad to get individual ad performance
-
Example output: JSON array containing all ads with their performance metrics
-
Data passed to next node: Raw ad performance data
4. Process Ad Data (core.function)
-
Purpose: Cleans and structures raw Facebook data for analysis
-
Configuration:
- Input: Raw insights from Facebook Ads node
- Function: Filters out underperforming ads (optional threshold)
- Output: Structured array of ad objects with standardized fields
-
Example transformation: Converts
spend from cents to dollars, rounds metrics to 2 decimals
5. Calculate Benchmarks (core.function)
-
Purpose: Computes industry benchmarks and performance ratios
-
Configuration:
- Input: Processed ad data
- Calculations: Average ROAS, median CPC, CTR benchmarks by industry
- Output: Benchmark object with comparative metrics
-
Example: If your average ROAS is 3.2, this node identifies it as "above average" (benchmark: 2.5)
6. AI Media Buyer Analysis (googlegemini.generateContent)
-
Pre-configured prompt: Senior Facebook Ads Media Buyer persona
-
Input data: Processed ads + calculated benchmarks
-
Configuration:
- Model:
gemini-2.5-flash
- Temperature:
0.7
- Max tokens:
2000
-
Prompt includes: Performance analysis, optimization recommendations, budget allocation suggestions
-
Output: Detailed AI analysis as text
7. Parse AI Response (core.parse_output)
-
Purpose: Extracts structured insights from AI's text response
-
Configuration:
- Input: Raw AI analysis text
- Parsing rules: Extract recommendations, insights, and action items
- Output: Structured JSON with categorized insights
-
Example output:
{ "strengths": [...], "improvements": [...], "actions": [...] }
8. Prepare Raw Data for Sheets (core.function)
-
Purpose: Formats all data for Google Sheets insertion
-
Configuration:
- Input: Processed ads + AI insights
- Formatting: Creates rows matching your Sheet structure
- Output: Array of row objects ready for Sheets
9. Loop Through AI Analysis (core.loop)
-
Purpose: Iterates through each ad to update the Sheet individually
-
Configuration:
- Loop over: Prepared data rows
- Iteration variable:
current_ad
- Loop path: Connects to "Find Row for Ad" node
10. Find Row for Ad (core.function)
-
Purpose: Locates the correct row in Google Sheets for each ad
-
Configuration:
- Input: Current ad from loop
- Search criteria: Match ad name or ID
- Output: Row number in Sheet
11. Update Sheet with AI Insights (googlesheets.appendRowFromUrl)
-
Critical configuration:
-
sheet_url: Paste your Google Sheet URL (currently null—must be configured)
-
sheet_name: Name of the worksheet (e.g., "Ad Analysis")
-
values: Array of data to insert (ad name, metrics, AI insights)
-
append_mode: Set to true to add new rows without overwriting
-
Example Sheet URL:
https://docs.google.com/spreadsheets/d/1a2b3c4d5e6f7g8h9i0j/edit
Testing Your Agent
Step 1: Pre-Execution Checklist
Before running your workflow, verify:
- ✅ Facebook Ads integration is authenticated and shows active
- ✅ Google Gemini integration is connected
- ✅ Google Sheets integration is authorized
- ✅ Sheet URL is entered in the "Update Sheet with AI Insights" node
- ✅ Your Google Sheet has proper column headers
- ✅ You have at least 3-5 active ads in your Facebook account
Step 2: Run Test Execution
- Click the Run Workflow button in TaskAGI
- Monitor the execution in real-time using the Execution Log
- Watch for green checkmarks indicating successful node completion
Step 3: Verify at Each Step
After "Get Facebook Ads Insights":
- Check the output contains your ad data
- Verify metrics are populated (spend, impressions, clicks)
- Confirm date range matches your selection
After "Calculate Benchmarks":
- Review benchmark values are reasonable
- Verify ROAS and CPC calculations are correct
- Check that comparisons show "above/below average" status
After "AI Media Buyer Analysis":
- Read the AI-generated insights in the execution log
- Verify recommendations are specific and actionable
- Ensure the analysis mentions actual ad names and metrics
After "Update Sheet with AI Insights":
- Open your Google Sheet
- Verify new rows have been added with all data
- Check that AI insights are properly formatted and readable
Step 4: Expected Results and Success Indicators
Successful execution shows:
- ✅ All 11 nodes complete without errors (red indicators)
- ✅ Execution time: 30-60 seconds (depending on ad account size)
- ✅ New rows appear in your Google Sheet within 2 minutes
- ✅ AI insights are detailed, specific, and reference actual ad performance
- ✅ No duplicate rows (if running multiple times)
Common issues and solutions:
-
"Sheet URL is null" error: Paste your Google Sheet URL in the final node
-
No data appears: Verify Facebook Ads account has active campaigns
-
Duplicate rows: Enable deduplication in the Sheets node
-
AI insights are generic: Check that benchmark data is being passed correctly
Next steps after successful test:
- Review the AI insights and verify they're actionable
- Customize the AI prompt if needed for your industry
- Set up a schedule to run this workflow weekly or daily
- Share the Google Sheet with your team for collaborative review
Congratulations! Your Facebook Ads analysis agent is now live and ready to transform your ad performance data into strategic insights.