Setting multiple countries to location parameter in LocationSearchParameter (Python API)

198 views
Skip to first unread message

Muhammad Shoaib

unread,
Oct 9, 2019, 4:59:23 PM10/9/19
to AdWords API and Google Ads API Forum

How can I set multiple countries in LocationSearchParameter? Is it going to be a list of country codes? Let's say, I want to look for keyword stats in three countries (Germany, Austria, and Switzerland)

Ref: 

Client Library: Python

Google Ads API Forum Advisor Prod

unread,
Oct 10, 2019, 2:42:06 AM10/10/19
to adwor...@googlegroups.com

Hi Muhammad,

Thank you for reaching out.

In setting the LocationSearchParameter, the required field of the Location object is the id, therefore, you need to set this, and not the country code. To get the location criterion ID that you can use, you can refer to the geo targets guide on which you can open the geo targets table. For example, for Germany, the criterion ID is 2276, Austria is 2040 and Switzerland is 2756.

  # Location setting (optional).
  selector['searchParameters'].append({
    'xsi_type': 'LocationSearchParameter',
    'locations': [{'id': '2276'}, {'id': '2040'}, {'id': '2756'}]
  })


If you would like to retrieve keyword stats, you may specify the requestType as STATS and you can request the stats for keywords that the user already has.

Please let me know if you have further clarifications.

Regards,
Hiroyuki
Google Ads API Team



ref:_00D1U1174p._5001UKMnJb:ref
Reply all
Reply to author
Forward
0 new messages