Tuesday, March 19, 2013

Store Search Query Performance Report in a Google Doc

Well, I promised you that once the AdWords Scripts team had fixed the issue with the reporting API that I would start adding some examples. Thankfully they fixed it today because I wanted to start playing with the Search Query Performance Report.

This report will give you all the user search queries for your broad match keywords. Normally, you have to log in and manually generate the report each day. But with AdWords scripts, you can start storing all of that data into a Google Spreadsheet so that it is easier to work with.

So today I have a simple script that will store the search query report and send you an email reminding you that it's ready. All you need to do is fill in the url from an existing Google Doc that you have access to with the same log in as your AdWords account, and set the email addresses you want to send a notice to, and you should be all set. There is also a flag to determine if you want to ignore exact and exact (close variant) matched keywords from the results, which I recommend.


* Store Search Query Perf Report in Google Doc
* Version 1.1
* CHangelog v1.1 - Removed apiVersion, Updated formatting
* Created By: Russ Savage
* FreeAdWordsScripts.com
var IGNORE_EXACT = true;
var TO = ["email_1@my_company.com","email_2@my_company.com"];
var SPREADSHEET_URL = "your spreadsheet url goes here";  

function main() {
  var columns = ['AccountDescriptiveName',
  var columnsStr = columns.join(',') + " ";
  var sheet = SpreadsheetApp.openByUrl(SPREADSHEET_URL).getActiveSheet();
  var reportIter = AdWordsApp.report(
    'SELECT ' + columnsStr +
      includeZeroImpressions: false
  while(reportIter.hasNext()) {
    var row = reportIter.next();
    if(IGNORE_EXACT && row['MatchType'].indexOf('exact') >= 0) { continue; }
    var rowArray = [];
    for(var i in columns) {
  for(var i in TO) {
    MailApp.sendEmail(TO[i], "Search Query Report Ready", SPREADSHEET_URL);


  1. Brilliant!

    What if I want to filter out brand keywords ?

    Where do I put the condition ?


    1. Hi Giu, It kind of depends on how you have identified your brand terms. If you put all your brand terms in their own set of campaigns, you could add a filter in the loop that starts on line 41 that flags things as brand or non-brand.

      If you configured things using labels, things get a bit more complicated. Currently, there is no way to get labels from the search query performance report. That means, depending on the size of our account, you would need to have a separate script that stores keyword text and the labels (possibly in the same spreadsheet on a different tab) and then link the two together.


  2. Do you need a remote phone spy? I knew one guy that can bring you something!

  3. print test page is a way to test and service all your hardware devices. It is done by using troubleshooting all your system i.e. printer.
    And, You cannot open BIN file directly. You can save data and information in a particular folder using file extension bin. BIN files are connected with compacted parallel files. It contains a paired code.

  4. Download Microsoft office as it could be the best choice for your work if you want to manage your data with an efficient tool.

  5. After installing the setup.office.com on your computer system, your existing MS account or create a new account and enter the product key.

  6. Wonder to see this information... thanks for sharing with us.
    open acsm file

  7. I appreciate your efforts, keep writing.
    open apk file on pc

  8. Amazing post! i like it this is very usefull for me also check how much does a football pitch cost

  9. Thank you for the valuable post. It seems very informative! search engine submission sites list