Google Ads Script Spend Report
Ullekh Tandon 0 Comments

Google Ads Script for Spends

Are you looking to maximize your Google Ads budget and gain better control over your campaign spending? Our custom Google Ads script is the solution you need! By automating reporting and budget monitoring directly in Google Sheets, you can optimize your ad performance and make data-driven decisions effortlessly.

Google Ads Script Features:

  1. Automated Reporting: Receive daily, weekly, or monthly reports directly in Google Sheets detailing campaign performance metrics such as clicks, impressions, conversions, and spend.

  2. Budget Management: Set predefined spending limits for different campaigns and receive alerts when thresholds are reached to prevent overspending.

  3. Performance Insights: Gain actionable insights into which campaigns are delivering the best results based on your specified KPIs.

How It Works:

  1. Installation: Simply install our Google Ads script in your Google Ads account. No coding required!

  2. Customization: Tailor the script to your specific needs by setting reporting intervals, budget limits, and performance metrics.

  3. Monitor & Optimize: Sit back and let the script do the work! Receive automated reports and notifications directly in Google Sheets, allowing you to make informed decisions in real-time.

Benefits of Google Ads Script:

  • Save Time: No more manual data entry or report generation. Our script handles everything automatically.
  • Maximize ROI: Optimize your ad spend by focusing on high-performing campaigns and reallocating budget where it matters most.
  • Stay Informed: Keep a close eye on your advertising performance without having to log into multiple platforms.

Get Started Today!

Take control of your Google Ads spending and drive better results with our innovative Google Ads script. Contact us now to learn more and start optimizing your advertising strategy like never before.

Script—> 

/*
// AdWords Script: Put Data From AdWords Report In Google Sheets
// ————————————————————–
// Copyright 2017 Optmyzr Inc., All Rights Reserved
//
// This script takes a Google spreadsheet as input. Based on the column headers, data filters, and date range specified
// on this sheet, it will generate different reports.
//
// The goal is to let users create custom automatic reports with AdWords data that they can then include in an automated reporting
// tool like the one offered by Optmyzr.
//
//
// For more PPC management tools, visit www.optmyzr.com
//
*/

var DEBUG = 0; // set to 1 to get more details about what the script does while it runs; default = 0
var REPORT_SHEET_NAME = “report”; // the name of the tab where the report data should go
var SETTINGS_SHEET_NAME = “settings”; // the name of the tab where the filters and date range are specified
var SPREADSHEET_URL = “https://docs.google.com/spreadsheets/d/1uwt6UkFuq87eGyCdCQK1tcWSleJ7KNz5ckIiBa7uAo4/edit#gid=1744470366”; // The URL to the Google spreadsheet with your report template

function main() {
var currentSetting = new Object();
currentSetting.ss = SPREADSHEET_URL;

// Read Settings Sheet
var settingsSheet = SpreadsheetApp.openByUrl(currentSetting.ss).getSheetByName(SETTINGS_SHEET_NAME);
var rows = settingsSheet.getDataRange();
var numRows = rows.getNumRows();
var numCols = rows.getNumColumns();
var values = rows.getValues();
var numSettingsRows = numRows – 1;

var sortString = “”;
var filters = new Array();
for(var i = 0; i < numRows; i++) {
var row = values[i];
var settingName = row[0];
var settingOperator = row[1];
var settingValue = row[2];
var dataType = row[3];
debug(settingName + ” ” + settingOperator + ” ” + settingValue);

if(settingName.toLowerCase().indexOf(“report type”) != -1) {
var reportType = settingValue;
} else if(settingName.toLowerCase().indexOf(“date range”) != -1) {
var dateRange = settingValue;
} else if(settingName.toLowerCase().indexOf(“sort order”) != -1) {
var sortDirection = dataType || “DESC”;
if(settingValue) var sortString = “ORDER BY ” + settingValue + ” ” + sortDirection;
var sortColumnIndex = 1;
}else {
if(settingOperator && settingValue) {
if(dataType.toLowerCase().indexOf(“long”) != -1 || dataType.toLowerCase().indexOf(“double”) != -1 || dataType.toLowerCase().indexOf(“money”) != -1 || dataType.toLowerCase().indexOf(“integer”) != -1) {
var filter = settingName + ” ” + settingOperator + ” ” + settingValue;
} else {
if(settingValue.indexOf(“‘”) != -1) {
var filter = settingName + ” ” + settingOperator + ‘ “‘ + settingValue + ‘”‘;
} else if(settingValue.indexOf(“‘”) != -1) {
var filter = settingName + ” ” + settingOperator + ” ‘” + settingValue + “‘”;
} else {
var filter = settingName + ” ” + settingOperator + ” ‘” + settingValue + “‘”;
}
}
debug(“filter: ” + filter)
filters.push(filter);
}
}
}

// Process the report sheet and fill in the data
var reportSheet = SpreadsheetApp.openByUrl(currentSetting.ss).getSheetByName(REPORT_SHEET_NAME);
var rows = reportSheet.getDataRange();
var numRows = rows.getNumRows();
var numCols = rows.getNumColumns();
var values = rows.getValues();
var numSettingsRows = numRows – 1;

// Read Header Row and match names to settings
var headerNames = new Array();
var row = values[0];
for(var i = 0; i < numCols; i++) {
var value = row[i];
headerNames.push(value);
//debug(value);
}

if(reportType.toLowerCase().indexOf(“performance”) != -1) {
var dateString = ‘ DURING ‘ + dateRange;
} else {
var dateString = “”;
}
if(filters.length) {
var query = ‘SELECT ‘ + headerNames.join(“,”) + ‘ FROM ‘ + reportType + ‘ WHERE ‘ + filters.join(” AND “) + dateString + ” ” + sortString;
} else {
var query = ‘SELECT ‘ + headerNames.join(“,”) + ‘ FROM ‘ + reportType + dateString + ” ” + sortString;
}
debug(query);
var report = AdWordsApp.report(query);
try {
report.exportToSheet(reportSheet);
var subject = “Your ” + reportType + ” for ” + dateRange + ” for ” + AdWordsApp.currentAccount().getName() + ” is ready”;
var body = currentSetting.ss + “<br>You can now add this data to <a href=’https://www.optmyzr.com’>Optmyzr</a> or another reporting system.”;
MailApp.sendEmail(EMAIL_ADDRESSES, subject, body);
Logger.log(“Your report is ready at ” + currentSetting.ss);
Logger.log(“You can include this in your scheduled Optmyzr reports or another reporting tool.”);
} catch (e) {
debug(“error: ” + e);
}

}

function debug(text) {
if(DEBUG) Logger.log(text);
}

 Outbound Link –> https://youtu.be/qBmpmT3ZzIU

You can visit Blog for Performance Max Campaign Script