Google Ads Auto-SQR Script to Add High-Volume Search Queries

Managing PPC campaigns on Google Ads can be both challenging and tedious. However, using scripts—such as our free Google Ads Auto-SQR script—can be a game-changer, automating tasks that would otherwise take significant time and effort.

This powerful Google Ads script aims to streamline the process of targeting high-volume search queries by automatically adding them as exact match keywords based on user-defined criteria.

In this article, we’ll explain the benefits of using scripts such as our Auto-SQR script and how to set them up on your Google Ads account. We’ll also discuss the importance of targeting the right keywords in your campaign.

Google Ads Auto-SQR Script


    _   ___ _   _ _____ ___   _     
   /_\ / __| | | |_   _/ _ \ (_)___ 
  / _ \ (__| |_| | | || (_) || / _ \
 /_/ \_\___|\___/  |_| \___(_)_\___/


const config = {
    MIN_SPEND: 100, // Minimum conversions threshold
    MIN_CONVERSIONS: 2, // Minimum conversions threshold
    MIN_REVENUE: 50, // Minimum revenue threshold
    LABEL_NAME: 'your label', // A label to identify what the script has worked on

function main() {
    const query = `
            FROM search_term_view 
                campaign.status = 'ENABLED'
                AND DURING ${config.DATE_RANGE} 
                AND metrics.cost_micros > ${config.MIN_SPEND * 1000000} 
                AND search_term_view.status IN ('NONE', 'UNKNOWN')

    const report =;
    const rows = report.rows();
    const data = [];

    while (rows.hasNext()) {
        const row =;

        const cost = row['metrics.cost_micros'] / 1000000;
        const campaign = row[''];
        const campaignId = row[''];
        const adGroup = row[''];
        const adGroupId = row[''];
        const searchTermMatchType = row['segments.search_term_match_type'];
        const conv = row['metrics.conversions'];
        const revenue = row['metrics.conversions_value'];

        if (cost > config.MIN_SPEND && conv >= config.MIN_CONVERSIONS && revenue >= config.MIN_REVENUE) {
                search_term: row['search_term_view.search_term'],
                keyword: row[''],
                campaign: campaignId,
                adgroup: adGroupId,

            /* console.log( {
                search_term: row['search_term_view.search_term'],
                keyword: row[''],
                clicks:  row['metrics.clicks'],
                cost:  cost,
                conv:  row['metrics.conversions'],
                campaign: campaign,
                adgroup: adGroup}) */
    const labelName = config.LABEL_NAME + Utilities.formatDate(new Date(), 'GMT', 'yyyy-MM-dd');

    const labelExists = AdsApp.labels().withCondition(` = "${labelName}"`).get().totalNumEntities();
    if (labelExists === 0) {
    data.forEach(row => {
        const campaignId = row.campaign;
        const adGroupId = row.adgroup;
        const newKeyword = '[' + row.search_term + ']';
        const keyword = row.keyword;
        // console.log(adGroupId)
        const adgroups = AdsApp.adGroups()
            .withCondition(` = "${campaignId}" AND = "${adGroupId}"`)
        while (adgroups.hasNext()) {
            const adgroup =;
            const kws = adgroup.keywords().withCondition(`ad_group_criterion.keyword.text = "${keyword}"`).get().next();
            const finalUrl = kws.urls().getFinalUrl();
            try {
                if (finalUrl && finalUrl !== null && finalUrl !== '') {
                    const keywordOperation = adgroup

                } else if (!finalUrl || finalUrl === null || finalUrl === '') {
                    const keywordOperation = adgroup.newKeywordBuilder().withText(newKeyword).build().getResult();
            } catch (e) {
                `couldn't update keyword ${newKeyword}`;

How to Use Scripts in Google Ads

Google Ad scripts can be used to automate a range of different PPC tasks.

Here’s how to set them up:

  1. Sign in to your Google Ads account.
  2. From the toolbar, select the TOOLS drop-down menu.
  3. Under the BULK ACTIONS list, select SCRIPTS.
  4. Click the blue + icon to create a new script.
  5. Enter a name for your script in the name bar.
  6. Copy & paste your script code into the editor.
  7. You will need to click AUTHORISE to allow the script to run on your account.
  8. At this point, you can SAVE & PREVIEW your script.
  9. Check the logs on your preview to ensure the script will run as expected.
  10. When you are ready, click RUN to implement the script.

What is the Google Ads Auto-SQR Script?

SQR stands for Search Query Report. This crucial feature of Google Ads provides valuable insights into the specific search terms that trigger an ad. By detailing the actual search terms users entered into Google, advertisers can better understand the relevance and effectiveness of their keyword targeting.

Acuto’s free Google Ads Auto-SQR script is a handy bit of code specifically designed to automate the process of retrieving search query data and adding optimal keywords to your search query report. This should enable a more efficient workflow and lead to more accurate results.

How Does the Google Ads Auto-SQR Script Work?

This free Google Ads auto-SQR script works by using predefined user criteria to identify potential keywords that match the campaign’s objectives.

It continuously monitors the search terms triggering ads and evaluates them against the specific search queries you want to focus on. If a search term meets this optimal criteria—indicating it has high search volume and relevance—the script will automatically add it to the SQR.

By automating this process, the Auto-SQR script saves time and ensures that valuable search queries are not missed. This can help improve the overall performance of your campaign by identifying new keywords that can generate relevant traffic and conversions.

Why Should You Use the Google Ads Auto-SQR Script?

The Google Ads auto-SQR script is sure to be a valuable tool when trying to improve your PPC campaign.

Here are three key benefits:

  1. Saving time: Manually identifying high-volume search queries can be a tedious task. A Google Ads script such as this automates the process, saving you and your team valuable time and effort. The script continuously monitors and adds relevant queries to the SQR, allowing you to focus on other important aspects of your campaign.
  2. Maximising budget: By automatically discovering high-volume search queries, the script helps you make the most of your paid ad budget. It ensures that your ads are shown to a broader audience by targeting relevant keywords that drive traffic. This optimisation can lead to improved campaign performance and a higher return on investment.
  3. Scalability: The Auto-SQR script can be applied across multiple Google Ads accounts. This allows you to streamline your processes and ensure consistent performance across campaigns. The script saves you from manually implementing SQR updates for each account, making it an efficient solution for large-scale advertising efforts.

When to Use the Google Ads Auto-SQR Script

The Google Ads Auto-SQR script can be utilised in various scenarios to optimise your campaign.

Here are a few situations where it might be particularly handy:

  1. Fluctuating search trends: If your campaigns tend to operate in a particular niche—for example, where search trends change frequently or seasonally—the Auto-SQR script can help. By automatically identifying emerging high-volume search queries, the script ensures that your campaign stays up to date.
  2. Managing multiple Google Ads accounts: With its inherent scalability, the script can be applied across all accounts simultaneously—saving time that would be taken up manually monitoring and updating SQRs individually.
  3. Budgeting: The Auto-SQR script can help to maximise your budget by automatically discovering high-volume search queries that drive traffic. This enables you to focus your budget on the optimal keywords, ultimately enhancing the overall performance of your campaigns and avoiding wasted ad spend.
  4. Efficiency: The Auto-SQR script also offers a simple way to save time and improve overall efficiency. Instead of manually reviewing search terms and updating the SQR, the script automates this click-intensive process. This frees you and your team to focus on other, more strategic aspects of your PPC campaign.
When to Use the Google Ads Auto-SQR Script

Custom Automation Scripts by Acuto

Are you and your team spending too much time on tedious ad-management tasks? Google Ads scripts provide a powerful solution to automate these time-consuming processes, allowing you to channel your skills into more strategic elements of your campaign.

If you’re seeking targeted ways to streamline your team’s workflow, you may want to consider Acuto’s custom automation script service.

We recognise that every business faces unique challenges. Our expertise lies in developing tailor-made scripts to address a wide range of needs for platforms such as Google Ads.

Whether your goal is to optimise ad content, expand your ad reach, or enhance the efficiency of your search query reports, our codes can be specifically designed to match your requirements.

Find out what Acuto can do for your business by booking a call with our team today.

Key Takeaways

So, to recap:

  • Scripts can be used to automate various elements of ad management and are a great way to improve the efficiency of your workflow.
  • SQR is a feature in Google Ads which stands for Search Query Report. It shows you the user searches that trigger your ads.
  • Acuto’s free Google Ads Auto-SQR script is a clever bit of code designed to automate the process of retrieving search data & adding the most optimal keywords to your SQR.
  • The script can help to save time, maximise your budget, improve overall efficiency and can be scaled across multiple accounts.
  • Acuto’s bespoke script service is a convenient and powerful solution to improving various aspects of your company’s ad management.

Auto-SQR Script FAQ

#1. What does SQR mean in Google Ads?

SQR stands for ‘Search Query Report.’ It is a feature of Google Ads which shows which user search terms trigger an ad.

For example, if a keyword is “waterproof jacket”, a search term such as “best waterproof jacket under £200” might show up in your SQR as a triggered term.

#2. How do I improve keywords in Google Ads?

Here are a few things you can do to improve your keywords:

  1. Regularly monitor & analyse your keyword performance.
  2. Refine your keywords by removing underperforming or irrelevant keywords.
  3. Test and experiment with new keywords to expand your reach.
  4. Use negative keywords to exclude irrelevant search terms.

#3. What are negative keywords in Google Ads?

Negative keywords are specific words or phrases which you select to avoid your ad being triggered when a user searches for them.

You can utilise negative keywords to refine your targeting and ensure that your ads are only shown to the most relevant audience. For example, if you are selling luxury items, you may want to select “cheap” as a negative keyword.

#4. How do I use negative keywords in Google Ads?

To use negative keywords in Google Ads:

  1. Identify the irrelevant search terms you wish to exclude.
  2. Navigate to the KEYWORDS tab.
  3. Choose the campaign or ad group.
  4. Add the negative keywords.
  5. Specify match types if desired.
  6. Save changes.
  7. Monitor SQR for results.

If you encounter any issues while using the script, please contact us.

Recent Posts
Recent Posts