Free Google Ads scripts
In short. Five of the checks Admiral runs, as scripts you can paste into your own Google Ads account today. Each one reads the account and lists what it finds. None of them changes anything, and there is nothing to sign up for.
How to run one
- Open Scripts. In Google Ads, go to Tools, then Bulk actions, then Scripts.
- Paste it. Press the plus button, paste the script, and give it permission when Google asks.
- Press Preview. The list appears in the log. Nothing in your account changes, in Preview or when it runs.
- Get it by email. Put your address in EMAIL at the top, save, and set it to run every week.
Each script works on one account at a time. If you manage clients from a manager account, run it inside each client account.
Search terms that spend and never convert
Lists the search terms that cost more than a set amount in the last 30 days and brought no conversion, costliest first. These are the searches you are paying for that nobody buys from. The totals count every one; the list shows the 500 costliest.
Set MIN_COST at the top, in your account's currency. It starts at 20.
Show the script
/**
* Search terms that spend and never convert. A free Google Ads script from Admiral (https://meetadmiral.com/scripts).
* Lists every search term that cost more than MIN_COST in the last 30 days with no conversions.
* It reads only. Nothing in your account changes. Paste it into Tools, Bulk actions, Scripts, then Preview.
*/
var CONFIG = { DAYS: 'LAST_30_DAYS', MIN_COST: 20, EMAIL: '' }; // MIN_COST is in your account's currency
function main() {
var q = 'SELECT search_term_view.search_term, campaign.name, ad_group.name, metrics.clicks, metrics.cost_micros ' +
'FROM search_term_view WHERE segments.date DURING ' + CONFIG.DAYS + ' AND metrics.conversions = 0 ' +
'AND metrics.cost_micros > ' + Math.round(CONFIG.MIN_COST * 1e6) + ' ORDER BY metrics.cost_micros DESC';
var it = AdsApp.search(q), rows = [], total = 0, count = 0;
while (it.hasNext()) {
var r = it.next(), cost = r.metrics.costMicros / 1e6;
total += cost;
if (++count > 500) continue; // the table keeps the 500 costliest; the totals count every one
rows.push([r.searchTermView.searchTerm, r.campaign.name, r.adGroup.name, r.metrics.clicks, cost.toFixed(2)]);
}
report('Search terms that spend and never convert', ['Search term', 'Campaign', 'Ad group', 'Clicks', 'Cost'], rows,
count + ' search terms cost ' + total.toFixed(2) + ' ' + AdsApp.currentAccount().getCurrencyCode() + ' with no conversions (' + CONFIG.DAYS + ').' + (count > 500 ? ' The 500 costliest are listed.' : ''));
}
// Shared by every Admiral free script: prints the table to the log and, if CONFIG.EMAIL is set, emails it.
function report(title, headers, rows, summary) {
var lines = [title, summary, ''];
if (!rows.length) lines.push('Nothing found. Good.');
else {
lines.push(headers.join(' | '));
for (var i = 0; i < rows.length; i++) lines.push(rows[i].join(' | '));
}
lines.push('', 'Free script from Admiral. Admiral runs this check and 48 more on Google Ads accounts every day, and changes nothing without your approval. See https://meetadmiral.com/scripts');
var text = lines.join('\n');
Logger.log(text);
if (CONFIG.EMAIL) MailApp.sendEmail(CONFIG.EMAIL, title + ': ' + AdsApp.currentAccount().getName(), text);
}
Ads leaking onto search partners and Display
Lists live Search campaigns that also show on search partner sites or the Display network. New Search campaigns are opted into both by default, and few advertisers mean to be.
Nothing to set.
Show the script
/**
* Ads leaking onto search partners and the Display network. A free Google Ads script from Admiral (https://meetadmiral.com/scripts).
* Lists live Search campaigns that are opted into search partner sites or the Display network, which new campaigns
* are by default and few advertisers want. It reads only. Nothing in your account changes.
*/
var CONFIG = { EMAIL: '' };
function main() {
var q = 'SELECT campaign.name, campaign.network_settings.target_search_network, campaign.network_settings.target_content_network ' +
"FROM campaign WHERE campaign.advertising_channel_type = 'SEARCH' AND campaign.status = 'ENABLED'";
var it = AdsApp.search(q), rows = [];
while (it.hasNext()) {
var r = it.next(), n = r.campaign.networkSettings || {};
if (n.targetSearchNetwork || n.targetContentNetwork)
rows.push([r.campaign.name, n.targetSearchNetwork ? 'on' : 'off', n.targetContentNetwork ? 'on' : 'off']);
}
report('Search campaigns showing on partners or Display', ['Campaign', 'Search partners', 'Display network'], rows,
rows.length + ' live Search campaigns reach beyond Google Search.');
}
// Shared by every Admiral free script: prints the table to the log and, if CONFIG.EMAIL is set, emails it.
function report(title, headers, rows, summary) {
var lines = [title, summary, ''];
if (!rows.length) lines.push('Nothing found. Good.');
else {
lines.push(headers.join(' | '));
for (var i = 0; i < rows.length; i++) lines.push(rows[i].join(' | '));
}
lines.push('', 'Free script from Admiral. Admiral runs this check and 48 more on Google Ads accounts every day, and changes nothing without your approval. See https://meetadmiral.com/scripts');
var text = lines.join('\n');
Logger.log(text);
if (CONFIG.EMAIL) MailApp.sendEmail(CONFIG.EMAIL, title + ': ' + AdsApp.currentAccount().getName(), text);
}
Paying for people who aren't in your area
Lists live campaigns that target places but use the location option “Presence or interest”, Google's default, which also shows your ads to people outside those places who have only looked them up. Campaigns with no location target at all are counted separately, since they show everywhere either way.
Nothing to set.
Show the script
/**
* Paying for people who aren't in your area. A free Google Ads script from Admiral (https://meetadmiral.com/scripts).
* Lists live campaigns whose location option is "Presence or interest": Google's default, which also shows your ads
* to people outside your area who are only interested in it. It reads only. Nothing in your account changes.
*/
var CONFIG = { EMAIL: '' };
function main() {
// Only campaigns that target places: one with no location target at all is a different problem (it shows everywhere).
var placed = {}, c = AdsApp.search("SELECT campaign.id FROM campaign_criterion WHERE campaign_criterion.type = 'LOCATION' " +
"AND campaign_criterion.negative = FALSE AND campaign.status = 'ENABLED'");
while (c.hasNext()) placed[c.next().campaign.id] = true;
var q = 'SELECT campaign.id, campaign.name, campaign.advertising_channel_type, campaign.geo_target_type_setting.positive_geo_target_type ' +
"FROM campaign WHERE campaign.status = 'ENABLED' AND campaign.geo_target_type_setting.positive_geo_target_type = 'PRESENCE_OR_INTEREST'";
var it = AdsApp.search(q), rows = [], unplaced = 0;
while (it.hasNext()) {
var r = it.next();
if (placed[r.campaign.id]) rows.push([r.campaign.name, r.campaign.advertisingChannelType]);
else unplaced++;
}
report('Campaigns set to "presence or interest"', ['Campaign', 'Type'], rows,
rows.length + ' live campaigns that target places also show to people outside them.' +
(unplaced ? ' ' + unplaced + ' more have no location target at all, so they show everywhere: a separate fix.' : ''));
}
// Shared by every Admiral free script: prints the table to the log and, if CONFIG.EMAIL is set, emails it.
function report(title, headers, rows, summary) {
var lines = [title, summary, ''];
if (!rows.length) lines.push('Nothing found. Good.');
else {
lines.push(headers.join(' | '));
for (var i = 0; i < rows.length; i++) lines.push(rows[i].join(' | '));
}
lines.push('', 'Free script from Admiral. Admiral runs this check and 48 more on Google Ads accounts every day, and changes nothing without your approval. See https://meetadmiral.com/scripts');
var text = lines.join('\n');
Logger.log(text);
if (CONFIG.EMAIL) MailApp.sendEmail(CONFIG.EMAIL, title + ': ' + AdsApp.currentAccount().getName(), text);
}
Ads sending people to broken pages
Opens the page behind every live ad and keyword and lists the ones that answer with an error, so you stop paying for clicks that land on nothing.
MAX_URLS caps how many pages it opens in one run. It starts at 200.
Show the script
/**
* Ads sending people to broken pages. A free Google Ads script from Admiral (https://meetadmiral.com/scripts).
* Opens the final URL of every live ad and keyword (up to MAX_URLS) and lists the ones that answer with an error.
* It reads only and visits your own pages. Nothing in your account changes.
*/
var CONFIG = { MAX_URLS: 200, EMAIL: '' };
function main() {
var urls = {};
var live = "campaign.status = 'ENABLED' AND ad_group.status = 'ENABLED'";
collect('SELECT ad_group_ad.ad.final_urls, campaign.name FROM ad_group_ad WHERE ad_group_ad.status = \'ENABLED\' AND ' + live,
function (r) { return [r.adGroupAd.ad.finalUrls, r.campaign.name]; }, urls);
collect('SELECT ad_group_criterion.final_urls, campaign.name FROM keyword_view WHERE ad_group_criterion.status = \'ENABLED\' AND ' + live,
function (r) { return [r.adGroupCriterion.finalUrls, r.campaign.name]; }, urls);
var rows = [], n = 0;
for (var u in urls) {
if (n++ >= CONFIG.MAX_URLS) break;
var code;
try { code = UrlFetchApp.fetch(u, { muteHttpExceptions: true, followRedirects: true }).getResponseCode(); }
catch (e) { code = 'no answer'; }
if (code === 'no answer' || code >= 400) rows.push([u, code, urls[u]]);
}
report('Ads sending people to broken pages', ['Page', 'Answer', 'Campaign'], rows,
rows.length + ' of ' + Math.min(n, CONFIG.MAX_URLS) + ' landing pages answered with an error.');
}
function collect(q, pick, urls) {
var it = AdsApp.search(q);
while (it.hasNext()) {
var p = pick(it.next()), list = p[0] || [];
for (var i = 0; i < list.length; i++) if (!urls[list[i]]) urls[list[i]] = p[1];
}
}
// Shared by every Admiral free script: prints the table to the log and, if CONFIG.EMAIL is set, emails it.
function report(title, headers, rows, summary) {
var lines = [title, summary, ''];
if (!rows.length) lines.push('Nothing found. Good.');
else {
lines.push(headers.join(' | '));
for (var i = 0; i < rows.length; i++) lines.push(rows[i].join(' | '));
}
lines.push('', 'Free script from Admiral. Admiral runs this check and 48 more on Google Ads accounts every day, and changes nothing without your approval. See https://meetadmiral.com/scripts');
var text = lines.join('\n');
Logger.log(text);
if (CONFIG.EMAIL) MailApp.sendEmail(CONFIG.EMAIL, title + ': ' + AdsApp.currentAccount().getName(), text);
}
Ad groups with no ad that can show
Lists live ad groups in live Search campaigns with no ad of any type that is both on and approved, so their keywords have nothing to show.
Nothing to set.
Show the script
/**
* Ad groups with no ad that can show. A free Google Ads script from Admiral (https://meetadmiral.com/scripts).
* Lists live ad groups in live Search campaigns with no ad of any type that is both on and approved, so their
* keywords can't show anything. It reads only. Nothing in your account changes.
*/
var CONFIG = { EMAIL: '' };
function main() {
var live = {}, it = AdsApp.search('SELECT ad_group.id FROM ad_group_ad WHERE ad_group_ad.status = \'ENABLED\' ' +
"AND ad_group_ad.policy_summary.approval_status IN ('APPROVED', 'APPROVED_LIMITED') " +
"AND campaign.status = 'ENABLED' AND ad_group.status = 'ENABLED'");
while (it.hasNext()) live[it.next().adGroup.id] = true;
var rows = [], g = AdsApp.search('SELECT ad_group.id, ad_group.name, campaign.name FROM ad_group ' +
"WHERE ad_group.status = 'ENABLED' AND campaign.status = 'ENABLED' AND campaign.advertising_channel_type = 'SEARCH'");
while (g.hasNext()) {
var r = g.next();
if (!live[r.adGroup.id]) rows.push([r.campaign.name, r.adGroup.name]);
}
report('Ad groups with no ad that can show', ['Campaign', 'Ad group'], rows,
rows.length + ' live ad groups have no ad that is both on and approved.');
}
// Shared by every Admiral free script: prints the table to the log and, if CONFIG.EMAIL is set, emails it.
function report(title, headers, rows, summary) {
var lines = [title, summary, ''];
if (!rows.length) lines.push('Nothing found. Good.');
else {
lines.push(headers.join(' | '));
for (var i = 0; i < rows.length; i++) lines.push(rows[i].join(' | '));
}
lines.push('', 'Free script from Admiral. Admiral runs this check and 48 more on Google Ads accounts every day, and changes nothing without your approval. See https://meetadmiral.com/scripts');
var text = lines.join('\n');
Logger.log(text);
if (CONFIG.EMAIL) MailApp.sendEmail(CONFIG.EMAIL, title + ': ' + AdsApp.currentAccount().getName(), text);
}
Or let Admiral run all 49 Google Ads checks, every day.
These five are the simplest of the 49 checks Admiral runs on a Google Ads account. Connect one and it runs all of them, and it changes nothing without your approval.
Nothing changes until you say so.
First audit · northlineair.exampleExample
Search terms that spend and never convert“free ac inspection”, “hvac technician jobs”
$212this monthKeywords with nothing to show for the money“cheap ac repair”, 31 clicks, no bookings
$64this weekAds leaking onto search partners and the Display network11% of spend, no bookings
$118this monthOne enquiry counted many timesThe booking form counts each booking twice
2×bookings overstated49 named checks on Google Ads and 14 on Meta, each time it reads.