Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new recommendation devsite tags #853

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Recommendation doc tags
  • Loading branch information
danielfrg committed Apr 2, 2024
commit 512fcb968950cbf7e8658cc6e9092b0971755a92
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,7 123,7 @@ def build_recommendation_operation(client, recommendation):

operation.resource_name = recommendation
return operation

# [END build_apply_recommendation_operation]

# [START apply_recommendation]
def apply_recommendations(client, customer_id, operations):
Expand Down