WebpageConditionOperand for "all webpages"

71 views
Skip to first unread message

Timo Zuppelli

unread,
Jun 30, 2021, 9:21:16 AM6/30/21
to AdWords API and Google Ads API Forum
Hi @all,

I'm trying to add a dynamic ad target with a python script using the "WebpageConditionOperand" but it seems like there is no parameter for "all webpages".

 ad_group_criterion_operation = client.get_type("AdGroupCriterionOperation")
    # Create a new ad group criterion.
    ad_group_criterion = ad_group_criterion_operation.create
    ad_group_criterion.ad_group = ad_group_resource_name
    # Set the custom bid for this criterion.
    # ad_group_criterion.cpc_bid_micros = 1500000
    ad_group_criterion.webpage.criterion_name = "Alle Webseiten"
    # Add a condition for label=specified_label_name
    webpage_criterion_info = client.get_type(
        "WebpageConditionInfo"
    )
    webpage_criterion_info.argument = 'Alle Seiten meiner Website'
    webpage_criterion_info.operand = client.get_type(
        "WebpageConditionOperandEnum"
    ).WebpageConditionOperand.ALL_PAGES

    ad_group_criterion.webpage.conditions.append(webpage_criterion_info)

    # Retrieve the ad group criterion service.
    ad_group_criterion_service = client.get_service("AdGroupCriterionService")
    response = ad_group_criterion_service.mutate_ad_group_criteria(
        customer_id=customer_id, operations=[ad_group_criterion_operation]
    )
    resource_name = response.results[0].resource_name

    # Display the results.
    print(f"Created ad group criterion within DSA Campaign with resource_name: '{resource_name}'")

Note: ALL_PAGES was my desperate try to find the correct parameter. 

What am I doing wrong?

Thanks for you help in advance.

All the best,

Timo

Google Ads API Forum Advisor

unread,
Jul 2, 2021, 11:33:57 AM7/2/21
to timo.z...@s24.com, adwor...@googlegroups.com
Hi Timo,

Thank you for reaching out to us. In looking over the following document and scroll down to WebPageInfo. It would seem that the way to get all the information for all webpages would be to use WebPageInfo as this returns every webpage for the site.

Regards,
Google Logo
William Pescherine
Google Ads API Team
 


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