Okay I think this meets my needs: But is this the best way? It is very inefficient to need to download a CSV in order to figure this out.
import csv import requests CSV_URL = 'https://developers.google.com/static/adwords/api/docs/appendix/geo/geotargets-2022-09-14.csv' with requests.Session() as s: ....download = s.get(CSV_URL) ....decoded_content = download.content.decode('utf-8') ....cr = csv.reader(decoded_content.splitlines(), delimiter=',') ....data = list(cr) df = pd.DataFrame(my_list[1:], columns=my_list[0]) df.loc[df['Target Type']=='Country'] On Wednesday, December 14, 2022 at 4:11:44 PM UTC-8 Chad Wood wrote: > Apparently, that CSV only has the column I need for "legacy support". If > that is the case, what is the newer solution? > > On Wednesday, December 14, 2022 at 4:08:55 PM UTC-8 Chad Wood wrote: > >> Alright, found an answer worth a proof of concept: >> https://developers.google.com/adwords/api/docs/appendix/geotargeting >> >> Problem is, how stable is this? >> >> Latest .csv (2022-09-14) >> <https://developers.google.com/static/adwords/api/docs/appendix/geo/geotargets-2022-09-14.csv> >> >> >> Previous .csv (2022-08-18) >> <https://developers.google.com/static/adwords/api/docs/appendix/geo/geotargets-2022-08-18.csv> >> >> In less than 30 days this CSV had two updates. Guess I'll need an API to >> query the data new every time it is needed? >> >> On Wednesday, December 14, 2022 at 3:21:05 PM UTC-8 Chad Wood wrote: >> >>> By the way, here's a copy of the response I get. (I updated my query >>> slightly) >>> >>> [ >>> ....{ >>> ........'campaign': { >>> ............'advertising_channel_type': 'DISPLAY', >>> ............'name': 'Trix_Are_Not_For_Rabbits', >>> ........}, >>> ........'metrics': { >>> ............'clicks': '0', >>> ............'cost_micros': '0', >>> ............'impressions': '2' >>> .........}, >>> ........'segments': { >>> ............'date': '2022-12-01' >>> ........}, >>> ........'geographic_view': { >>> ............'resource_name': >>> 'customers/2972229294/geographicViews/2036~LOCATION_OF_PRESENCE', >>> >>> ............'country_criterion_id': '2036' >>> ........} >>> ....} >>> ] >>> >>> Here's what the ideal response would look like: >>> [ >>> ....{ >>> ........'campaign': { >>> ............'advertising_channel_type': 'DISPLAY', >>> ............'name': 'Trix_Are_Not_For_Rabbits', >>> ........}, >>> ........'metrics': { >>> ............'clicks': '0', >>> ............'cost_micros': '0', >>> ............'impressions': '2' >>> .............}, >>> ........'segments': { >>> ............'date': '2022-12-01' >>> ........}, >>> ........'geographic_view': { >>> ............'canonical_name': 'FRANCE' >>> ........} >>> ....} >>> ] >>> >>> Notice it has the Channel, Country, Date, and 3 Metrics in there. >>> On Wednesday, December 14, 2022 at 3:05:08 PM UTC-8 Chad Wood wrote: >>> >>>> Just found this: campaign.advertising_channel_type >>>> Any chance *geo_target_constant* is compatible with campaign? >>>> >>>> I think I saw in a previous error that it is not. I'll give it a try >>>> though. >>>> On Wednesday, December 14, 2022 at 2:54:41 PM UTC-8 Chad Wood wrote: >>>> >>>>> Sorry, realizing I butchered my title. cost, impressions, and clicks >>>>> are not dimensions. >>>>> >>>>> On Wednesday, December 14, 2022 at 2:53:46 PM UTC-8 Chad Wood wrote: >>>>> >>>>>> Hello, >>>>>> >>>>>> Here's my current query: >>>>>> >>>>>> SELECT >>>>>> ....geographic_view.country_criterion_id, >>>>>> ....metrics.clicks, >>>>>> ....metrics.impressions, >>>>>> ....metrics.cost_micros, >>>>>> ....ad_group.type, >>>>>> ....segments.date >>>>>> FROM >>>>>> ....geographic_view >>>>>> WHERE >>>>>> ....segments.date BETWEEN '2022-12-01' AND '2022-12-01' >>>>>> >>>>>> This produces the country_criterion_id, and I have no idea how to >>>>>> convert that to a country_id or country_name. I need the country_name, >>>>>> but >>>>>> a country_id will do fine. >>>>>> >>>>>> *By the way, the geo_target_constant resource is not compatible with >>>>>> ad_group.type*. This is very important though, as the data needs >>>>>> paired with defaultChannelGrouping data from GA4. So I need both country >>>>>> and ad_group.type. >>>>>> >>>>>> What is the solution here? Also getting campaign_name would be nice, >>>>>> but not required. >>>>>> >>>>>> Thanks! >>>>>> >>>>> -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com 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 "Google Ads API and AdWords API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/9f4f5762-8b3b-4cb9-9117-b442c922844en%40googlegroups.com.