Geographical target ID lookup: REQUEST_SIZE_LIMIT_EXCEEDED

1,484 views
Skip to first unread message

Steve Renaker

unread,
Oct 3, 2014, 5:39:38 PM10/3/14
to adwor...@googlegroups.com
I have a long list of geographical locations which I would like to add to a campaign.  I would like to read from a list of zip codes, look up the criteria ID for each one, and add them all to a campaign. The bit of python code which does the ID lookup looks like this:

def find_ids(client):
  location_criterion_service = client.GetService(
      'LocationCriterionService', version='v201402')
 
  with open('zip_codes.txt') as temp_file:
    location_names = [line.rstrip('\n') for line in temp_file]

  selector = {
      'fields': ['Id', 'LocationName'],
      'predicates': [{
          'field': 'LocationName',
          'operator': 'IN',
          'values': location_names
      }, {
          'field': 'Locale',
          'operator': 'EQUALS',
          'values': ['en']
      }]
  }

  location_criteria = location_criterion_service.get(selector)

It works as long as the list of zip codes is no longer than 25. Any longer and it throws an error:

SizeLimitError.REQUEST_SIZE_LIMIT_EXCEEDED @ locationName; trigger:'25'

Is there a better way to do this, or do I need to set up a batching loop?

Thanks very much for any help.

- Steve Renaker

Steve Renaker

unread,
Oct 3, 2014, 8:08:41 PM10/3/14
to adwor...@googlegroups.com
It looks like the solution here is to download the entire ID data file and do the ID lookups locally. But I've noticed something with the datafile -- not all U.S. zip codes are listed there. Only about 80% of all U.S. zip codes have a Criteria ID. Is there a reason for that?

Thanks,

- Steve

Josh Radcliff (AdWords API Team)

unread,
Oct 6, 2014, 9:29:44 AM10/6/14
to adwor...@googlegroups.com
Hi Steve,

You're absolutely correct - using the CSV file is the best way to go. I would expect all valid zip codes to be in that list, however. If you have examples of missing zip codes, could you send them over?

Thanks,
Josh, AdWords API Team

Steve Renaker

unread,
Oct 6, 2014, 12:18:10 PM10/6/14
to adwor...@googlegroups.com
Hi Josh,

I got a complete list of US zip codes from here: http://www.unitedstateszipcodes.org/zip-code-database/

I compared it with the zip code section from the CSV file AdWords API Location Criteria 2014-07-23.csv

Attached is the diff output, about 10,000 lines.  I spot-checked a few lines against the lookup tool at https://developers.google.com/adwords/api/docs/appendix/geotargeting, but I haven't done an exhaustive check.  These are the zip codes I spot-checked: 19183 19184 19185 (which are all in Philadelphia).

Thanks and best regards,

- Steve
google_usps_zipcodes_diff.txt

Josh Radcliff (AdWords API Team)

unread,
Oct 7, 2014, 6:58:24 PM10/7/14
to adwor...@googlegroups.com
Hi Steve,

Thanks for sending over the list. I'm following up with our doc team to update the geo targeting page.

Cheers,
Josh, AdWords API Team

Josh Radcliff (AdWords API Team)

unread,
Dec 10, 2014, 9:17:57 AM12/10/14
to adwor...@googlegroups.com
Hi Steve,

I confirmed that this is intentional. The zip codes in your list are for non-geo locations such as PO boxes, so a user cannot actually physically be in that location. As a result, AdWords intentionally does not support targeting such locations.

Thanks,
Josh, AdWords API Team
Reply all
Reply to author
Forward
0 new messages