examples/AdWords/v201809/AdvancedOperations/UsePortfolioBiddingStrategy.php
private static function createBiddingStrategy(
        AdWordsServices $adWordsServices,
        AdWordsSession $session
    ) {
        $biddingStrategyService = $adWordsServices->get($session, BiddingStrategyService::class);

        // Create a portfolio bidding strategy.
        $biddingStrategy = new SharedBiddingStrategy();
        $biddingStrategy->setName("Maximize Clicks " . uniqid());

        $biddingScheme = new TargetSpendBiddingScheme();
        // Optionally set additional bidding scheme parameters.
        $bidCeiling = new Money();
        $bidCeiling->setMicroAmount(2000000);
        $biddingScheme->setBidCeiling($bidCeiling);
        $spendTarget = new Money();
        $spendTarget->setMicroAmount(20000000);
        $biddingScheme->setSpendTarget($spendTarget);

        $biddingStrategy->setBiddingScheme($biddingScheme);

        // Create the bidding strategy operation.
        $operation = new BiddingStrategyOperation();
        $operation->setOperator(Operator::ADD);
        $operation->setOperand($biddingStrategy);

        $result = $biddingStrategyService->mutate([$operation]);
        $newBiddingStrategy = $result->getValue()[0];
        printf(
            "Portfolio bidding strategy with name '%s' and ID %d of type %s was created.\n",
            $newBiddingStrategy->getName(),
            $newBiddingStrategy->getId(),
            $newBiddingStrategy->getType()
        );

        return $newBiddingStrategy;
    }
private static function createBiddingStrategy(
        AdWordsServices $adWordsServices,
        AdWordsSession $session
    ) {
        $biddingStrategyService = $adWordsServices->get($session, BiddingStrategyService::class);

        // Create a portfolio bidding strategy.
        $biddingStrategy = new SharedBiddingStrategy();
        $biddingStrategy->setName("Maximize Clicks " . uniqid());

        $biddingScheme = new TargetSpendBiddingScheme();
        // Optionally set additional bidding scheme parameters.
        $bidCeiling = new Money();
        $bidCeiling->setMicroAmount(2000000);
        $biddingScheme->setBidCeiling($bidCeiling);
        $spendTarget = new Money();
        $spendTarget->setMicroAmount(20000000);
        $biddingScheme->setSpendTarget($spendTarget);

        $biddingStrategy->setBiddingScheme($biddingScheme);

        // Create the bidding strategy operation.
        $operation = new BiddingStrategyOperation();
        $operation->setOperator(Operator::ADD);
        $operation->setOperand($biddingStrategy);

        $result = $biddingStrategyService->mutate([$operation]);
        $newBiddingStrategy = $result->getValue()[0];
        printf(
            "Portfolio bidding strategy with name '%s' and ID %d of type %s was created.\n",
            $newBiddingStrategy->getName(),
            $newBiddingStrategy->getId(),
            $newBiddingStrategy->getType()
        );

        return $newBiddingStrategy;
    }
private static function createBiddingStrategy ( AdWordsServices $ adWordsServices , AdWordsSession $ session ) { $ biddingStrategyService = $ adWordsServices -> get ( $ session , BiddingStrategyService :: class ) ; // Create a portfolio bidding strategy. $ biddingStrategy = new SharedBiddingStrategy ( ) ; $ biddingStrategy -> setName ( "Maximize Clicks " . uniqid ( ) ) ; $ biddingScheme = new TargetSpendBiddingScheme ( ) ; // Optionally set additional bidding scheme parameters. $ bidCeiling = new Money ( ) ; $ bidCeiling -> setMicroAmount ( 2000000 ) ; $ biddingScheme -> setBidCeiling ( $ bidCeiling ) ; $ spendTarget = new Money ( ) ; $ spendTarget -> setMicroAmount ( 20000000 ) ; $ biddingScheme -> setSpendTarget ( $ spendTarget ) ; $ biddingStrategy -> setBiddingScheme ( $ biddingScheme ) ; // Create the bidding strategy operation. $ operation = new BiddingStrategyOperation ( ) ; $ operation -> setOperator ( Operator :: ADD ) ; $ operation -> setOperand ( $ biddingStrategy ) ; $ result = $ biddingStrategyService -> mutate ( [ $ operation ] ) ; $ newBiddingStrategy = $ result -> getValue ( ) [ 0 ] ; printf ( "Portfolio bidding strategy with name '%s' and ID %d of type %s was created.\n" , $ newBiddingStrategy -> getName ( ) , $ newBiddingStrategy -> getId ( ) , $ newBiddingStrategy -> getType ( ) ) ; return $ newBiddingStrategy ; }
Creates a shared bidding strategy.
Creates a shared bidding strategy .