examples/AdWords/v201809/AdvancedOperations/AddDynamicPageFeed.php
private static function addDsaTargeting(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        $adGroupId,
        $dsaPageUrlLabel
    ) {
        $adGroupCriterionService = $adWordsServices->get($session, AdGroupCriterionService::class);

        // Create a webpage criterion.
        $webpage = new Webpage();

        $parameter = new WebpageParameter();
        $parameter->setCriterionName('Test criterion');
        $webpage->setParameter($parameter);

        // Add a condition for label=specified_label_name.
        $condition = new WebpageCondition();
        $condition->setOperand(WebpageConditionOperand::CUSTOM_LABEL);
        $condition->setArgument($dsaPageUrlLabel);
        $parameter->setConditions([$condition]);

        $criterion = new BiddableAdGroupCriterion();
        $criterion->setAdGroupId($adGroupId);
        $criterion->setCriterion($webpage);

        // Set a custom bid for this criterion.
        $biddingStrategyConfiguration = new BiddingStrategyConfiguration();

        $cpcBid = new CpcBid();
        $money = new Money();
        $money->setMicroAmount(1500000);
        $cpcBid->setBid($money);
        $biddingStrategyConfiguration->setBids([$cpcBid]);

        $criterion->setBiddingStrategyConfiguration($biddingStrategyConfiguration);

        $operation = new AdGroupCriterionOperation();
        $operation->setOperand($criterion);
        $operation->setOperator(Operator::ADD);

        // Create ad group criterion on the server and print out some information.
        $result = $adGroupCriterionService->mutate([$operation]);
        $criterion = $result->getValue()[0];
        printf(
            "Web page criterion with ID %d and status '%s' was created.\n",
            $criterion->getCriterion()->getId(),
            $criterion->getUserStatus()
        );
    }
private static function addDsaTargeting(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        $adGroupId,
        $dsaPageUrlLabel
    ) {
        $adGroupCriterionService = $adWordsServices->get($session, AdGroupCriterionService::class);

        // Create a webpage criterion.
        $webpage = new Webpage();

        $parameter = new WebpageParameter();
        $parameter->setCriterionName('Test criterion');
        $webpage->setParameter($parameter);

        // Add a condition for label=specified_label_name.
        $condition = new WebpageCondition();
        $condition->setOperand(WebpageConditionOperand::CUSTOM_LABEL);
        $condition->setArgument($dsaPageUrlLabel);
        $parameter->setConditions([$condition]);

        $criterion = new BiddableAdGroupCriterion();
        $criterion->setAdGroupId($adGroupId);
        $criterion->setCriterion($webpage);

        // Set a custom bid for this criterion.
        $biddingStrategyConfiguration = new BiddingStrategyConfiguration();

        $cpcBid = new CpcBid();
        $money = new Money();
        $money->setMicroAmount(1500000);
        $cpcBid->setBid($money);
        $biddingStrategyConfiguration->setBids([$cpcBid]);

        $criterion->setBiddingStrategyConfiguration($biddingStrategyConfiguration);

        $operation = new AdGroupCriterionOperation();
        $operation->setOperand($criterion);
        $operation->setOperator(Operator::ADD);

        // Create ad group criterion on the server and print out some information.
        $result = $adGroupCriterionService->mutate([$operation]);
        $criterion = $result->getValue()[0];
        printf(
            "Web page criterion with ID %d and status '%s' was created.\n",
            $criterion->getCriterion()->getId(),
            $criterion->getUserStatus()
        );
    }
private static function addDsaTargeting ( AdWordsServices $ adWordsServices , AdWordsSession $ session , $ adGroupId , $ dsaPageUrlLabel ) { $ adGroupCriterionService = $ adWordsServices -> get ( $ session , AdGroupCriterionService :: class ) ; // Create a webpage criterion. $ webpage = new Webpage ( ) ; $ parameter = new WebpageParameter ( ) ; $ parameter -> setCriterionName ( 'Test criterion' ) ; $ webpage -> setParameter ( $ parameter ) ; // Add a condition for label=specified_label_name. $ condition = new WebpageCondition ( ) ; $ condition -> setOperand ( WebpageConditionOperand :: CUSTOM_LABEL ) ; $ condition -> setArgument ( $ dsaPageUrlLabel ) ; $ parameter -> setConditions ( [ $ condition ] ) ; $ criterion = new BiddableAdGroupCriterion ( ) ; $ criterion -> setAdGroupId ( $ adGroupId ) ; $ criterion -> setCriterion ( $ webpage ) ; // Set a custom bid for this criterion. $ biddingStrategyConfiguration = new BiddingStrategyConfiguration ( ) ; $ cpcBid = new CpcBid ( ) ; $ money = new Money ( ) ; $ money -> setMicroAmount ( 1500000 ) ; $ cpcBid -> setBid ( $ money ) ; $ biddingStrategyConfiguration -> setBids ( [ $ cpcBid ] ) ; $ criterion -> setBiddingStrategyConfiguration ( $ biddingStrategyConfiguration ) ; $ operation = new AdGroupCriterionOperation ( ) ; $ operation -> setOperand ( $ criterion ) ; $ operation -> setOperator ( Operator :: ADD ) ; // Create ad group criterion on the server and print out some information. $ result = $ adGroupCriterionService -> mutate ( [ $ operation ] ) ; $ criterion = $ result -> getValue ( ) [ 0 ] ; printf ( "Web page criterion with ID %d and status '%s' was created.\n" , $ criterion -> getCriterion ( ) -> getId ( ) , $ criterion -> getUserStatus ( ) ) ; }
Sets custom targeting for the page feed URLs based on a list of labels.
Sets custom targeting for the page feed URLs based on a list of labels .