Get in touch with our team

Tools

Eliminate wasted spend with this Google Ads script

You’re wasting your money

If there’s one thing I can be absolutely certain of it’s that you’re wasting money on your Google Ads campaigns.

No, I’m not about to suggest you put all of your money into advertising on TikTok (not that there’s anything wrong with that). What I am going to suggest is that you stop haemorrhaging cash—especially when there’s such a simple way to stop it.

By the end of this article, you will have a solid understanding of why most of your budget is being wasted as well as a bespoke script to prevent it from happening.

Money for nothing

If I asked you to give me £1,000 in exchange for absolutely nothing, would you do it?

No? What about £500? Would you give me that? How about £100?

Most people, unless they’re feeling particularly generous, wouldn’t willingly part with their hard-earned cash for nothing in return.

However, every single day, Google Ads advertisers around the world do this. Why? Either because they don’t notice or they don’t care.

Don’t believe me? Imagine my horror when I saw this in an account that I was auditing.

Didn’t spot it?

More than £150,000 had been spent on search terms which did not convert – ever.

In several cases, more than £400 had been spent on a single search term which had brought nothing back to the business in return for the money.

From the data we can see here, it appears that not one of the people typing in these search terms called the business, filled in a contact form, or bought a product. It was just money down the drain – £150,000 down the drain.

Needless to say, I was absolutely horrified…especially since I managed this account!

So why aren’t my client and my boss absolutely furious?

Because performance has never been better.

Over the same time period, through priority-based budget management and data-driven campaign optimisation, I’ve managed to consistently decrease the cost per lead:

While I was still absolutely horrified by that £150,000 figure, what shocked me wasn’t the level of wasted spend, but the fact that the account had thrived despite it.

It got me thinking about how much better our accounts could perform if we increased our spend efficiency.

So…how do we do that?

Wasted spend

Every account has wasted spend. It’s a sad fact of life that most clicks will not lead to a conversion. However, that does not mean that wasted spend can’t and shouldn’t be minimised.

There are several ways to increase the spend efficiency of an account. A few common ways include dropping bids, pausing poorly performing keywords or negating non-converting search terms but there are plenty of other techniques that work just as well.

So, with so many different options to improve things, why is there still so much wasted spend in paid search campaigns?

Oddly enough, the answer lies in a short story about gold.

A short story about gold

Here’s a short extract from Peter L. Bernstein’s book, The Power of Gold: The History of an Obsession:

“About one hundred years ago, John Ruskin told the story of a man who boarded a ship carrying his entire wealth in a large bag of gold coins. A terrible storm came up a few days into the voyage and the alarm went off to abandon ship. Strapping the bag around his waist, the man went up on deck, jumped overboard, and promptly sank to the bottom of the sea. Asks Ruskin: “Now, as he was sinking, had he the gold? Or had the gold him?” Peter L. Bernstein, The Power of Gold: The History of an Obsession

While you might question this story’s relevance to PPC, this is exactly what happens all the time in paid search. Many businesses cling to poorly performing keywordsdespite them never driving a single conversionsolely for the sake of vanity. Whether they realise it or not, these underperforming keywords are dragging them under.

“We want to appear for these keywords,” someone will say. But what if those keywords don’t perform? What then?

In the £150,000 case above, the vast majority of the search terms were highly relevant to the client’s business. Although we didn’t see the conversions in Google Ads, the client anecdotally claimed that they’d seen an increase in the number of physical visits to their stores with customers asking for exactly the products in these search terms.

The conclusion? That so-called ‘wasted’ spend may not have been wasted at all.

However, more often than not, this isn’t the case for most advertisers or most accounts. For those times, we need a solution: Something simple that will eliminate search terms if they spend more than a certain amount without converting.

Let me introduce you to Kill It With Fire.

Kill It With Fire – Negative Keyword Script

KIWF can help you automatically negate irrelevant search terms, reduce the cost of advertising on Google Ads and lower your cost per acquisition.

This script adds all non-converting search queries to a negative keyword list if they have spent more than a pre-determined amount of money, nipping wasted spend in the bud early.

Since you can schedule it to run daily all by itself, it can automatically update the negative keyword list over time for you.

Pretty cool, right?

