examples/AdWords/v201809/AdvancedOperations/UsePortfolioBiddingStrategy.php
private static function createCampaignWithBiddingStrategy(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        $biddingStrategyId,
        $sharedBudgetId
    ) {
        $campaignService = $adWordsServices->get($session, CampaignService::class);

        // Create campaign with some properties set.
        $campaign = new Campaign();
        $campaign->setName('Interplanetary Cruise #' . uniqid());

        // Set the budget.
        $campaign->setBudget(new Budget());
        $campaign->getBudget()->setBudgetId($sharedBudgetId);
        $campaign->setAdvertisingChannelType(AdvertisingChannelType::SEARCH);

        // Set the campaign's bidding strategy.
        $biddingStrategyConfiguration = new BiddingStrategyConfiguration();
        $biddingStrategyConfiguration->setBiddingStrategyId($biddingStrategyId);

        $campaign->setBiddingStrategyConfiguration($biddingStrategyConfiguration);

        // Set network targeting (recommended).
        $networkSetting = new NetworkSetting();
        $networkSetting->setTargetGoogleSearch(true);
        $networkSetting->setTargetSearchNetwork(true);
        $networkSetting->setTargetContentNetwork(true);
        $campaign->setNetworkSetting($networkSetting);

        // Recommendation: Set the campaign to PAUSED when creating it to stop
        // the ads from immediately serving. Set to ENABLED once you've added
        // targeting and the ads are ready to serve.
        $campaign->setStatus(CampaignStatus::PAUSED);

        // Create a campaign operation.
        $operation = new CampaignOperation();
        $operation->setOperand($campaign);
        $operation->setOperator(Operator::ADD);

        // Create the campaign on the server and print out some information for the
        // campaign.
        $result = $campaignService->mutate([$operation]);
        $newCampaign = $result->getValue()[0];
        printf(
            "Campaign with name '%s', ID %d and bidding scheme ID %d was created.\n",
            $newCampaign->getName(),
            $newCampaign->getId(),
            $newCampaign->getBiddingStrategyConfiguration()->getBiddingStrategyId()
        );
    }
private static function createCampaignWithBiddingStrategy(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        $biddingStrategyId,
        $sharedBudgetId
    ) {
        $campaignService = $adWordsServices->get($session, CampaignService::class);

        // Create campaign with some properties set.
        $campaign = new Campaign();
        $campaign->setName('Interplanetary Cruise #' . uniqid());

        // Set the budget.
        $campaign->setBudget(new Budget());
        $campaign->getBudget()->setBudgetId($sharedBudgetId);
        $campaign->setAdvertisingChannelType(AdvertisingChannelType::SEARCH);

        // Set the campaign's bidding strategy.
        $biddingStrategyConfiguration = new BiddingStrategyConfiguration();
        $biddingStrategyConfiguration->setBiddingStrategyId($biddingStrategyId);

        $campaign->setBiddingStrategyConfiguration($biddingStrategyConfiguration);

        // Set network targeting (recommended).
        $networkSetting = new NetworkSetting();
        $networkSetting->setTargetGoogleSearch(true);
        $networkSetting->setTargetSearchNetwork(true);
        $networkSetting->setTargetContentNetwork(true);
        $campaign->setNetworkSetting($networkSetting);

        // Recommendation: Set the campaign to PAUSED when creating it to stop
        // the ads from immediately serving. Set to ENABLED once you've added
        // targeting and the ads are ready to serve.
        $campaign->setStatus(CampaignStatus::PAUSED);

        // Create a campaign operation.
        $operation = new CampaignOperation();
        $operation->setOperand($campaign);
        $operation->setOperator(Operator::ADD);

        // Create the campaign on the server and print out some information for the
        // campaign.
        $result = $campaignService->mutate([$operation]);
        $newCampaign = $result->getValue()[0];
        printf(
            "Campaign with name '%s', ID %d and bidding scheme ID %d was created.\n",
            $newCampaign->getName(),
            $newCampaign->getId(),
            $newCampaign->getBiddingStrategyConfiguration()->getBiddingStrategyId()
        );
    }
private static function createCampaignWithBiddingStrategy ( AdWordsServices $ adWordsServices , AdWordsSession $ session , $ biddingStrategyId , $ sharedBudgetId ) { $ campaignService = $ adWordsServices -> get ( $ session , CampaignService :: class ) ; // Create campaign with some properties set. $ campaign = new Campaign ( ) ; $ campaign -> setName ( 'Interplanetary Cruise #' . uniqid ( ) ) ; // Set the budget. $ campaign -> setBudget ( new Budget ( ) ) ; $ campaign -> getBudget ( ) -> setBudgetId ( $ sharedBudgetId ) ; $ campaign -> setAdvertisingChannelType ( AdvertisingChannelType :: SEARCH ) ; // Set the campaign's bidding strategy. $ biddingStrategyConfiguration = new BiddingStrategyConfiguration ( ) ; $ biddingStrategyConfiguration -> setBiddingStrategyId ( $ biddingStrategyId ) ; $ campaign -> setBiddingStrategyConfiguration ( $ biddingStrategyConfiguration ) ; // Set network targeting (recommended). $ networkSetting = new NetworkSetting ( ) ; $ networkSetting -> setTargetGoogleSearch ( true ) ; $ networkSetting -> setTargetSearchNetwork ( true ) ; $ networkSetting -> setTargetContentNetwork ( true ) ; $ campaign -> setNetworkSetting ( $ networkSetting ) ; // Recommendation: Set the campaign to PAUSED when creating it to stop // the ads from immediately serving. Set to ENABLED once you've added // targeting and the ads are ready to serve. $ campaign -> setStatus ( CampaignStatus :: PAUSED ) ; // Create a campaign operation. $ operation = new CampaignOperation ( ) ; $ operation -> setOperand ( $ campaign ) ; $ operation -> setOperator ( Operator :: ADD ) ; // Create the campaign on the server and print out some information for the // campaign. $ result = $ campaignService -> mutate ( [ $ operation ] ) ; $ newCampaign = $ result -> getValue ( ) [ 0 ] ; printf ( "Campaign with name '%s', ID %d and bidding scheme ID %d was created.\n" , $ newCampaign -> getName ( ) , $ newCampaign -> getId ( ) , $ newCampaign -> getBiddingStrategyConfiguration ( ) -> getBiddingStrategyId ( ) ) ; }
Create a campaign with a portfolio bidding strategy.
Create a campaign with a portfolio bidding strategy .