Managing Google Ads budgets across dozens of campaigns is a challenge. When you add seasonal demand spikes, holiday patterns (like Turkish Mother's Day or Black Friday), and shifting conversion rates, manual budget allocation becomes impossible to scale.
In this case study, I'll walk through how I built a machine learning decision system that automates budget redistribution to maximize ROAS (Return on Ad Spend).
The Challenge: Intuition vs. Data
Before the system, budget changes were reactive. If a campaign hit its daily limit, we increased it. If ROAS dropped, we cut it. But this approach misses the opportunity cost: could that $100 have performed better in a different campaign that wasn't capped yet?
The Approach
1. Data Acquisition (Google Ads API)
Using Python, I pull granular performance data: impressions, clicks, cost, and conversions. I also engineer features for seasonal context (Is it a weekend? Is it a payday week in Turkey? Is it a holiday?).
2. The ML Model: Random Forest Regressions
I trained a Random Forest model to predict the marginal return of increasing budget for each campaign. The model answers: "If I give this campaign 20% more budget, what is the expected revenue based on current trends and seasonal history?"
# Example snippet of the feature engineering
df['is_payday'] = df['day'].apply(lambda x: 1 if 15 <= x <= 17 or 28 <= x <= 31 else 0)
df['seasonal_index'] = df.groupby('month')['conversions'].transform('mean')
3. The Optimization Engine
The system simulates 5 different budget scenarios for every campaign. It then uses a weighted scoring model to "move" budget from low-predicted-ROI campaigns to high-predicted-ROI ones.
The Business Impact
After deploying the system for a major Turkish e-commerce project, the results were clear:
- +30% Revenue Growth: Revenue increased significantly without increasing the total overall spend.
- +14.6x ROAS Stability: We maintained a high return even as we scaled volume.
- Automation: Saved over 40 hours of manual budget adjustments per month.
Technical Stack
- Language: Python (Pandas, Scikit-learn)
- Data: Google Ads API, SQL (BigQuery)
- Visualization: Power BI (for executive monitoring)
- Logic: Anthropic Claude context models for reasoning over text-based performance alerts.
Key Learnings
The biggest hurdle wasn't the code; it was the data quality. ML models are only as good as the tracking. Ensuring GA4 and Google Ads conversion data were 100% aligned was the first 3 weeks of the project.
If you're interested in the full technical architecture, you can view the GitHub Repository or reach out to discuss how this can be applied to your business.