@@ -53,6 +53,8 @@ def detect_and_apply_recommendations(client, customer_id):
5353 client: an initialized GoogleAdsClient instance.
5454 customer_id: a client customer ID.
5555 """
56+
57+ # [START detect_keyword_recommendations]
5658 googleads_service = client .get_service ("GoogleAdsService" )
5759 query = f"""
5860 SELECT
@@ -83,13 +85,15 @@ def detect_and_apply_recommendations(client, customer_id):
8385 operations .append (
8486 build_recommendation_operation (client , recommendation .resource_name )
8587 )
88+ # [END detect_keyword_recommendations]
8689
8790 # If there are operations present, send a request to apply the
8891 # recommendations.
8992 if operations :
9093 apply_recommendations (client , customer_id , operations )
9194
9295
96+ # [START build_apply_recommendation_operation]
9397def build_recommendation_operation (client , recommendation ):
9498 """Creates a ApplyRecommendationOperation to apply the given recommendation.
9599
@@ -119,7 +123,7 @@ def build_recommendation_operation(client, recommendation):
119123
120124 operation .resource_name = recommendation
121125 return operation
122-
126+ # [END build_apply_recommendation_operation]
123127
124128# [START apply_recommendation]
125129def apply_recommendations (client , customer_id , operations ):
0 commit comments