@@ -491,14 +491,15 @@ def _create_smart_campaign_setting_operation(
491491
492492# [START add_smart_campaign_8]
493493def _create_campaign_criterion_operations (
494- client , customer_id , keyword_theme_infos
494+ client , customer_id , keyword_theme_infos , suggestion_info
495495):
496496 """Creates a list of MutateOperations that create new campaign criteria.
497497
498498 Args:
499499 client: an initialized GoogleAdsClient instance.
500500 customer_id: a client customer ID.
501501 keyword_theme_infos: a list of KeywordThemeInfos.
502+ suggestion_info: A SmartCampaignSuggestionInfo instance.
502503
503504 Returns:
504505 a list of MutateOperations that create new campaign criteria.
@@ -522,6 +523,22 @@ def _create_campaign_criterion_operations(
522523 # Add the mutate operation to the list of other operations.
523524 operations .append (mutate_operation )
524525
526+ # Create location criterion to add location to target with the campaign
527+ mutate_operation = client .get_type ("MutateOperation" )
528+ campaign_criterion = (
529+ mutate_operation .campaign_criterion_operation .create
530+ )
531+ # Set the campaign ID to a temporary ID.
532+ campaign_criterion .campaign = campaign_service .campaign_path (
533+ customer_id , _SMART_CAMPAIGN_TEMPORARY_ID
534+ )
535+ # Set the criterion type to LOCATION.
536+ campaign_criterion .type_ = client .enums .CriterionTypeEnum .LOCATION
537+ # Set the location to the given location.
538+ campaign_criterion .location = suggestion_info .location_list .locations
539+ # Add the mutate operation to the list of other operations.
540+ operations .append (mutate_operation )
541+
525542 return operations
526543 # [END add_smart_campaign_8]
527544
0 commit comments