Google Ads script: Search Terms Must Match - try it out!
This script creates completely new possibilities for
Alert | Monitoring | Save costs | Optimization | Changes in | Read-only (if desired) | Google Sheet is created | |
Many possible applications
Making brand campaigns more profitable
- Problem: Bids are usually high in brand campaigns because you want to be at the top. This pleases Google, and since virtually all keyword options are now more or less brad, more and more search queries are being displayed in brand campaigns that do not even contain the brand name.
- Solution: The Search Terms Must Match script monitors the search queries and automatically adds negative keywords for search queries that do not match the defined keywords, if you want.
Standard Shopping campaigns for high-priced products
- Problem: You only want to run Shopping ads if one of your product names appears in the search query. General search queries such as "red shoes" or "leather bag" will only eat up your budget.
- Solution: Define a negative keyword list with brand names and use it as a "positive keyword list". If search queries in the
shopping campaign do not match any of these keywords in the list, the script can automatically add negative keywords and/or notify you by email which search queries with more than x clicks should perhaps be excluded.
Route search queries to the right ad groups
- Problem: The search queries match your products, but the ads or the landing page are often not ideal in the ad group selected by Google.
- Solution: Define as paused (!!) keywords (example) in ad groups which words should appear in search queries. This script informs you about non-conforming search queries with more than x impressions.
You can then exclude them, expand the whitelist or create new ad groups for these search queries.
Used correctly, this
Example alert email
Up to 100 search queries that did not match the defined filter keywords are listed in the email with important key figures. The complete list can be found in a
The table can be copied directly from the email and pasted into the
Inform and/or automatically exclude
You can configure whether the script should only inform you if search queries with more than x impressions or clicks do not match the defined criteria or whether excluded keywords are added as exact match automatically.
Get [Exact match] and "Phrase" back in the original behavior
If you simply want to try out the script before going into the setting options in more detail, we recommend the following procedure. This will give you back the original behavior of
- [adwords agency]
- "google ads agency"
- google ads optimization
Then the script will inform you about all search queries with at least 50 impressions and at least 3 clicks that would match if they were NEGATIVE keywords. If you change the script from "inform" to "automatically add negative keywords", you would have the old behavior of [exact match] and "word group" back. However, 'broad match' becomes much more restrictive than an active keyword normally is (just the way an excluding, broad matching keyword behaves).
Example script configuration
Link to the demo configuration sheet for Search Terms Must Match.
Quick start
If you simply want to try out the script, you can select the following settings for a Google Ads account of your choice. No changes will be made to the account, you will only receive an email if unsuitable search queries are found.
A) Check search terms in search campaigns
All active ad groups in all active search campaigns will be checked to see if the words appear in active and paused keywords in search queries. If not, the search query will be reported by email.
Parameter | Description |
---|---|
campaignNamesPattern | * |
addNegativeKeywords | FALSE |
mustMatchActiveKeywords | TRUE |
mustMatchPausedKeywords | TRUE |
activeKeywordsConsiderAs | CONTAINS With the CONTAINS setting, the keyword |
searchTermsOfLastXdays | 28 for larger accounts, 365 for very small accounts |
minMetrics_impressions | 50 |
minMetrics_clicks | 1 for small accounts, 10 for larger accounts |
If you do not receive an email after an hour, reduce minMetrics_impressions and/or increase searchTermsOfLastXdays.
If the script reports an error that the execution was interrupted, please reduce searchTermsOfLastXdays and/or increase minMetrics_clicks.
B) Keyword options EXACT and PHARSE
You can also use the script to more or less achieve the keyword options EXACT and PHRASE via excluding keywords in the original, name-giving functionality.
Parameter | Description |
---|---|
campaignNamesPattern | * |
addNegativeKeywords | FALSE TRUE if automatically negative keywords shall be added |
mustMatchActiveKeywords | TRUE |
mustMatchPausedKeywords | FALSE TRUE if you want to allow variants such as plurals, misspellings etc. via paused keywords. |
activeKeywordsConsiderAs | AS_DEFINED |
searchTermsOfLastXdays | 28 for larger accounts, 365 for very small accounts |
minMetrics_impressions | 50 |
minMetrics_clicks | 1 for small accounts, 10 for larger accounts |
C) Check search queries in a shopping ad group
These settings are used to check whether the search queries in a shopping campaign ad group match the keywords stored in the config sheet.
Parameter | Description |
---|---|
campaignNamesPattern | the name of your shopping campaign |
adGroupNamesPattern | the name of the ad group in the shopping campaign |
addNegativeKeywords | FALSE |
mustMatchTheseKeywords | _brand1_,_brand2_,_brand3_ Example:_gucci_,_louis_ _vuitton_,_prada_ |
searchTermsOfLastXdays | 28 for larger accounts, 365 for very small accounts |
minMetrics_impressions | 50 |
minMetrics_clicks | 1 for small accounts, 10 for larger accounts |
D) Check search queries in a campaign with a whitelist
We use a negative keyword list here as a POSITIVE keyword list. The list can contain product and brand names, for example. This allows us to check whether the ads in this campaign are being displayed for specific search terms or whether money has been burned with generic search queries.
You could also set addNegativeKeywords to TRUE here. Then search terms that have not yet triggered a conversion after 100 clicks are automatically excluded.
Parameter | Description |
---|---|
campaignNamesPattern | Name of the campaign to be checked (Search or Shopping) |
addNegativeKeywords | FALSE |
mustMatchNegativeKeywordLists | Name of the keyword list |
searchTermsOfLastXdays | 28 for larger accounts, 365 for very small accounts |
minMetrics_clicks | 100 |
lessMetrics_conversions | 0.001 |
Tips on how to use
If this script reports search queries, you should perform one of the following three actions:
- The search query is generally uninteresting:
=> Add thesearch query – or partsof it – to a negative keyword list that applies to all campaigns. Alternatively, use the negative keyword list at account level. - The search query is relevant, but the ad copy in this ad group is not ideal for it:
=> Optimize the ad copy in the ad group or create a new ad group with a suitable ad copy. - The search query matches the ad group (false alarm):
=> Simply add a paused keyword to the ad group (see below for an explanation).
Alternatively, you can of course also add an active keyword or add keywords in the mustMatchTheseKeywords column.
You will receive a relatively large number of false positives during the first few script executions. But by using
It can also be useful to run the script only every Monday (add mo in column #days) so that you do not receive too many emails from this script.
New keyword options + paused keywords as filters
>>> Paused keywords as "positive filter"
Assuming you have defined these keywords in an ad group. You can now configure the script so that search queries are checked to see whether they match the active and/or paused keywords.
This means that only search queries will be allowed that contain vacation or holiday as well as tip or recommendation.
Option "contains" = with _ before and after the keyword
An underscore before and after a PAUSED keyword means that the text in between must appear anywhere in the search query.
_vacation_ _tip_ would therefore match the following search queries.
- online vacation tips
- onlinetipps for vacations
In this way, it does not matter whether "tip" is used in singular or plural form in the search queries, whether with one or two p's or whether tip occurs somewhere in the middle of a word. The same of course also applies to "vacation".
Option "starts with" = with _ after the keyword
_vacation_ tip_ (without _ before "tip") would therefore match the following search queries.
- online vacation tips
- onlinetipps for vacations
- online tipps for vacations
Option "ends with" = with _ before the keyword
_vacation_ _tip (without _ after "tip") would therefore match the following search queries.
- online vacation tips
- online vacation tip
- onlinetipps for vacations
- onlinetip for vacations
Options broad match, phrase and exact match
These options work for paused keywords in the same way as they used to and still do for negative keywords.
However, there is a setting option for active keywords to pretend that all active keywords have the option "broad match" or "contains" (for all words of a keyword).
Configuration in Google Ads and/or the config sheet
Unfortunately, you cannot define keywords for Shopping campaigns. However, you can specify the "filter keywords" either in the name of the ad group or in the config sheet.
Filter keywords in the name of the ad group with ASMmm:
The Search Terms Must Match script searches for ad groups that contain "ASMmm:". You can define various things after the colon. In this example that would be:
- @: Inform by e-mail about search queries with more than x impressions/clicks (defined in the config sheet) that do not match the filter keywords in {}.
- +: Automatically add exact match keywords for search queries with more than x impressions/clicks that do not match the filter keywords.
- {...}: Search queries must match these filter keywords. For example:
"gucci handbags", "bags by gucci", "gucci purses" or "guccipocket"
All search queries that do not contain the word "gucci" would be rejected. In addition, "bag" or "purse" or "pocket" must be anywhere in the search query too.
- While it works well in search campaigns to direct Google to the right ad group for certain search queries with negative keywords, in our experience this should not be overdone in Shopping ads. We look forward to hearing about your experiences :-)
Define filter keywords in the config sheet
Alternatively, it is also possible to store a list of filter keywords in the config sheet (parameter mustMatchNegativeKeywordLists) and define which campaigns or ad groups these should apply to.
Limit the number of search queries
It is important to select the settings so that the script runs within the 30-minute time limit set by Google. To do this, it may be necessary to split search queries. To do this, duplicate a configuration line and then restrict the search query report. For example:
- Search queries with 1-5 clicks (minMetrics_clicks=1 und maxMetrics_clicks=5)
- Search queries with 6-20 clicks (minMetrics_clicks=6 und maxMetrics_clicks=20)
- Search queries with >20 clicks (minMetrics_clicks=21)
If the execution of a script takes too long (>30 minutes), a corresponding error message is displayed in the "completed" column.
Configuration parameters
Parameter | Description | ||||||
---|---|---|---|---|---|---|---|
useASMmmNamePattern | Should only campaigns or ad groups containing "ASMmm:" in the name be taken into account? The parameters campaignNamesPattern, campaignLabelNames, adGroupNamesPattern and adGroupLabelNames have priority over useASMmmNamePattern if they are defined. | ||||||
campaignNamesPattern | Example: *gucci* Only campaigns with "gucci" somewhere in the name will be considered. | ||||||
campaignLabelNames | Only include campaigns that contain a label defined here. | ||||||
adGroupNamesPattern | Analogue to campaignNamesPattern | ||||||
adGroupLabelNames | Analogue to campaignLabelNames | ||||||
addNegativeKeywords | Should exactly matching, excluding keywords be inserted automatically if unsuitable search queries are found? As a rule, it makes more sense to set FALSE here and to add excluding keywords | ||||||
notifyNegativeKeywords | Would you like to be informed by e-mail when unsuitable search queries are found? FALSE only makes sense if you have selected addNegativeKeywords=TRUE. | ||||||
mustMatchActiveKeywords | TRUE: Search campaigns check whether the search queries match one of the active keywords in the campaign. | ||||||
activeKeywordsConsiderAs |
| ||||||
mustMatchPausedKeywords | TRUE: Search queries are also checked against paused keywords. Tipp: Use paused, broad match keywords such as '_bag_ _order_'. Then all search queries containing 'bag' and 'order' are valid. For example, "handbags onlineorder". | ||||||
mustMatchNegativeKeywordLists | You can use a negative keyword list as a positive keyword list! Example: Define a list of brand names. If one of these brand names appears in the search query, the search query is valid. | ||||||
mustMatchTheseKeywords | For search and shopping campaigns, you can define comma-separated keywords for which search queries are checked. With entries in campaignLabelNames, adGroupNamesPattern and mustMatchTheseKeywords, you can easily define keywords for search and shopping campaigns at ad group level, against which search queries are checked and, if desired, unsuitable search queries are automatically excluded. | ||||||
mustMatchThisFunction | Option for experts | ||||||
addNegativeKeywordsToList | If addNegativeKeywords=TRUE. you can specify here that negative keywords are not added to the campaign or the ad group, but to the negative keyword list defined here. | ||||||
searchTermsOfLastXdays | The search queries of the last x days should be checked. For large accounts with a lot of traffic, a short period (e.g. 7 or 28 days) makes sense; for very small accounts, however, you can also choose a period of one or two years. | ||||||
minMetrics_impressions | It makes sense to define minMetrics_impressions and/or minMetrics_clicks so that you are only informed about search queries that actually occur more frequently or cause relevant costs. | ||||||
maxMetrics_impressions | |||||||
minMetrics_clicks | |||||||
maxMetrics_clicks | |||||||
greaterMetrics_ctr | Search queries in the search advertising network usually have a very low click-through rate. These can be easily filtered out with this parameter. | ||||||
lessMetrics_conversions | For example 0.001, so that no search queries are recognised as invalid that have contributed even minimally to a conversion. | ||||||
#days | Tip: Define mo here, for example, so that the script is only executed on Mondays and you receive the list of unsuitable search queries only once a week. |
Parameters that apply to all scripts
Download Google Ads script Search Terms Must Match
Please log in or register in the Ads Scripts Store first to download the script (why is this necessary?).