Common Issues

This is a compilation of the most common issues raised in the AdWords Scripts Forum.

Common JavaScript errors

Script is failing with "Cannot find function: FUNCTION_NAME"

This is usually the result of a misspelled function name in the script. 1. Check that the function name is spelled correctly and has the correct spelling case; e.g., AdWordsApp.keywordz() will result in this error, because keywordz is not a valid function in the AdWordsApp class. AdWordsApp.Keywords() will also fail due to incorrect spelling case for the keywords() function. 2. Check that the function exists; e.g., AdWordsApp.keywords().next() will fail because AdWordsApp.keywords() returns a KeywordSelector while next() is a method for KeywordIterators. The correct code would be AdWordsApp.keywords().get().next().

My script runs, but doesn't do anything

The most common reason for this issue is that you have a function that performs an operation, but you are not calling it from the main() method. This commonly happens when you copy-paste code snippets from our documentation.

Coding approach Code snippet
Version 1 (doesn't work)
function main() {
  // Call to getAllCampaigns is missing, so this script does nothing.
}

function getAllCampaigns() {
  // AdWordsApp.campaigns() will return all campaigns that are not
  // removed by default.
  var campaignIterator = AdWordsApp.campaigns().get();
  Logger.log('Total campaigns found : ' +
      campaignIterator.totalNumEntities());
  while (campaignIterator.hasNext()) {
    var campaign = campaignIterator.next();
    Logger.log(campaign.getName());
  }
}
Version 2 (doesn't work)
function main() {
  // Call to getAllCampaigns is missing, so this script does nothing.

  function getAllCampaigns() {
    // AdWordsApp.campaigns() will return all campaigns that are not
    // removed by default.
    var campaignIterator = AdWordsApp.campaigns().get();
    Logger.log('Total campaigns found : ' +
        campaignIterator.totalNumEntities());
    while (campaignIterator.hasNext()) {
      var campaign = campaignIterator.next();
      Logger.log(campaign.getName());
    }
  }
}
Version 3 (works)
function main() {
  getAllCampaigns();
}

function getAllCampaigns() {
  // AdWordsApp.campaigns() will return all campaigns that are not removed
  // by default.
  var campaignIterator = AdWordsApp.campaigns().get();
  Logger.log('Total campaigns found : ' +
      campaignIterator.totalNumEntities());
  while (campaignIterator.hasNext()) {
    var campaign = campaignIterator.next();
    Logger.log(campaign.getName());
  }
}

I get a "Cannot find function getFinalUrl" error when upgrading my scripts

You may run into this error when changing your script to work with Upgraded URLs. This happens when you replace calls to ad.getDestinationUrl() with ad.getFinalUrl(). getFinalUrl() is part of the AdUrls class, so you'd need to change your code to ad.urls().getFinalUrl():

function main() {
  // Incorrect snippet. getFinalUrl is not a member of the Ad class.
  var ad = AdWordsApp.ads().get().next();
  var url = ad.getFinalUrl();

  // Correct snippet.
  var ad = AdWordsApp.ads().get().next();
  var url = ad.urls().getFinalUrl();
}

I get no stats for X

Unavailability of data for a particular entity or date range is a common error you may encounter when running reports or making stats calls. There are several things that you can try:

  1. Check the date range for which you are retrieving stats or running reports.
  2. Ensure that you are requesting the right columns / dimensions. The list of all the supported reports and their columns are available at the report reference page. If you need help mapping a UI column to an API report column, see our Reports UI guide.
  3. If you retrieve account-level stats for an MCC Script that manages accounts of different currencies, you get back the cost in the currency of the MCC account.
  4. AdWords may not have the data you are looking for yet. See our data freshness guide for details.

I'm getting an error when I request column X in a report

You may encounter this error when enhancing an existing reporting script to add new columns. There are some common reasons why this error happens:

  1. The column you are trying to access might simply not be available for that report type. Refer to our reports reference page to check if that's the case.
  2. Column names are case-sensitive, should match the values displayed on our reports reference page. For example, when requesting clicks stats, the column name to use is "Clicks": "clicks", "click", "CLICK" are all invalid.
  3. Check if the column you are trying to request was recently deprecated in a new API version or is a new column that was introduced in a recent API version. The columns displayed on the reports reference page is always for the latest API version. However, your code may not be accessing the latest version of the reports due to one of the following reasons:

    1. AdWords Scripts may not yet support an API report version that was released recently. We announce new features on the Scripts forum on a regular basis, you can keep track of these announcements to see when a new reports version is supported.
    2. Your code may be making calls to a specific reports version, as explained on our reports guide. You may want to change the version number to one that supports the column you are trying to access.
  4. You should limit the number of segmentation columns you request in your reports. Every segmentation column you request increases the number of rows in your report exponentially. The more segmentation columns you request, the higher the chance that the report request will fail due to an error. We recommend limiting the number of segment columns to 7.

  5. Some report columns may not be compatible with others. In such cases, more details are available as part of the reports reference documentation.

Feature requests

Is Feature X available?

See our list of supported entities.

When will feature X be available?

We try to work on the most-requested features first. If there's a feature you'd like to see, then follow these steps:

  1. First, verify that the feature is not supported in AdWords Scripts by checking the list of supported entities.
  2. If it's not available, search the AdWords Scripts Forum to see if it's already been asked about before. If yes, upvote that thread, or leave a comment if you want to share additional details like a use case.
  3. If the feature is not yet requested, then make a feature request by opening a new thread on the AdWords Scripts Forum. Make sure you provide a use case that this feature will solve. When possible, include a link to the Help Center guide or an AdWords API blog post / guide that describes this feature. This will help other developers as they upvote a feature request. We prioritize feature requests based on their popularity.
  4. Tag the post as "Feature Request" to make it easier for us (as well as users) to quickly check for feature requests.

How do I use feature X?

See our code snippets and solutions for examples of how to use a particular feature. If you don't find a suitable code snippet, feel free to make a request in the forum.

Send feedback about...

AdWords Scripts
AdWords Scripts
Need help? Visit our support page.