Get Started

AdWords Scripts

Follow these instructions to get going with AdWords scripts in under a minute.

  1. Navigate to the Campaigns tab in the AdWords web application.

  2. In the left navigation click Bulk operations, then choose Scripts.

  3. Click + Script button to create a new script.

  4. Copy and paste the following code into the editor area:

    function main() {
      var keywords = AdWordsApp.keywords()
          .orderBy("Impressions DESC")
          .forDateRange("YESTERDAY")
          .withLimit(10)
          .get();
    
      Logger.log("10 keywords with most impressions yesterday");
      while (keywords.hasNext()) {
        var keyword = keywords.next();
        Logger.log(keyword.getText() + ": " +
            keyword.getStatsFor("YESTERDAY").getImpressions());
      }
    }
    

  5. Click Authorize now to authorize the script. Don't worry, this only has to be done once per script.

  6. Click Preview and wait a bit for the results to appear.

MCC Scripts

Note: You must first have an AdWords manager account to run MCC scripts.

Follow these instructions to get going with MCC scripts in under a minute.

  1. Navigate to the Accounts tab in the AdWords web application.

  2. In the left navigation, click Bulk Operations, then choose Scripts.

  3. Click the + Script button to create a new script.

  4. Copy and paste the following code into the editor area:

    function main() {
      // Retrieve all the child accounts.
      var accountIterator = MccApp.accounts().get();
    
      // Iterate through the account list.
      while (accountIterator.hasNext()) {
        var account = accountIterator.next();
        // Get stats for the child account.
        var stats = account.getStatsFor("THIS_MONTH");
        // And log it.
        Logger.log("%s,%s,%s,%s", account.getCustomerId(), stats.getClicks(),
                   stats.getImpressions(), stats.getCost());
      }
    }
    

  5. Click Authorize now to authorize the script. Don't worry, this only has to be done once per script.

  6. Click Preview and wait a bit for the results to appear.

Perhaps not the most useful of scripts out there, but it's a start! Explore our code snippets and examples for further inspiration.

Send feedback about...

AdWords Scripts
AdWords Scripts