Free Google Ads Script – Daily Budget Pacing Status Against Day of Month Percentage
This script will allow you to receive daily emails that keep you updated on budget status in percentage form.
It shows you the percentage and value of your pre-set budget spent as of month to date. It also presents the current day of month in a percentage and warns you if you are above or under pacing your budgets.
This alert will keep you pacing your budget evenly through the month and make it harder to miss surges in your daily spend against what you should be spending.
If you are working on a seasonal account, where a month end is stronger spend than earlier, it may not work for you. But if you generally have and expect an even budget spend through the month, this works a treat!
In the next version, we will have a spreadsheet link, to allow you to manage monthly budgets by clients in a central place, rather than updating each script on every account.
Feel free to use this for free, enjoy!
Free Script for daily alerts on Google Ads budget pacing in percentage and value form, against day of month
Copy and paste this free script into Google Ads and amend a few lines below on a monthly basis (1st of month).
- var MONTHLY_BUDGET
- var CONVERSION_VALUE_TARGET
- var CONVERSIONS_TARGET
- var EMAIL_ADDRESS
- var EMAIL_SUBJECT
// Copyright 2023, Capewind Ventures Limited. All Rights Reserved.
//
// Created by MAM Digital for free public use license - enjoy
//
// http://www.mamdigital.co.uk
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @name Monthly Budget Pacing Status
*
* @overview This script supports a view of key account information
* in a handy percentage form. You can use it to understand pacing
* against the expected path of performance for current month to date
*
* @author darryl@capewind.ventures
*
* @version 1.4
*
*/
var MONTHLY_BUDGET = XXXXX; // set your total monthly account budget target
var CONVERSION_VALUE_TARGET = XXXXX; // set your conversion value target
var CONVERSIONS_TARGET = XXXXX; // set your conversions target
var EMAIL_ADDRESS = "XXXXX@XXXXX.COM"; // insert your email address between the quotes
var EMAIL_SUBJECT = "XXXXX | Budget Target Status"; // insert your subject between the quotes
var EMAIL_BODY =
"---\n" +
"Monthly Budget Pacing Status\n" +
"---\n" +
"This script is provided by MAM Digital, specialists in Google Ads performance & scripting. Visit us at www.mamdigital.co.uk\n" +
"---\n";
function main() {
var account = AdsApp.currentAccount();
var currentDate = new Date();
var firstDayOfMonth = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1);
var lastDayOfMonth = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0);
var report = AdsApp.report(
"SELECT Cost, Conversions, ConversionValue " +
"FROM CAMPAIGN_PERFORMANCE_REPORT " +
"WHERE Cost > 0 " +
"DURING " +
formatDate(firstDayOfMonth) + "," +
formatDate(lastDayOfMonth)
);
var rows = report.rows();
var costSpent = 0;
var totalConversions = 0;
var totalConversionValue = 0;
while (rows.hasNext()) {
var row = rows.next();
costSpent += parseFloat(row["Cost"]);
totalConversions += parseFloat(row["Conversions"]);
totalConversionValue += parseFloat(row["ConversionValue"]);
}
var currentDay = currentDate.getDate();
var totalDays = lastDayOfMonth.getDate();
var dayPercentage = (currentDay / totalDays) * 100;
var costPercentage = (costSpent / MONTHLY_BUDGET) * 100;
var conversionsPercentage = (totalConversions / CONVERSIONS_TARGET) * 100;
var conversionValuePercentage = (totalConversionValue / CONVERSION_VALUE_TARGET) * 100;
var emailBody = EMAIL_BODY;
emailBody += "Current Monthly Spend: $" + costSpent.toFixed(2) + "\n";
emailBody += "Budget Target: $" + MONTHLY_BUDGET.toFixed(2) + "\n";
emailBody += "\n\n"; // Two-line break
emailBody += "Current Month-to-Date Conversion Value: $" + totalConversionValue.toFixed(2) + "\n";
emailBody += "Conversion Value Target: $" + CONVERSION_VALUE_TARGET.toFixed(2) + "\n";
emailBody += "\n\n"; // Two-line break
emailBody += "Current Month-to-Date Conversions: " + Math.round(totalConversions) + "\n";
emailBody += "Conversions Target: " + CONVERSIONS_TARGET + "\n";
emailBody += "\n\n"; // Two-line break
emailBody += "Percentage of Budget Spent: " + costPercentage.toFixed(2) + "%\n";
emailBody += "Conversions Target Achievement: " + conversionsPercentage.toFixed(2) + "%\n";
emailBody += "Conversion Value Target Achievement: " + conversionValuePercentage.toFixed(2) + "%\n";
emailBody += "Day of the Month Percentage: " + dayPercentage.toFixed(2) + "%\n";
if (dayPercentage > costPercentage) {
emailBody +=
"\nIt looks like you are spending behind the current month pacing. This will mean unused budget by month end, you should consider upweighting your bids.";
} else if (costPercentage > dayPercentage) {
emailBody +=
"\nIt looks like you are overpacing the spend this month. You may need to pull back to avoid exhausting the budget before month end.";
}
// Send email alert
MailApp.sendEmail(EMAIL_ADDRESS, EMAIL_SUBJECT, emailBody);
}
function formatDate(date) {
var year = date.getFullYear();
var month = (date.getMonth() + 1).toString().padStart(2, "0");
var day = date.getDate().toString().padStart(2, "0");
return year + month + day;
}