/*******************************************************************************
*
* [KIWF] Kill It With Fire
* Author: Nathan Ifill (@nathanifill), Impression
*
* This script adds all non-converting search queries to a negative keyword list
* if they have spent more than a specified amount of money, cutting down on
* wasted spend. Use it to create negative keyword lists that automatically
* update over time. Set the script to run regularly for best results.
*
* v1.2
*
* Any suggestions? Email nathan.ifill@impression.co.uk
*
* Change History:
*
* v1.2
* - NI updated to only look at enabled campaigns 
*
*
*******************************************************************************/

/******************************************************************************/
/******************* THE BIT WHERE YOU SET THE OPTIONS  ***********************/
/******************************************************************************/

// Enter the minimum cost this search term should have accumulated (all time)
// before being added as a negative keyword. If you only want to add negative
// keywords which have spent more than £50, write 50. The higher the value, the
// lower the number of search terms will be added as negative keywords. However,
// on the other hand, if you set the value too low, the script will block tons
// of search terms, so please set this value with caution.

// Example: var minCost = 50;
// Example: var minCost = 12.34;

var minCost = 80;

// Add the name of the campaign you'd like to look at for search queries. Leave
// this blank to search all campaigns across the account.

var nameOfCampaign = "";

// Add the name of the negative keyword list to add the negatives to. If the
// list does not exist, it will be automatically added by the script.

var negativeListToAddNegativesTo = "IMP | KIWF List";

// Enter the minimum number of clicks this search term should have received in
// the last 30 days before being added as a negative keyword. If you're not
// sure, leave it as zero.
// Example: var minClicks = 0;

var minClicks = 1;

/******************************************************************************/
/** DON'T TOUCH ANYTHING BELOW HERE OR TERRIBLE, TERRIBLE THINGS WILL HAPPEN **/
/******************************************************************************/

var accountCurrency = AdsApp.currentAccount().getCurrencyCode(); // USD/GBP etc

var minCostMicros = minCost * 1000000; // sets the cost in terms of micros

// Using the ternary operator just because I feel like it
minClicks >= 0 ? minClicks : minClicks = 0;

Logger.log("************* KILL IT WITH FIRE (impression.co.uk) *************");
var line = "----------------------------------------------------------------";
Logger.log(line);

var addToNL = 0;
var blank = " ";

if (negativeListToAddNegativesTo.length < 1) {
  addToNL = 0
} else {
  addToNL = 1;
  Logger.log("Negative keywords will be added to the '"
  + negativeListToAddNegativesTo + "' negative keyword list.");

  var negativeListCount = AdsApp.negativeKeywordLists()
  .withCondition("Name CONTAINS_IGNORE_CASE '"
  + negativeListToAddNegativesTo + "'").get().totalNumEntities();

  // Creating the list
  if (negativeListCount == 0) {
    try {
      var negativeKeywordListOperation = AdsApp.newNegativeKeywordListBuilder()
      .withName(negativeListToAddNegativesTo)
      .build();

      var negativeKeywordList = negativeKeywordListOperation.getResult();
    } catch (e) {
      throw("Error creating " + negativeListToAddNegativesTo
      + " negative list.");
    }
  } else { var negativeKeywordList = AdsApp.negativeKeywordLists()
    .withCondition("Name CONTAINS_IGNORE_CASE '"
    + negativeListToAddNegativesTo + "'").get().next();
  }
}

// Error handling
if (addToNL == 0) {
  throw("You haven't entered a negative list to add "
  + "keywords to. Please enter this in the options section of the "
  + "script.");
}

Logger.log("Only non-converting search terms that have had more than "
            + minClicks + " click(s) and spent more than " + minCost + " "
            + accountCurrency
            + " will be negated.");
Logger.log(blank);
Logger.log("The following search terms will be negated:");
Logger.log("-------------------------------------------");
Logger.log(blank);

var report = AdsApp.report(
  "SELECT CampaignName, Query, Cost"
  + " FROM SEARCH_QUERY_PERFORMANCE_REPORT"
  + " WHERE Clicks >= " + minClicks
  + " AND Conversions < 1"
  + " AND CampaignName CONTAINS_IGNORE_CASE '" + nameOfCampaign + "'"
  + " AND Cost >= " + minCostMicros
  + " AND CampaignStatus = 'ENABLED'"
);

