private static void addWebPageCriteria ( AdWordsServicesInterface adWordsServices , AdWordsSession session , AdGroup adGroup ) throws ApiException , RemoteException { // Get the AdGroupCriterionService. AdGroupCriterionServiceInterface adGroupCriterionService = adWordsServices . get ( session , AdGroupCriterionServiceInterface . class ) ; // Create a webpage criterion for special offers. WebpageParameter param = new WebpageParameter ( ) ; param . setCriterionName ( "Special offers" ) ; WebpageCondition urlCondition = new WebpageCondition ( ) ; urlCondition . setOperand ( WebpageConditionOperand . URL ) ; urlCondition . setArgument ( "/specialoffers" ) ; WebpageCondition titleCondition = new WebpageCondition ( ) ; titleCondition . setOperand ( WebpageConditionOperand . PAGE_TITLE ) ; titleCondition . setArgument ( "Special Offer" ) ; param . setConditions ( new WebpageCondition [ ] { urlCondition , titleCondition } ) ; Webpage webpage = new Webpage ( ) ; webpage . setParameter ( param ) ; // Create biddable ad group criterion. BiddableAdGroupCriterion biddableAdGroupCriterion = new BiddableAdGroupCriterion ( ) ; biddableAdGroupCriterion . setAdGroupId ( adGroup . getId ( ) ) ; biddableAdGroupCriterion . setCriterion ( webpage ) ; biddableAdGroupCriterion . setUserStatus ( UserStatus . PAUSED ) ; // Optional: set a custom bid. BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration ( ) ; CpcBid bid = new CpcBid ( ) ; bid . setBid ( new Money ( ) ) ; bid . getBid ( ) . setMicroAmount ( 10000000L ) ; biddingStrategyConfiguration . setBids ( new Bids [ ] { bid } ) ; biddableAdGroupCriterion . setBiddingStrategyConfiguration ( biddingStrategyConfiguration ) ; // Create operations. AdGroupCriterionOperation operation = new AdGroupCriterionOperation ( ) ; operation . setOperator ( Operator . ADD ) ; operation . setOperand ( biddableAdGroupCriterion ) ; // Create the criterion. AdGroupCriterion newAdGroupCriterion = adGroupCriterionService . mutate ( new AdGroupCriterionOperation [ ] { operation } ) . getValue ( 0 ) ; System . out . printf ( "Webpage criterion with ID %d was added to ad group ID %d.%n" , newAdGroupCriterion . getCriterion ( ) . getId ( ) , newAdGroupCriterion . getAdGroupId ( ) ) ; }
Adds a web page criteria to target Dynamic Search Ads .