Free Google Ads Quality Score Tracker Script (With Google Sheets Dashboard)

Free Google Ads Quality Score tracker script, with a sample of the code

This free Google Ads Quality Score tracker logs Quality Score and its three components to a Google Sheet every day, so you can see how each keyword changes over time. A short script does the logging, and a simple dashboard turns it into a trend line you can filter by campaign or keyword. Setup takes about 20 minutes. Jump to the script or download the free template.

Why track Quality Score over time

A single Quality Score tells you where a keyword stands today. It doesn’t tell you whether your last landing page change helped or a new ad made things worse. You need the trend for that.

Google does offer historical Quality Score columns that you can segment by day. They’re fine for a quick look. A log gives you something different: all your keywords in one sheet, a dashboard you can filter, and a link you can share with your team.

One qualifier: Google calls Quality Score a diagnostic tool and says it’s not an input in the ad auction. It’s also “a general indicator” of where to focus, not a score to optimize. So use this to find problems, not as a KPI. Pipeline is still the scoreboard.

What the Quality Score tracker does

Once a day, the script:

  1. Finds yesterday’s date in your account’s time zone.
  2. Checks the sheet, and stops if that date is already logged.
  3. Pulls every enabled keyword that had impressions yesterday, in enabled campaigns and ad groups.
  4. Skips keywords with no Quality Score yet.
  5. Converts the three components to numbers and adds one row per keyword to your sheet.

Each row has these columns, with no header row:

Column Data
A Date
B Campaign
C Ad group
D Keyword
E Match type
F Quality Score (1 to 10)
G Expected CTR score
H Ad relevance score
I Landing page score
J Impressions

Components are scored 3 for above average, 2 for average, and 1 for below average. That numbering is mine, not Google’s. It just makes the labels easy to average and chart.

The free Quality Score tracker script

The only thing you need to change is your sheet URL.

/**
 * Quality Score tracker for Google Ads.
 *
 * Once a day, logs Quality Score and its three components for every enabled
 * keyword that had impressions yesterday, and appends them to a Google Sheet.
 *
 * HOW TO USE
 *  1. Make a Google Sheet with a tab named Raw_Data_Log.
 *  2. Paste the sheet's URL into SPREADSHEET_URL below.
 *  3. Authorize, Preview, then schedule the script to run daily.
 *
 * It reads your Google Ads account and writes only to your spreadsheet.
 */

// ---- EDIT THIS ------------------------------------------------------------
var SPREADSHEET_URL = 'PASTE_YOUR_GOOGLE_SHEET_URL_HERE';
// ---------------------------------------------------------------------------

var TAB_NAME    = 'Raw_Data_Log';
var MAX_RESULTS = 50000; // Safety limit for large accounts

// Converts a Quality Score component to a number:
// 3 = Above average, 2 = Average, 1 = Below average, blank = unrated.
function enumToScore(val) {
  if (!val) return null;
  var s = val.toString().toUpperCase();
  if (s === 'ABOVE_AVERAGE') return 3;
  if (s === 'AVERAGE')       return 2;
  if (s === 'BELOW_AVERAGE') return 1;
  return null;
}

// Returns true if the sheet already has rows for this date.
// Sheets may store the date as a real date, so both forms are checked.
function dateAlreadyLogged(sheet, dateText, timeZone) {
  var values = sheet.getDataRange().getValues();
  for (var i = 0; i < values.length; i++) {
    var cell = values[i][0];
    var isDate = Object.prototype.toString.call(cell) === '[object Date]';
    var text = isDate ? Utilities.formatDate(cell, timeZone, 'yyyy-MM-dd') : String(cell);
    if (text === dateText) return true;
  }
  return false;
}

function main() {
  var ss    = SpreadsheetApp.openByUrl(SPREADSHEET_URL);
  var sheet = ss.getSheetByName(TAB_NAME);

  if (!sheet) {
    Logger.log("ERROR: Could not find a tab named '" + TAB_NAME + "'.");
    return;
  }

  // Yesterday, in the account's time zone.
  var timeZone  = AdsApp.currentAccount().getTimeZone();
  var yesterday = new Date(new Date().getTime() - 24 * 60 * 60 * 1000);
  var targetDate = Utilities.formatDate(yesterday, timeZone, 'yyyy-MM-dd');

  // Skip if this date is already in the sheet, to avoid duplicates.
  if (dateAlreadyLogged(sheet, targetDate, ss.getSpreadsheetTimeZone())) {
    Logger.log('Data for ' + targetDate + ' already exists. Skipping.');
    return;
  }

  var query =
    "SELECT campaign.name, ad_group.name, " +
    "ad_group_criterion.keyword.text, ad_group_criterion.keyword.match_type, " +
    "ad_group_criterion.quality_info.quality_score, " +
    "ad_group_criterion.quality_info.search_predicted_ctr, " +
    "ad_group_criterion.quality_info.creative_quality_score, " +
    "ad_group_criterion.quality_info.post_click_quality_score, " +
    "metrics.impressions " +
    "FROM keyword_view " +
    "WHERE segments.date = '" + targetDate + "' " +
    "AND ad_group_criterion.status = 'ENABLED' " +
    "AND campaign.status = 'ENABLED' " +
    "AND ad_group.status = 'ENABLED' " +
    "LIMIT " + MAX_RESULTS;

  var report;
  try {
    report = AdsApp.search(query);
  } catch (e) {
    Logger.log('ERROR running the query: ' + e.message);
    return;
  }

  var rowsToAppend = [];
  while (report.hasNext()) {
    var row = report.next();
    var qi = row.adGroupCriterion.qualityInfo;

    // Skip keywords that have no Quality Score yet.
    if (!qi || qi.qualityScore == null) continue;

    rowsToAppend.push([
      targetDate,
      row.campaign.name,
      row.adGroup.name,
      row.adGroupCriterion.keyword.text,
      row.adGroupCriterion.keyword.matchType,
      qi.qualityScore,
      enumToScore(qi.searchPredictedCtr),
      enumToScore(qi.creativeQualityScore),
      enumToScore(qi.postClickQualityScore),
      row.metrics.impressions
    ]);
  }

  if (rowsToAppend.length > 0) {
    sheet.getRange(sheet.getLastRow() + 1, 1, rowsToAppend.length, rowsToAppend[0].length)
         .setValues(rowsToAppend);
    Logger.log('SUCCESS: Logged ' + rowsToAppend.length + ' keywords for ' + targetDate);
  } else {
    Logger.log('No keywords with Quality Score data for ' + targetDate);
  }
}

