A production-ready web application that combines AI-powered content generation with real keyword data to create highly effective Google Ads campaigns. Built for marketing professionals who need powerful, data-driven campaign creation tools.
This tool revolutionizes Google Ads campaign creation by combining:
- Real Keyword Data: Semrush API integration for actual search volumes and competition metrics
- AI-Powered Content: OpenAI GPT-4 for intelligent ad copy generation
- Professional Workflow: Structured campaign building with export capabilities
- Smart Fallbacks: Graceful degradation when external APIs are unavailable
- Semrush Integration: Live keyword data with search volumes, CPC estimates, and competition analysis
- Context-Aware Generation: Keywords tailored to specific campaigns and business contexts
- AI Enhancement: OpenAI-powered keyword analysis and categorization
- Smart Categorization: Automatic grouping by volume, competition, and relevance
- Hierarchical Structure: Organized campaigns, ad groups, and keyword management
- Unit Type Campaigns: Special handling for real estate and location-based campaigns
- Dynamic Targeting: Keywords aligned with campaign objectives and budgets
- Theme-Based Organization: Focused keyword sets for maximum ad relevance
- Contextual Ad Copy: GPT-4 orchestrated content that aligns with keyword strategy
- Real-Time Validation: Character limit enforcement (headlines: 30, descriptions: 90, paths: 15)
- Brand Voice Integration: Consistent messaging across all campaign content
- Multi-Format Generation: Headlines, descriptions, and display URLs
- Google Ads Editor Ready: Direct CSV export for seamless campaign imports
- Multiple Formats: JSON, CSV support with planned Excel integration
- Data Integrity: Complete campaign structure preservation across exports
- Node.js (v14 or higher)
- OpenAI API Key (required) - Get from OpenAI Platform
- Semrush API Key (recommended) - Get from Semrush API
Create a .env file in the project root:
# Required: OpenAI API Key for AI-powered features
OPENAI_API_KEY=your_openai_api_key_here
# Recommended: Semrush API Key for real keyword data
SEMRUSH_API_KEY=your_semrush_api_key_here
# Server Configuration
PORT=3000
NODE_ENV=development# Install all dependencies
npm install
# Start the application
npm start
# For development with auto-reload
npm run devAccess the application: http://localhost:3000
Complete the client profile with:
- Business Details: Company name, website, industry vertical
- Target Audience: Demographics, geographic targeting, customer personas
- Marketing Goals: Campaign objectives, budget considerations, KPIs
- Brand Guidelines: Voice, tone, messaging preferences, CTAs
- Create Campaigns: Define clear objectives and budget allocation
- Build Ad Groups: Organize by themes, products, or services
- Structure Hierarchy: Logical organization for optimal performance
- Automated Analysis: AI analyzes client profile and campaign context
- Live Data Integration: Semrush provides real search volumes and competition
- Smart Categorization: Keywords organized by performance potential
- Strategic Alignment: Keywords matched to campaign goals and budget
- Context-Aware Creation: Ad copy generated based on keywords and client info
- Real-Time Optimization: Automatic character limit compliance
- Performance Focus: Content optimized for click-through rates
- Brand Consistency: Messaging aligned with client voice and guidelines
- Google Ads Ready: CSV format compatible with Google Ads Editor
- Complete Campaign Data: All elements preserved for immediate use
- Quality Assurance: Validation checks before export
- Runtime: Node.js with Express.js framework
- API Integration: RESTful architecture with robust error handling
- Security: Environment-based configuration management
- Performance: Optimized request handling and response caching
- Primary AI: OpenAI GPT-4 for complex analysis and orchestration
- Content Generation: GPT-3.5-Turbo for high-speed ad copy creation
- Keyword Data: Semrush API for professional market intelligence
- Fallback Systems: Graceful degradation when external services unavailable
- Framework: Modern vanilla JavaScript with ES6+ features
- Interface: Responsive design with professional UX
- Validation: Real-time input validation and feedback
- Storage: LocalStorage for session data persistence
| Endpoint | Method | Purpose | Parameters |
|---|---|---|---|
/api/generate-ad-copy |
POST | Generate AI-powered ad copy | clientInfo, campaignContext, adGroupContext, savedKeywords |
/api/generate-keywords |
POST | Generate keyword suggestions with real data | clientInfo, campaignContext, adGroupContext |
/api/health |
GET | System health and service status | None |
/ |
GET | Serve main application | None |
POST /api/generate-ad-copy
{
"clientInfo": {
"name": "Real Estate Agency",
"industry": "Real Estate",
"targetAudience": "Home buyers in Miami",
"uniqueSellingPoints": ["Local expertise", "24/7 service"]
},
"campaignContext": {
"name": "Miami Homes Campaign",
"objective": "Lead Generation",
"budget": 5000
},
"adGroupContext": {
"name": "Luxury Condos",
"theme": "High-end properties"
}
}- Graceful Degradation: System continues operation even if external APIs fail
- Comprehensive Logging: Detailed error tracking and debugging information
- Input Validation: Client-side and server-side data validation
- Rate Limiting: Responsible API usage with proper throttling
- Timeout Management: Prevents hanging requests and ensures responsiveness
google-ads-campaign-builder/
βββ server.js # Main Express server
βββ package.json # Dependencies and scripts
βββ .env # Environment variables
βββ index.html # Main application interface
βββ agentic_ad_copy_generator.js # Frontend AI integration
βββ ad_copy_generator.js # Rule-based ad generation
βββ openai_connector.js # OpenAI API integration
βββ openai_config.js # OpenAI configuration
βββ semrush_connector.js # Semrush API integration
βββ error_handling.js # Error management system
βββ test_semrush.js # Semrush API testing utilities
NODE_ENV=production
PORT=3000
OPENAI_API_KEY=your_production_key
SEMRUSH_API_KEY=your_production_key- Process Manager: PM2 for application management
- Reverse Proxy: Nginx for load balancing and SSL termination
- Security: HTTPS enforcement, API rate limiting, input sanitization
- Monitoring: Application performance monitoring and logging
- Backup: Regular data backup strategy
- Environment variables secured and configured
- API keys tested in production environment
- HTTPS/SSL certificates installed and configured
- Application monitoring and alerting configured
- Performance optimization and caching implemented
- Security headers and CORS properly configured
- Visit OpenAI Platform
- Create a new API key
- Add to
.envfile asOPENAI_API_KEY=your_key_here - Ensure billing is configured for API usage
- Visit Semrush API Documentation
- Sign up for API access
- Generate your API key
- Add to
.envfile asSEMRUSH_API_KEY=your_key_here - Test connection using the health endpoint
"OpenAI API key not configured"
- Verify
.envfile exists and containsOPENAI_API_KEY - Check API key validity on OpenAI platform
- Ensure billing is active on your OpenAI account
"Semrush integration unavailable"
- Verify
SEMRUSH_API_KEYin.envfile - Test API key using
/api/healthendpoint - Check Semrush account status and API limits
"Application won't start"
- Run
npm installto ensure all dependencies are installed - Check Node.js version (requires v14+)
- Verify port 3000 is available
- Check the
/api/healthendpoint for service status - Review application logs for detailed error information
- Verify all environment variables are properly configured
MIT License - See LICENSE file for details.
This project is optimized for marketing professionals and can be customized for various industries. Contributions welcome for:
- Additional export formats
- Enhanced keyword analysis
- Extended API integrations
- UI/UX improvements
Built for Marketing Professionals | Powered by AI | Real Data Integration