examples/AdWords/v201809/AdvancedOperations/AddDynamicSearchAdsCampaign.php
private static function addWebPageCriteria(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        AdGroup $adGroup
    ) {
        $adGroupCriterionService = $adWordsServices->get($session, AdGroupCriterionService::class);

        // Create a webpage criterion for special offers.
        $param = new WebpageParameter();
        $param->setCriterionName('Special offers');

        // Create a webpage criterion for special offers.
        $urlCondition = new WebpageCondition();
        $urlCondition->setOperand(WebpageConditionOperand::URL);
        $urlCondition->setArgument('/specialoffers');

        $titleCondition = new WebpageCondition();
        $titleCondition->setOperand(WebpageConditionOperand::PAGE_TITLE);
        $titleCondition->setArgument('Special Offer');

        $param->setConditions([$urlCondition, $titleCondition]);

        $webpage = new Webpage();
        $webpage->setParameter($param);

        // Create a biddable ad group criterion.
        $biddableAdGroupCriterion = new BiddableAdGroupCriterion();
        $biddableAdGroupCriterion->setAdGroupId($adGroup->getId());
        $biddableAdGroupCriterion->setCriterion($webpage);
        $biddableAdGroupCriterion->setUserStatus(UserStatus::PAUSED);

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

        // Optional: set a custom bid.
        $cpcBid = new CpcBid();
        $money = new Money();
        $money->setMicroAmount(10000000);
        $cpcBid->setBid($money);
        $biddingStrategyConfiguration->setBids([$cpcBid]);
        $biddableAdGroupCriterion->setBiddingStrategyConfiguration(
            $biddingStrategyConfiguration
        );

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

        // Create the criterion on the server and print out some information.
        $result = $adGroupCriterionService->mutate([$operation]);
        $adGroupCriterion = $result->getValue()[0];
        printf(
            "Web page criterion with ID %d was added to ad group ID %d.\n",
            $adGroupCriterion->getCriterion()->getId(),
            $adGroupCriterion->getAdGroupId()
        );
    }
private static function addWebPageCriteria(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        AdGroup $adGroup
    ) {
        $adGroupCriterionService = $adWordsServices->get($session, AdGroupCriterionService::class);

        // Create a webpage criterion for special offers.
        $param = new WebpageParameter();
        $param->setCriterionName('Special offers');

        // Create a webpage criterion for special offers.
        $urlCondition = new WebpageCondition();
        $urlCondition->setOperand(WebpageConditionOperand::URL);
        $urlCondition->setArgument('/specialoffers');

        $titleCondition = new WebpageCondition();
        $titleCondition->setOperand(WebpageConditionOperand::PAGE_TITLE);
        $titleCondition->setArgument('Special Offer');

        $param->setConditions([$urlCondition, $titleCondition]);

        $webpage = new Webpage();
        $webpage->setParameter($param);

        // Create a biddable ad group criterion.
        $biddableAdGroupCriterion = new BiddableAdGroupCriterion();
        $biddableAdGroupCriterion->setAdGroupId($adGroup->getId());
        $biddableAdGroupCriterion->setCriterion($webpage);
        $biddableAdGroupCriterion->setUserStatus(UserStatus::PAUSED);

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

        // Optional: set a custom bid.
        $cpcBid = new CpcBid();
        $money = new Money();
        $money->setMicroAmount(10000000);
        $cpcBid->setBid($money);
        $biddingStrategyConfiguration->setBids([$cpcBid]);
        $biddableAdGroupCriterion->setBiddingStrategyConfiguration(
            $biddingStrategyConfiguration
        );

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

        // Create the criterion on the server and print out some information.
        $result = $adGroupCriterionService->mutate([$operation]);
        $adGroupCriterion = $result->getValue()[0];
        printf(
            "Web page criterion with ID %d was added to ad group ID %d.\n",
            $adGroupCriterion->getCriterion()->getId(),
            $adGroupCriterion->getAdGroupId()
        );
    }
private static function addWebPageCriteria ( AdWordsServices $ adWordsServices , AdWordsSession $ session , AdGroup $ adGroup ) { $ adGroupCriterionService = $ adWordsServices -> get ( $ session , AdGroupCriterionService :: class ) ; // Create a webpage criterion for special offers. $ param = new WebpageParameter ( ) ; $ param -> setCriterionName ( 'Special offers' ) ; // Create a webpage criterion for special offers. $ urlCondition = new WebpageCondition ( ) ; $ urlCondition -> setOperand ( WebpageConditionOperand :: URL ) ; $ urlCondition -> setArgument ( '/specialoffers' ) ; $ titleCondition = new WebpageCondition ( ) ; $ titleCondition -> setOperand ( WebpageConditionOperand :: PAGE_TITLE ) ; $ titleCondition -> setArgument ( 'Special Offer' ) ; $ param -> setConditions ( [ $ urlCondition , $ titleCondition ] ) ; $ webpage = new Webpage ( ) ; $ webpage -> setParameter ( $ param ) ; // Create a biddable ad group criterion. $ biddableAdGroupCriterion = new BiddableAdGroupCriterion ( ) ; $ biddableAdGroupCriterion -> setAdGroupId ( $ adGroup -> getId ( ) ) ; $ biddableAdGroupCriterion -> setCriterion ( $ webpage ) ; $ biddableAdGroupCriterion -> setUserStatus ( UserStatus :: PAUSED ) ; // Set a custom bid for this criterion. $ biddingStrategyConfiguration = new BiddingStrategyConfiguration ( ) ; // Optional: set a custom bid. $ cpcBid = new CpcBid ( ) ; $ money = new Money ( ) ; $ money -> setMicroAmount ( 10000000 ) ; $ cpcBid -> setBid ( $ money ) ; $ biddingStrategyConfiguration -> setBids ( [ $ cpcBid ] ) ; $ biddableAdGroupCriterion -> setBiddingStrategyConfiguration ( $ biddingStrategyConfiguration ) ; $ operation = new AdGroupCriterionOperation ( ) ; $ operation -> setOperand ( $ biddableAdGroupCriterion ) ; $ operation -> setOperator ( Operator :: ADD ) ; // Create the criterion on the server and print out some information. $ result = $ adGroupCriterionService -> mutate ( [ $ operation ] ) ; $ adGroupCriterion = $ result -> getValue ( ) [ 0 ] ; printf ( "Web page criterion with ID %d was added to ad group ID %d.\n" , $ adGroupCriterion -> getCriterion ( ) -> getId ( ) , $ adGroupCriterion -> getAdGroupId ( ) ) ; }
Adds a web page criteria to target Dynamic Search Ads.
Adds a web page criteria to target Dynamic Search Ads .