Identify and fix search query problems in Google Ads

Search query comparison and keyword generator for Google Ads Editor

This script was created in response to the Google Ads update in mid-February 2021, when modified broad match keywords became de facto phrase match keywords and phrase match keywords are treated since then mostly like modified broad match keywords.
With the script it is very easy to see what effects the update had. The script compares (by default) the search query reports from Feburary 15, 2021 to yesterday with a period of the same length before Feburary 14, 2021. No changes are made to the Google Ads account!
Keywords that are missing in the current search query report will appear as new phrase match keywords in the Google Ads Editor. Keywords that are new in the current search query report appear as new negative exact match keywords in the Google Ads Editor.
NO Google Ads Scripts knowledge is required - very easy to use. Just copy & paste!

 Very useful Google Ads Script

This script is not only useful for checking changes resulting from the Google Ads update.
It is generally very useful for viewing changes in search query reports and taking action if necessary when these changes were not desired.

 The problem of the Google Ads Update in February 2021

In short, for modified broadly matching keywords, word order suddenly matters in some cases, and conversely, word group keywords now behave more like modified broadly matching keywords in many cases.
Details see: Pharse match Keyword Generator for modified broad match keywords

 The solution to the problem

Look at the search query reports before and after the update and react to the changes.

  1. For search queries for which there are no more impressions after the update, new keywords are booked.
  2. For search queries, for which suddenly impressions are made since the update, one books in if necessary excluding keywords.

It is obvious that this should not be done fully automatically – especially the addition of excluding keywords!

The free Google Ads Scripts published here compares (by default) the search query reports from Feb 15, 2021 to yesterday with a period of the same length before Feb 14, 2021. Based on this, a table of new phrase keywords is created so that ads are again served for search queries for which ads were served before the update.
Conversely, excluding exact match keywords will be created with search queries for which ads have been served only since the update.
All suggestions can and should be checked in the Google Ads Editor, as well as partially deleted or edited before transferring the changes to the Google Ads account!


If a keyword is found identically several times in a campaign, the one with the most impressions is decisive.
It is not checked whether search queries no longer lead to ad placement because excluding keywords have been added. Excluding keyword lists are not even taken into account.
If, for example, you have reduced the bids for a keyword and therefore no more ads are displayed, this is not yet taken into account.

 What does the Google Ads Script do?

The script goes through all active search campaigns one after another. Thereby different data are determined:

  1. Search queries after the update (or a defined time).
  2. Search queries for a period of the same length (incl. match of weekdays) before the update (or a defined period).
  3. Existing phrase match keywords.
  4. Existing excluding keywords on campaign and ad group level.

The search query reports are compared.
If search queries are missing in the current (1st) search query report that are included in the older search query report and have achieved at least x impressions, a new phrase match keyword is added for them. The new keyword takes its settings (CPC, URLs ...) from the keyword from which the search query originated. Exception, there is already an identical word group keyword somewhere in the campaign.

On the other hand, if a search query appears in the current search query report but not in the older one, a new exact match excluding keyword will be added. Unless a corresponding excluding keyword already exists in the ad group or campaign. And, if a conversion was achieved for the search query, no excluding keyword will be created by default.

Tip: The comment field for all new keywords contains statistical data such as impressions, costs and conversions of the underlying search queries. This can help in deciding whether to keep a keyword or not.

 Instructions to set up the script

  1. Configuring the script below
  2. Copy the code under "The free Google Ads Script" to the clipboard
  3. Create a new Google Ads script in Google Ads and paste in the code
  4. Save and test (click Preview button)
  5. Grant permissions and run again.
  6. Please like and share this page as a sign of thanks and encouragement :-)

 User manual

When the script is executed, you will receive an e-mail. In it, under an introduction, there is quite illegible data that starts with "Campaign". Then please proceed as follows:

  1. Please mark this data and copy it to the clipboard.
  2. In the Google Ads Editor, select Account -> import -> insert text.
  3. Press the button "Paste from clipboard".
  4. Press the "Process" button.
  5. Press the "Finish and check changes" button.
  6. Click the "Keep" link in the gray bar.
  7. Go through all new word group keywords and all new excluding keywords. Delete or edit them if necessary!
  8. Only then upload the changes so that they become active!

Alternatively to the email you can copy the data from the log of the script. Here, however, the length is very limited, so that this works only up to a certain number of new keywords.

 Script configuration

E-mail address for alerts (optional)

Further parameters can be set in the script with minimal JavaScript knowledge.
minImpressionsPos: 20 instead of minImpressionsPos: null, for example, means that no search queries with fewer than 20 impressions are taken into account. With dateBetweenComparePeriods: "20201231" (2020-12-31) one considers the period 1.1.2021 (Friday) until yesterday in comparison to a period of the same length before 31.12.2021, which also starts on a Friday.

 The free Google Ads Script

// ### // Copyright data-inside GmbH / no warranty / ohne Gewähr
// This Google Ads Scripts lib can be used by anyone at no charge. Use is granted without guarantee or liability. Redistribution of this code or derived code is prohibited.
var g_sMailAddress = ""; // error reports are send to this address
var g_sAccountName = AdWordsApp.currentAccount().getName(); // used in emails reporting errors
function main() {
 try {
  var sVersionDataInside = "1.1"; 
  var url = "";
   dateBetweenComparePeriods: null,      // e.g. "20210214" (for 2021-02-14) Date of Google update "modified broad match => phrase match"
   periodNewFrom:          "20210301",   // default: 1 day after dateBetweenComparePeriods
   periodNewTo:            null,         // default: yesterday
   periodOldFrom:          null,         // default: same weekday as periodNewFrom before update (same number of days as period "new")
   periodOldTo:            "20210214",   // default: same weekday as periodNewTo before update 
   minImpressionsPos:      20,           // only add new phrase keywords if query has got at least minImpressionsPos impressions in the past. Default: 1/4 average impressions per query
   minImpressionsNeg:      null,         // only add new negative exact keywords if query has got at least minImpressionsNeg impressions. Default = minImpressionsPos
   addKeywordsPos:         true,         // true => add new phrase keywords for queries missing in new search term report
   addKeywordsNeg:         true,         // true => add new negative exact keywords for queries existing in new search term report but not in old one
   considerConversionsPos: false,        // true => don't add new phrase keywords if conversions = 0 in the old search term report
   considerConversionsNeg: true,         // true => don't add negative keywords if conversions > 0 in the new search term report
 } catch (e) { try {MailApp.sendEmail(g_sMailAddress, "Exception in Script 'google-ads-search-compare-2-new-keywords.js' - "+AdWordsApp.currentAccount().getName(), "Exception: "+e.message+"\r\nStacktrace:\r\n"+e.stack);} catch (e2) {Logger.log(e2.message);} throw e; }
 if (false) { DriveApp.createFile('newAndNegativeKeywords.txt', sCsvFile, MimeType.PLAIN_TEXT)} // dummy to be asked for permission

I look forward to your feedback:-)

Holger Schulz alias admigo

Copyright and disclaimer

This Google Ads Scripts lib can be used by anyone at no charge. Use is granted without guarantee or liability. Redistribution of this code or derived code is prohibited.

 Instruction: Insert script into Google Ads account

Please configure the script at the top with your parameters first.
Then copy the Google Ads script from the gray box to the clipboard.
Then go into your Google Ads account and proceed step by step, as shown:
Step 4 "Script name" you can choose freely. For example "search2keywords"
Please omit step 9. The script should only be executed manually .
Google Ads Scripts Installation
Please use a desktop browser to rate. Thanks.