It All Started With An Idea

Google Ads Automation Script for Reporting & Insights

The script is designed to automate reporting and provide actionable recommendations for managing Google Ads campaigns. Here’s what it does step by step:


Core Functions of the Script

  1. Date Calculations:
  2. Data Collection:
  3. Projections:
  4. Recommendations:
  5. Email Reporting:

Key Use Cases

  • Performance Monitoring:
  • Budget Pacing:
  • Strategic Planning:
  • Automation:

Benefits

  • Efficient Management:Provides real-time insights into campaign performance and spend.
  • Data-Driven Decisions:Shows the potential impact of different spend levels to maximize ROI.
  • Time-Saving:Automates data collection, analysis, and reporting, reducing manual effort.
  • Scalability:Works across multiple campaigns or accounts, making it suitable for managing larger advertising operations.

In essence, this script simplifies campaign management by automating tedious processes and delivering actionable insights in an easy-to-read email report.

Example Email

/** * Google Ads Script: Automated Budget Projection and Performance Recommendations * Features: * – Date-based calculations: today, yesterday, MTD, days in month, etc. * – Projected spend and performance metrics. * – Email reporting with actionable spend adjustment recommendations. * – Adjustments based on CVR (Conversion Rate). */ // Configuration const CONFIG = { EMAIL_RECIPIENTS: [‘team@company.com’], SUBJECT: ‘Google Ads Performance and Spend Recommendations’, ALERT_THRESHOLD: 0.1 // Allowance before sending recommendations }; function main() { const today = new Date(); const daysInMonth = new Date(today.getFullYear(), today.getMonth() + 1, 0).getDate(); const daysSpent = today.getDate(); const daysRemaining = daysInMonth – daysSpent; const daysSpentPercentage = (daysSpent / daysInMonth) * 100; const account = AdsApp.currentAccount(); const stats = account.getStatsFor(“THIS_MONTH”); const spendMTD = stats.getCost(); const clicksMTD = stats.getClicks(); const impressionsMTD = stats.getImpressions(); const conversionsMTD = stats.getConversions(); const ctrMTD = clicksMTD / impressionsMTD; const cvrMTD = conversionsMTD / clicksMTD; const projectedSpend = (spendMTD / daysSpent) * daysInMonth; const projectedClicks = (clicksMTD / daysSpent) * daysInMonth; const projectedImpressions = (impressionsMTD / daysSpent) * daysInMonth; const projectedConversions = (conversionsMTD / daysSpent) * daysInMonth; const projectedCTR = projectedClicks / projectedImpressions; // Recommendations based on spend increase const adjustments = [5, 10, 15, 25, 50, 100].map(percentage => { const increasedSpend = projectedSpend * (1 + percentage / 100); const adjustedClicks = projectedClicks * (1 + percentage / 100); const adjustedImpressions = projectedImpressions * (1 + percentage / 100); const adjustedConversions = projectedConversions * (1 + percentage / 100 * cvrMTD); return { percentage: percentage, spend: increasedSpend.toFixed(2), clicks: Math.round(adjustedClicks), impressions: Math.round(adjustedImpressions), conversions: Math.round(adjustedConversions) }; }); // Email report sendEmailReport( account.getName(), spendMTD, projectedSpend, daysRemaining, clicksMTD, projectedClicks, impressionsMTD, projectedImpressions, ctrMTD, projectedCTR, conversionsMTD, projectedConversions, adjustments ); } function sendEmailReport(accountName, spendMTD, projectedSpend, daysRemaining, clicksMTD, projectedClicks, impressionsMTD, projectedImpressions, ctrMTD, projectedCTR, conversionsMTD, projectedConversions, adjustments) { let htmlReport = ` <h1>Google Ads Performance Report for ${accountName}</h1> <p><strong>MTD Spend:</strong> ${spendMTD.toFixed(2)}</p> <p><strong>Projected Spend:</strong> ${projectedSpend.toFixed(2)}</p> <p><strong>Days Remaining:</strong> ${daysRemaining}</p> <h2>Performance Metrics</h2> <ul> <li><strong>Clicks MTD:</strong> ${clicksMTD} | Projected: ${Math.round(projectedClicks)}</li> <li><strong>Impressions MTD:</strong> ${impressionsMTD} | Projected: ${Math.round(projectedImpressions)}</li> <li><strong>CTR MTD:</strong> ${(ctrMTD * 100).toFixed(2)}% | Projected: ${(projectedCTR * 100).toFixed(2)}%</li> <li><strong>Conversions MTD:</strong> ${conversionsMTD} | Projected: ${Math.round(projectedConversions)}</li> </ul> <h2>Spend Adjustment Recommendations</h2> <table border=”1″> <thead> <tr> <th>Increase (%)</th> <th>Projected Spend</th> <th>Projected Clicks</th> <th>Projected Impressions</th> <th>Projected Conversions</th> </tr> </thead> <tbody> `; adjustments.forEach(adj => { htmlReport += ` <tr> <td>${adj.percentage}%</td> <td>${adj.spend}</td> <td>${adj.clicks}</td> <td>${adj.impressions}</td> <td>${adj.conversions}</td> </tr> `; }); htmlReport += ` </tbody> </table> `; MailApp.sendEmail({ to: CONFIG.EMAIL_RECIPIENTS.join(“, “), subject: CONFIG.SUBJECT, htmlBody: htmlReport }); }

About the author

John M. Williams — Founder, It All Started With An Idea. Senior paid media specialist with 15+ years and $350M+ in managed ad spend across Google, Meta, LinkedIn, and Amazon. Creator of Buddy, the open-source AI Google Ads agent. Hero Conf 2025 + 2026 speaker.

More about John · LinkedIn ↗ · GitHub ↗

Working notes

More from the blog.

Read the blog  Get a free audit