📋 Overview
This n8n workflow automates competitive analysis by:
AI-powered competitor discovery using Claude Sonnet 4
Multi-platform ad scraping (Google Ads, Facebook/Meta, LinkedIn, TikTok)
Deep AI analysis of messaging, keywords, and strategies
Automated scoring of opportunities and threats
Executive HTML reports delivered via email
Time Savings: ~4-6 hours per week of manual competitive research
ROI: 10-50x through automated insights and faster market response
✨ Key Features
🔍 Intelligent Competitor Discovery
Claude AI identifies direct competitors based on your business profile
Focuses on single most relevant competitor per analysis
Industry-specific competitive intelligence
📊 Multi-Platform Ad Monitoring
Google Ads Transparency - Search and display campaigns
Facebook/Meta Ad Library - Social advertising strategies
LinkedIn Ads - B2B professional targeting
TikTok Ads - Short-form video campaigns
🧠 AI-Powered Analysis
Extracts ad copy, keywords, and messaging themes
Identifies competitive advantages and market gaps
Provides actionable recommendations
Calculates opportunity and threat scores
📈 Strategic Scoring System
Opportunity Score (0-100) - Market gaps and growth potential
Threat Score (0-100) - Competitive pressure assessment
Priority Levels - High/Medium/Low action items
Confidence Ratings - AI analysis reliability scores
📧 Professional Reporting
Beautifully formatted HTML email reports
Executive summary with key findings
Detailed competitive insights
Strategic recommendations
🛠️ Prerequisites
Required Services & API Keys
n8n Instance (self-hosted or cloud)
Version 1.0+ recommended
Webhook/form trigger support enabled
Anthropic API Key (Claude)
Model: Claude Sonnet 4 (claude-sonnet-4-20250514)
Cost: ~$10-15/month for weekly reports
Apify Account (Ad Scraping)
Free tier: 5 actors, limited runs
Paid tier recommended: $49/month for reliable scraping
Required Actors:
Google Ads Transparency Scraper (shashankms2580/google-ads-transparency-scraper)
Facebook Ads Scraper (anchor/facebook-ads-scraper)
LinkedIn Ads Scraper (anchor/linkedin-ads-scraper)
TikTok Ads Scraper (worldwidestore/tiktok-ads-scraper)
Gmail Account (Report Delivery)
OAuth2 authentication required
Setup in n8n credentials manager
📦 Installation & Setup
Step 1: Import Workflow
Download
Competitor_Ad_Tracking_System_SANITIZED.jsonOpen your n8n instance
Click Import → From File
Select the downloaded JSON file
Workflow will appear in your workflows list
Step 2: Configure Credentials
IMPORTANT: Never paste API keys directly into code nodes. Always use n8n’s credential manager.
A. Anthropic API Credential
In n8n, go to Settings → Credentials
Click Add Credential → Anthropic API
Enter your API key from https://console.anthropic.com/
Save with name “Anthropic account”
B. Apify API Credential
Go to Settings → Credentials
Click Add Credential → Apify API
Enter your Apify API token from https://console.apify.com/account/integrations
Save with name “Apify account”
C. Gmail OAuth2 Credential
Go to Settings → Credentials
Click Add Credential → Gmail OAuth2 API
Follow n8n’s OAuth2 setup wizard
Authorize Gmail access
Save with name “Gmail account”
Step 3: Attach Credentials to Nodes
Open the workflow and attach credentials to these nodes:
🔍 AI Competitor Discovery → Attach “Anthropic account”
🧠 AI Ad Copy & Keywords Analysis → Attach “Anthropic account”
Message a model → Attach “Anthropic account”
Google Ads → Attach “Apify account”
Facebook Ads Scraper → Attach “Apify account”
LinkedIn Ads Scraper → Attach “Apify account”
TikTok Ads Scraper → Attach “Apify account”
📧 Send Weekly Intelligence Report → Attach “Gmail account”
Step 4: Configure Email Recipient
Open the 📧 Send Weekly Intelligence Report node
Change
sendToparameter from[email protected]to your actual emailSave the node
Step 5: Activate Workflow
Click the Activate toggle in the top-right
Copy the webhook URL from the On form submission node
You’re ready to run your first analysis!
🚀 Usage
Web Form Method (Recommended)
Navigate to your workflow’s webhook URL
Fill out the competitive intelligence form:
Business Name: Your company name
Business Domain: Your website (e.g., yourcompany.com)
Industry Keywords: Comma-separated (e.g., “SaaS, marketing automation, analytics”)
Click Submit
Wait 2-5 minutes for analysis to complete
Check your email for the comprehensive report
Manual Execution
Open the workflow in n8n
Click Execute Workflow button
Manually input business details when prompted
View results in execution log
📊 Understanding the Report
Your weekly report includes:
1. Executive Summary
High-level overview of competitive landscape and key findings
2. Competitor Profile
Name and domain
Focus area and positioning
Scan date and metadata
3. Advertising Intelligence
Ad Copies: Actual ads from competitors
Keywords: Target keywords identified
Messaging Themes: Brand messaging patterns
Targeting Insights: Audience demographics
4. Competitive Analysis
Advantages: What competitors do well
Opportunity Gaps: Market openings you can exploit
Threat Level: High/Medium/Low competitive pressure
5. Strategic Scoring
Opportunity Score: Market potential (0-100)
Threat Score: Competitive risk (0-100)
Priority Level: Action urgency
Confidence Score: AI analysis reliability
6. Recommended Actions
Specific, prioritized steps to improve competitive position
🔧 Configuration Options
Competitor Discovery Settings
Edit the 🔍 AI Competitor Discovery node to adjust:
{ "model": "claude-sonnet-4-20250514", "max_tokens": 1000, "temperature": 0.3 // Lower = more focused, Higher = more creative}
To find multiple competitors:
Change system prompt to request “top 3 competitors” instead of “top direct competitor”
Adjust
max_tokensto 2000+ for longer responses
Ad Scraping Limits
Adjust data collection in Apify actor nodes:
Google Ads node:
{ "maxResults": 20, // Increase for more ads (costs more) "region": "US" // Change for different regions}
Apply similar adjustments to Facebook, LinkedIn, TikTok nodes
Analysis Depth
Edit 🧠 AI Ad Copy & Keywords Analysis node:
{ "max_tokens": 3000, // More tokens = deeper analysis "temperature": 0.2 // Lower for consistency, higher for creativity}
Report Frequency
Currently form-triggered. To schedule weekly reports:
Replace On form submission node with Schedule Trigger
Set cron expression:
0 9 * * 1(Every Monday at 9 AM)Add a Set node to define business variables
💰 Cost Breakdown
Estimated Monthly Costs (Weekly Reports)
Service | Usage | Cost |
|---|---|---|
Anthropic Claude API | ~15K tokens/report × 4 weeks | $10-15 |
Apify Actors | 4 actors × 4 runs/month | $49-99 |
n8n Cloud (optional) | Workflow hosting | $20-50 |
Gmail | Email delivery | Free |
Total | $79-164/month |
Cost Optimization Tips
Use Apify Free Tier for testing (5 actors, limited runs)
Reduce ad scraping frequency to bi-weekly
Self-host n8n to eliminate hosting costs
Limit Apify maxResults to reduce actor runtime
Use Claude Haiku for faster, cheaper analysis (trade-off: less detailed)
🐛 Troubleshooting
Common Issues
1. “Paired Item” Errors in Parse AI Analysis
Solution: Already fixed in this workflow using $itemIndex approach
2. Apify Actors Timeout
Cause: Scrapers take too long or hit rate limits Solution:
Increase timeout in Apify node settings
Reduce
maxResultsparameterEnable Apify proxy in actor settings
3. Claude API Returns Empty Response
Cause: Invalid JSON formatting or API quota exceeded Solution:
Check Anthropic console for API errors
Verify credential is correctly attached
Ensure you have API credits remaining
4. Gmail Not Sending Reports
Cause: OAuth2 token expired or insufficient permissions Solution:
Reconnect Gmail OAuth2 credential
Ensure “Send email” permission is granted
Check Gmail quota limits (500 emails/day)
5. No Competitors Found
Cause: Claude couldn’t identify competitors from input Solution:
Provide more specific industry keywords
Include detailed business description
Check Claude API response in execution log
6. Workflow Runs But No Email Received
Check:
Email address is correct in Send Email node
Gmail credential is properly attached
Check spam/junk folder
Review execution log for errors
🔐 Security Best Practices
Credential Management
✅ DO: Store all API keys in n8n’s credential manager
✅ DO: Use environment variables for sensitive data
❌ DON’T: Paste API keys directly into Code nodes
❌ DON’T: Share workflows with credentials attached
Data Privacy
Competitor data is processed in-memory only
No data storage except in execution logs (configurable)
Email reports contain sensitive competitive intelligence
Use encrypted email or secure delivery method
Limit recipient list to authorized personnel
Rotating Credentials
If credentials are compromised:
Immediately revoke API keys in respective consoles
Generate new keys
Update credentials in n8n
Review execution logs for unauthorized access
📈 Advanced Usage
Integration with Google Sheets
Add a Google Sheets node after Aggregate All Results:
{ "operation": "append", "sheetId": "YOUR_SHEET_ID", "range": "A:Z"}
Map these fields:
scan_date,competitor_name,competitor_domainopportunity_score,threat_score,priority_levelkeywords_identified,messaging_themes
Slack Notifications
Replace or supplement Gmail with Slack node:
{ "resource": "message", "operation": "post", "channel": "#competitive-intel", "text": "New competitor report ready!"}
Database Storage (PostgreSQL/MySQL)
Add database node for historical tracking:
INSERT INTO competitor_tracking (
scan_date, competitor_name, opportunity_score,
threat_score, keywords, raw_analysis
) VALUES (?, ?, ?, ?, ?, ?)
🤝 Contributing
Improvements and feature requests are welcome!
To contribute:
Fork this workflow
Make your enhancements
Test thoroughly
Share sanitized version (no credentials!)
Document changes in README
Feature ideas:
Multi-competitor batch analysis
Historical trend tracking
Automated A/B test recommendations
Competitive pricing intelligence
Social media sentiment analysis
📄 License
MIT License - Free to use, modify, and distribute
🆘 Support
Issues & Questions:
Open an issue on GitHub
Check n8n community forum: https://community.n8n.io/
Review Anthropic documentation: https://docs.anthropic.com/
Consult Apify actor documentation
Professional Support:
For custom implementations or enterprise support
Email: [your-support-email]
💡 Use Cases
Marketing Teams
Monitor competitor campaign launches
Track messaging trends across platforms
Identify underserved audience segments
Optimize ad spend based on competitive intelligence
Product Managers
Understand competitive feature positioning
Track competitor product launches
Identify market gaps for new features
Monitor competitive pricing strategies
Agencies
Deliver competitive intelligence to clients
Benchmark client performance against industry
Generate monthly competitive reports
Support strategic planning with data
E-commerce
Track competitor promotional strategies
Monitor seasonal campaign trends
Identify winning ad copy patterns
Optimize product positioning
🎯 Workflow Architecture
Form Trigger
↓
AI Competitor Discovery (Claude)
↓
Parse JSON Response
↓
Parse Competitor Data
↓
┌─────────────────────────────────────┐
│ Parallel Ad Scraping (Apify) │
│ ├─ Google Ads Transparency │
│ ├─ Facebook/Meta Ad Library │
│ ├─ LinkedIn Ads │
│ └─ TikTok Ads │
└─────────────────────────────────────┘
↓
Merge All Ad Data
↓
AI Analysis (Claude)
↓
Parse Analysis Results
↓
Competitive Opportunity Scoring
↓
Aggregate Results
↓
Generate Executive Report (Claude)
↓
Send Email Report (Gmail)