Posted by & filed under Karooya's Google Ads Scripts.

It’s been 2 years since AdWords removed the option to exclude close variants from exact and phrase match keywords. But, there are many accounts out there which continue to have close variants as separate keywords in their accounts.  At best, having close variant duplicate keywords in the account is harmless. You continue to get the all the traffic that matches if any of the close variant keyword. But, at worst, it can give you misleading signals.


identify duplicate keywords


The problem with duplicate keywords


Consider an account that has the following 2 keywords.


[pet food]

[pets food]


For the sake of simplicity, consider that all the settings for these keywords are same.


Now, when someone searches for “pet foods”, the search query matches to any of the two keywords as both are close variants of the search query.  Unless you have these two keywords configured in separate ad groups, with carefully chosen negative keywords, AdWords can match the search query with any of the keyword.


Why is that a problem?


First, you will never know the real performance of a keyword.  If the search queries are being matched with multiple close variant keywords, the actual performance is combined performance of all those keywords.


Second, your metrics may show a wrong picture.  For a month, if traffic from [pet food] moves to [pets food], you might get worried. You will try to find the answer with bids, ads and other changes that you may have done to the account.  Such false alarms are undesirable. They can make you complacent and ignore the real ones as well.


Third, your ad test may take longer time to arrive at significance. If the keywords [pet food] and [pet foods] are in separate ad groups and you are testing a new ad copy,  you will arrive at a conclusion faster if only of the keyword was getting all the impressions. Having traffic spread across multiple keywords means sub-optimal ad copies will be shown for longer duration, thereby affecting the performance of the account.


What’s the Solution?


We bring you the true duplicate keyword detector.  Most of the existing solutions identify  presence of one keyword across multiple ad groups. This doesn’t solve the problem of close variants.


The AdWords script developed by us will flag even the close variants as duplicates


This AdWords script identifies the duplicates within same keyword match type. That is the keywords [pet food] in exact match and “pet food” in phrase match are not shown as duplicates.


Here are some example of duplicate keywords that our AdWords script will help you identify.


Sr No Duplicate Keywords
1 [pet food]

[pets food]

[pet foods]

2 “cheap flight”

“cheap flights”

“cheapest flights”

3 +nyc +italian +restaurants

+italian +restaurant +nyc


Here’s what the resulting sheet looks like. All the duplicate keywords are grouped together, ordered by impressions, highest first. Each duplicate group has single highlighting. You can see the performance from last 30 days for each of those keywords. Based on the performance data, you can decide which keywords to pause and redirect traffic to other well-performing keyword.


AdWords Script Duplicate Keywords


An Important Note:  This script uses a technique called stemming to find out the roots of each word. For example, the words “food” and “foods” will both have same root word “food.”


To get root word for each word, this script contacts an external service, built by Karooya. This scripts break all the keywords in individual words, removes duplicate instances of words and then contacts external service to get stemmed words. For example, let’s assume an account that has the following keywords, in exact match.


[pet food]

[dog food]

[dogs food]

[cat foods]


Here, the unique words are – pet, food, dog, dogs, cat, foods. Stem roots for only these words are retrieved. The actual keywords are never sent to the service.  Also, these source words are not stored anywhere.  Rest assured, your keyword data is safe.


How to use this AdWords script?


Now that you know what the AdWords script can do, let’s talk about the script. You can get this script here.

