Skip to main content

Exclude queries based on queryString

Filter and exclude unwanted search terms from your Google Ads campaigns

This script helps you keep your Google Ads campaigns focused on the right traffic. It looks at your recent search terms and automatically excludes queries that match a keyword or phrase you choose.

What this script does

  • It checks the search terms for one specific campaign in your Google Ads account.

  • It looks only at search terms from the last 7 days.

  • It selects search terms that meet your minimum impression and click levels.

  • It finds the search terms that match the keyword or phrase you have entered.

  • It adds those terms as exact match negative keywords to a shared negative keyword list in your account.

In practice, this means you can automatically block groups of search terms that include a certain brand name or generic phrase, without manually reviewing them one by one.

When you would use this script

You can use this script in several situations:

  • Branded shopping campaign

    You want a shopping campaign that only shows for branded searches. You can use this script on a separate campaign to collect and exclude all branded terms that should not appear there.

  • Generic shopping campaign with strict targeting

    You only want a shopping campaign to match on a few selected generic queries. Use this script to pick up and exclude all other generic terms that include a certain phrase.

  • Broad match search campaign

    You use broad match to increase volume but want to stay in control. You can first use an n-grams analysis to find which words bring conversions. Then you can use those words as the phrase to match and exclude in this script, so you keep your broad match from going too wide.

The result is cleaner traffic and less wasted spend on searches that do not fit your strategy.

What you can configure

Inside Flowboost you will see a few fields you can adjust before running the script:

  • Keyword or phrase to match (queryString)

    This is the brand name or part of a keyword you want the script to look for in your search terms.

  • Impression threshold

    The minimum number of impressions a search term needs before it can be excluded. This helps you avoid blocking terms that only appeared once or twice.

  • Click threshold

    The minimum number of clicks a search term needs before it can be excluded. This keeps the focus on terms that are actually getting traffic.

  • Negative keyword list name

    The name of the shared negative keyword list where new negative keywords are added. You need to create this list in advance in your Google Ads account.

  • Campaign name

    The campaign whose search terms you want to check. Only this campaign is scanned.

After the script runs, you will see new exact match negative keywords in your chosen negative keyword list. These will then be applied to any campaigns that use that shared list.

Limitations and scope

  • The script works for standard Google Ads campaign types.

  • It is not designed for Smart campaigns or Performance Max campaigns.

  • It only looks at data from the last 7 days, so changes are always based on recent performance.

Did this answer your question?