Strange locationIDs in CAMPAIGN_LOCATION_TARGET_REPORT

53 views
Skip to first unread message

drmat...@gmail.com

unread,
Aug 17, 2018, 4:45:58 AM8/17/18
to AdWords API and Google Ads API Forum
Hi,

I am usng the `CAMPAIGN_LOCATION_TARGET_REPORT` to do some regional analysis of a number of Ads campaigns, however I am having trouble with this report returning a lot of locationIDs which are not in the locations lookup table reported here: https://developers.google.com/adwords/api/docs/appendix/geotargeting

Some of the locations are in the table, but there are some really long IDs, such as 72296427784, 72296426224 etc which are not.

I have tried to look at the LocationCriterionService, but have had no look finding any python examples for how to do this, beyond the cryptic
  # Create locations. The IDs can be found in the documentation or retrieved
 
# with the LocationCriterionService.
comment in the targetting example: https://developers.google.com/adwords/api/docs/samples/python/targeting

Any help would be greatly appreciated

Mat

drmat...@gmail.com

unread,
Aug 17, 2018, 10:24:42 AM8/17/18
to adwor...@googlegroups.com
Okay, I have come up with a python script to interact with the LocationCriterionService, which has helped me learn more about the API, but am still having the issue with the locations returned from the API not being vaild

If this helps anyone, the code I am using is:
def find_names(client):
  location_criterion_service = client.GetService(
      'LocationCriterionService', version='v201806')
 
  selector = {
      'fields': ['Id', 'LocationName'],
      'predicates': [{
          'field': 'Id',
          'operator': 'EQUALS',
          'values': 21179
      }]
  }

  return location_criterion_service.get(selector)

client = adwords.AdWordsClient.LoadFromStorage()
find_names(client)


this returns 
[{
     'location': {
         'id': 21179,
         'type': None,
         'Criterion.Type': 'Location',
         'locationName': 'Vermont',
         'displayType': 'State',
         'targetingStatus': 'ACTIVE',
         'parentLocations': [
             {
                 'id': 2840,
                 'type': None,
                 'Criterion.Type': 'Location',
                 'locationName': 'United States',
                 'displayType': 'Country',
                 'targetingStatus': 'ACTIVE',
                 'parentLocations': []
             }
         ]
     },
     'canonicalName': 'Vermont,United States',
     'reach': 725000,
     'locale': None,
     'searchTerm': None,
     'countryCode': None
 }]

for a known location, as expected, but just an empty list for some of these longer locations Ids that I have been seeing

Any help on this matter would be appreciated.

Mathew

Dhanya Sundararaju (AdWords API Team)

unread,
Aug 17, 2018, 2:01:20 PM8/17/18
to AdWords API and Google Ads API Forum
Hi Mat,

User defined location ids will not be available in the LocationCriterionService. If that is the case, could you reply back with your client customer id and report definition so that I can troubleshoot further?

Regards,
Dhanya, AdWords API Team
Reply all
Reply to author
Forward
0 new messages