Skip to content

Commit

Permalink
Merge pull request #853 from googleads/recommendation-tags
Browse files Browse the repository at this point in the history
Add new recommendation devsite tags
  • Loading branch information
danielfrg authored Apr 2, 2024
2 parents bcee4d0 + e0661f8 commit 6d42d38
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/recommendations/detect_and_apply_recommendations.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ def detect_and_apply_recommendations(client, customer_id):
client: an initialized GoogleAdsClient instance.
customer_id: a client customer ID.
"""

# [START detect_keyword_recommendations]
googleads_service = client.get_service("GoogleAdsService")
query = f"""
SELECT
Expand Down Expand Up @@ -83,13 +85,15 @@ def detect_and_apply_recommendations(client, customer_id):
operations.append(
build_recommendation_operation(client, recommendation.resource_name)
)
# [END detect_keyword_recommendations]

# If there are operations present, send a request to apply the
# recommendations.
if operations:
apply_recommendations(client, customer_id, operations)


# [START build_apply_recommendation_operation]
def build_recommendation_operation(client, recommendation):
"""Creates a ApplyRecommendationOperation to apply the given recommendation.
Expand Down Expand Up @@ -119,6 +123,7 @@ def build_recommendation_operation(client, recommendation):

operation.resource_name = recommendation
return operation
# [END build_apply_recommendation_operation]


# [START apply_recommendation]
Expand Down

0 comments on commit 6d42d38

Please sign in to comment.