Download the free Google Sheets template

The template has the log tab, filters, formulas, and trend chart already built. It’s blank, so there’s no data to clear out.

Download the template (.xlsx)

It’s made for Google Sheets and won’t work in Excel. Upload it to Google Drive and open it in Google Sheets. If it opens as an .xlsx, use File, then Save as Google Sheets.

How to set it up

  1. Open the template in Google Sheets, or create a new sheet with an empty tab named Raw_Data_Log.
  2. In Google Ads, open the account you want to track, then go to Tools, Bulk actions, Scripts.
  3. Click the blue + button, then New script, and paste in the script.
  4. Replace PASTE_YOUR_GOOGLE_SHEET_URL_HERE with your sheet’s URL.
  5. Click Authorize. The Google account you use needs edit access to the sheet.
  6. Click Preview, then check the Logs tab and your sheet. Preview won’t change your account, but it can still write to the sheet. The duplicate check keeps the same day from being logged twice.
  7. Back in the Scripts list, set the frequency to Daily, early in the morning.

Prefer to build the dashboard yourself?

Add a tab called Dashboard. It takes three pieces.

Filters. Add a tab called Lists. Type All in A1 and B1, then put =SORT(UNIQUE(Raw_Data_Log!B:B)) in A2 and =SORT(UNIQUE(Raw_Data_Log!D:D)) in B2. On the Dashboard, add dropdowns in B2 (campaign) and B3 (keyword) with Data, then Data validation, using those two columns as the source. Set both to All.

Daily averages. Paste this in Dashboard A5:

=QUERY(Raw_Data_Log!A:J,"select A, avg(F), avg(G), avg(H), avg(I) where A is not null "&IF($B$2="All","","and B = '"&$B$2&"' ")&IF($B$3="All","","and D = '"&$B$3&"' ")&"group by A order by A label A 'Date', avg(F) 'Avg Quality Score', avg(G) 'Avg Exp CTR Score', avg(H) 'Avg Ad Relevance Score', avg(I) 'Avg Landing Page Score' format A 'yyyy-mm-dd'",0)

Trend chart. Select the Date and Avg Quality Score columns, then use Insert, then Chart, and choose a line chart.

Your dashboard now gives you one row per day, for the whole account or any campaign or keyword you pick.

When to use a Quality Score tracker

  • After a landing page change. Watch whether the landing page score moves.
  • After new ad copy. See whether ad relevance or expected CTR shifts.
  • Finding the weakest component. Know which of the three to fix first.
  • Catching slow declines. Spot a downward trend you’d miss in a single snapshot.
  • Taking over an account. Set a baseline before you change anything.
  • Reporting. Show your team or client a simple trend, without giving them Google Ads access.

What to know before you rely on it

  • It starts from today. It doesn’t backfill, so your history starts with the first run.
  • Treat each row as a daily snapshot. The script pulls Google’s current status fields, not the “(hist.)” columns.
  • Only keywords with impressions appear. A keyword with no impressions yesterday has no row that day, which can move your daily average.
  • The averages aren’t weighted. A keyword with 5 impressions counts the same as one with 5,000. Column J lets you weight it if you want.
  • Apostrophes can break the filters. A campaign or keyword with an apostrophe will cause an error in the dashboard query.
  • It runs per account. Each account needs its own script and sheet.
  • Keep your sheet private. It contains your campaign and keyword names.

FAQ

What is a good Quality Score? Google scores keywords from 1 to 10, but it’s a diagnostic, not a target. Look at which of the three components is holding a keyword back.

Does Google Ads show historical Quality Score? Yes. You can add the “(hist.)” columns and segment by day. This tracker adds a shared log and a filterable dashboard on top.

Does this script change my Google Ads account? No. It reads your data and writes only to your Google Sheet.

This script is free and provided as-is. Test it before relying on the results. Google can change Ads Scripts and reporting over time, so check the current documentation if a query ever errors.

Need to check your offline conversion data too? Try the free GCLID checker script.

Looking for more? Browse all free Google Ads scripts.

Related reading

Want to see where your account stands? Get your Fourscore, or talk to me about what is going on in your account.