Here are the variables that you can change to customize it to your requirement.

  • SPREADSHEET_URL : This is the only variable that you must change. This is the Google Sheet which will have the result once you execute the script. Create a new sheet with Google Sheet and copy-paste URL of that sheet in place of ‘’.
  • DATE_RANGE: You can use some pre-defined ranges like LAST_30_DAYS or LAST_14_DAYS. By default, the script will get the data for last 30 days.
  • USE_CUSTOM_DATE_RANGE: If you want a particular date range to be used then, set this flag to “true” and modify the START_DATE and END_DATE to indicate the date range. The date format is “yyyy-mm-dd” aka “Year-Month-Date.” For example, if you want a report from last quarter of 2015, the START_DATE would be “2015-09-01” and END_DATE would be “2015-12-31.”
  • IS_MCC_ACCOUNT : This flag is to indicate whether you will be running this script at MCC-level. By default, it is set to false. Change it to “true” if you want to use for all the linked accounts in your MCC account. The results for each account will be stored in a separate sheet. Be careful, if you have many many accounts.
  • IGNORE_PAUSED_CAMPAIGNS,  IGNORE_PAUSED_ADGROUPS and IGNORE_PAUSED_KEYWORDS : These flags indicate to ignore paused campaigns, ad groups and keywords. By default, these 3 flags are set to true i.e. all the paused campaigns, ad groups and keywords are ignored.
  • FILTER_ACCOUNTS_BY_LABEL : If your MCC account has tons of linked accounts, you may not want to run this script for all the accounts. In that case, turn this flag to “true” and then specify the label with ACCOUNT_LABEL_TO_SELECT variable. Only the accounts with the specified label will be analyzed to generate this report.
  • ACCOUNT_LANGUAGE_CODE :  By default the language is set to English. If your account’s primary language is other than English then specify the language of the account to view the duplicate keyword list in that language. No need to change anything for English. Following are the languages in which the script has been made accessible and their respective codes:
        •  ar: Arabic
        •  bg: Bulgarian
        •  cz: Czech
        •  da: Danish
        •  nl: Dutch
        •  en: English
        •  fi: Finnish
        •  fr: French
        •  de: German
        •  hu: Hungarian
        •  no: Norwegian
        •  pt: Portuguese
        •  ro: Romanian
        •  ru: Russian
        •  es: Spanish
        •  sv: Swedish
        •  tr: Turkish

Once again, here is the link to the AdWords script.


Feel free to send us an email (support AT if you have any queries for this AdWords script.


Get all the AdWords scripts published by Karooya 


Related Link:

Stop wasted ad spend with Karooya

Stop the wasted ad spend. Get more conversions from the same ad budget.

Our customers save over $16 Million per year on Google and Amazon Ads.

11 Responses to “AdWords Script to Identify Duplicate Keywords, Including Close Variants”

  1. Adwords script not working

    Invalid reporting query: UNSUPPORTED_VERSION: RequestError.UNSUPPORTED_VERSION. (line 251)

    • Sachin Doshi

      Thank you for bringing it to our notice. We have updated the script to use new AdWords APIs, now. Please download and use the updated script.

  2. Josiah Walker

    Hi, I tried this out but it times out. Is there an easy way to make it scale to larger sets of keywords?

    • Sachin Doshi

      Hello Josiah Walker,

      Could you please share the log messages for the script execution? It will help us to understand where the script got stuck. Also, any details such as ‘approx number of keywords in the account’ or ‘number of accounts’ if it’s mcc account, etc. will be useful. You can share the details by emails. I have also sent you an email explaining how to access the log messages.

      Meanwhile, you can try following –

      1) If you are running the script from a MCC account, try running the script for one account at a time.

      2) The script fetches keyword performance for a rate range (for 30 days, by default). You can try changing it to a smaller range. Please edit the variable named ‘DATE_RANGE’ in the script.

      Please let us know if helps.

  3. Bart


    Nice script! I think it could be further improved by adding a Campaign inclusion or exclusion variable. I’m running two identical campaigns, targeted to different audiences (customer/non-customer). So currently it returns a long list of duplicate keywords, which is intentional by the way I have set up my campaigns.



  4. Floor


    The script isn’t working any more. The URL call to your server returns a 400 error.

    Could you check the script for me?

    Thank you (L)

    • Sachin Doshi

      Thank you for bringing it to our notice. Recently we upgraded our website and all the web-services to use https protocol. Looks like, we missed to update this script accordingly. We have updated the script, now. Please download and use the updated script.

  5. Matt

    The script is working really well. But I want to have the script run on only a few of our campaigns at a time. I tried a few different things but none of them seemed to work. Is there a way to have this particular script run on only a few campaigns at a time? I am guessing it would be a matter of inserting the campaign ID somewhere in the code. I am just not sure where. Any help would be greatly appreciated!



  1.  120 Adwords Scripts to Supercharge Your PPC Campaings | Clicteq

Leave a Reply

Your email address will not be published.