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)
Shamelessly stolen and modified from
https://groups.google.com/d/msg/adwords-api/cgzG6rfPW7A/TmBI5Czv_-MJ
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
On Friday, August 17, 2018 at 9:45:58 AM UTC+1, [email protected] wrote:
>
> 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
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/f1a92de5-89e1-4a82-8928-bc78fca6ea11%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.