// "The main thing is to keep the main thing the main thing." - Stephen R. Covey
function main() {

  var rows = report.rows();
  var searchTermCount = 0;

  while (rows.hasNext()) {

    var row = rows.next();
    var campaignName = row["CampaignName"];
    var query = row["Query"];
    var cost = row["Cost"];

    if (canWeEvenDealWithThisTing(query)) {
      Logger.log(" - " + query);
      Logger.log(" - - Cost: " + cost + " " + accountCurrency);
      addTheTing(query);
      searchTermCount++;
    }
  }

  Logger.log(blank);
  if (searchTermCount > 0) {
    Logger.log("The above search terms have been added as negative keywords.");
    Logger.log("Number of search terms negated: " + searchTermCount);
  } else {
    Logger.log("There are no new search queries to add as negative keywords.");
  }
}

function addTheTing(query) {
  if (addToNL == 1) {
    try {
      negativeKeywordList.addNegativeKeyword("[" + query + "]");
    } catch (e) {
      throw("Error adding negative keywords to the "
      + negativeListToAddNegativesTo + " negative keyword list. "
      + "Please check to see if the list is full. If it is, you'll "
      + "need to add your negative keywords to a new negative keyword list.");
    }
  }
}

/* returns true if we can add the ting */
function canWeEvenDealWithThisTing(query) {
  if ((query.match(/\s/gi) || []).length > 10) {
    Logger.log(">> '" + query + "' is more than 10 words so can't be added.");
    return false;
  } else if (query.length > 80) {
    Logger.log(">> '" + query + "' is longer than 80 characters so can't be " +
                "added.");
    return false;
  } else {
    return true;
  }
}

Instructions

There are four options in the script:

  • minCost
  • nameOfCampaign
  • negativeKeywordList
  • minClicks

Once you’ve set these, the script is good to go. Schedule it to run and it’ll start protecting your account.

minCost

This option allows you to specify the amount a search term is allowed to spend before you kill it off.

For example, if your target cost per lead is £50, you might want to set this to be £70 and pause any search term that spends £70 without converting.

It’s as simple as setting the option to the following:

 var minCost = 70;

Of course, you could always set your value to 50, 100 or even 5 depending on how ruthless you want to be with negating non-converting search terms. Just remember – the lower the number is, the more search terms will be negated.

If you’re not sure what to go for, setting a number at or around your average cost per acquisition is probably a good place to start.

minCampaign

Most of the time you won’t need this option, so it’s safe to ignore it. Leaving it blank means the script will look in all campaigns across the account and add any high-spending, non-converting search terms from them to your negative keyword list.

Sometimes though, you’ll only want to negate search terms from one particular campaign instead of the whole account. In those cases, you can add the campaign name into this option and the script will only add search terms from this one campaign which spend more than the minCost value without converting.

Let’s say you only want to add search terms from your ‘UK – Prospecting’ campaign. You just enter the name in like so:

var nameOfCampaign = "UK - Prospecting";

You can only do this for one campaign at a time in this version of the script. (There’s nothing stopping you from running multiple copies of the script and pointing them at the same negative keyword list though!)

Short version: If you’re not sure whether you need this or not, just leave it blank.

negativeKeywordList

This is where you enter the name of the negative keyword list that you’d like to add the negative keywords to.

If you enter the name of a list that you already have, the script will add the negative keywords to that list. However, if you don’t have a list with this name, it will create one for you and then add the negative keywords to it.

Adding a name is simple as typing it into the speech marks:

var negativeKeywordList = "KIWF Negatives";

Particularly when first running this for the very first time, you might prefer to send the negative keywords to a new list instead of adding them to a list that already exists. That will give you a chance to look over the negative keywords and see what the script is adding.

minClicks

If you’d like to set a minimum number of clicks that a search term needs to have had before you consider negating it, then you can use this here.

However, if like most people, you’re not too concerned about how many clicks a search term has had, you can just set this to zero like so:

var minClicks = 0;

Don’t forget to apply your negative keyword list!

The only other thing to remember is to actually apply your negative keyword list to the campaigns that you want it the script to protect. Once you’ve done that, you can schedule the script every day.

Just head to Tools & Settings > Scripts (under Bulk Uploads) and click on the Edit pencil under Frequency to set the script to run daily.

This image has an empty alt attribute; its file name is image.png

Eliminate wasted spend for good

Now, equipped with this handy script, you can slowly, but surely eliminate wasted spend for good.

This is just one tool. There are a variety of different ways to increase spend efficiency in your account and get more bang for your buck.

If you’d like to find out more about how to get better results for your current budget, contact us today and we can show you a few quick wins in your account to make your money go further than ever before.