Enhanced Cpc Bidding

121 views
Skip to first unread message

testapi...@gmail.com

unread,
Sep 26, 2016, 3:33:09 AM9/26/16
to AdWords API Forum
Hello, I have problem with ENHANCED_CPC in Adwords API.

My code view like this:

            $campaign
->budget = new Budget();
           $campaign->budget->budgetId = $budget->budgetId;

            $biddingStrategyConfiguration = new BiddingStrategyConfiguration();

            $biddingScheme = new EnhancedCpcBiddingScheme();
           $biddingScheme->type = 'ENHANCED_CPC';
           $biddingStrategyConfiguration->biddingScheme = $biddingScheme;
           $biddingStrategyConfiguration->biddingStrategyType = 'ENHANCED_CPC';
           
           $campaign->biddingStrategyConfiguration = $biddingStrategyConfiguration;

           


But I've got error:
An error has occurred: [BiddingErrors.INVALID_ANONYMOUS_BIDDING_STRATEGY_TYPE @ operations[0].operand.biddingStrategyConfiguration.biddingStrategyType; trigger:'ENHANCED_CPC']

Can you help me ?

Joyce Lava

unread,
Sep 26, 2016, 4:06:02 AM9/26/16
to AdWords API Forum
Hello,

This error occurs when using a portfolio-only type or scheme in the context of a standard strategy. In your case, you are using ENHANCED_CPC type which is valid as a SharedBiddingStrategy. That said, could you please create a SharedBiddingStrategy by using BiddingStrategyService and then use the returned SharedBiddingStrategy.id to set as the BiddingStrategyConfiguration.biddingStrategyId and let me know if the error persists after doing so? The complete details about this is discussed in this page.

Thanks,
Joyce, AdWords API Team

testapi...@gmail.com

unread,
Sep 27, 2016, 3:30:33 AM9/27/16
to AdWords API Forum
I'm sorry but I do not fully understand you, figuring some of these links that sent but nothing helped.

I try use this code:


            $biddingStrategyConfiguration = new SharedBiddingStrategy();
            $biddingScheme = new EnhancedCpcBiddingScheme();
            $biddingStrategyConfiguration->biddingScheme = $biddingScheme;
            $biddingStrategyConfiguration->biddingStrategyType = 'ENHANCED_CPC';
            
            $campaign->biddingStrategyConfiguration = $biddingStrategyConfiguration;

            

but i've got error 
Class 'SharedBiddingStrategy' not found in

Joyce Lava

unread,
Sep 27, 2016, 4:18:23 AM9/27/16
to AdWords API Forum
Hi,

You may refer in this example code (PHP client library example) to see how to create the SharedBiddingStrategy and set its id as the BiddingStrategyConfiguration.biddingStrategyId. The example code uses TargetSpendBiddingScheme (which also valid as a portfolio strategy, highlighted in this line). You may replace the TargetSpendBiddingScheme into EnhancedCpcBiddingScheme from the example code to use ENHANCED_CPC. Hope this helps.

testapi...@gmail.com

unread,
Sep 27, 2016, 1:48:41 PM9/27/16
to AdWords API Forum
Now My code view like this:


            $campaign = new Campaign();
                . . .



  $biddingStrategyService = $user->GetService('BiddingStrategyService', ADWORDS_VERSION);


            $biddingStrategyConfiguration = new SharedBiddingStrategy();
  $biddingStrategyConfiguration->name = "AutoCPC " . uniqid();
            $biddingScheme = new EnhancedCpcBiddingScheme();
            $biddingStrategyConfiguration->biddingScheme = $biddingScheme;
            $biddingStrategyConfiguration->status = "ENABLED";
            $biddingStrategyConfiguration->type = 'ENHANCED_CPC';
            
            $campaign->biddingStrategyConfiguration = $biddingStrategyConfiguration;

            
                 .  .  .




And still not work :/
I've got error:

An error has occurred: [BiddingErrors.INVALID_ANONYMOUS_BIDDING_STRATEGY_TYPE @ operations[0].operand.biddingStrategyConfiguration.biddingStrategyType; trigger:'ENHANCED_CPC']

Joyce Lava

unread,
Sep 27, 2016, 10:06:26 PM9/27/16
to AdWords API Forum
Hi,

Based on your code, it seems you missed to create the SharedBiddingStrategy. From the example code, you need to create a BiddingStrategy first, the function CreateBiddingStrategy shows how to do it (highlighted line of example code here). At the end of this function, you will now have a $newBiddingStrategy->id which is then passed as an argument in the function CreateCampaignWithBiddingStrategy. In this function, you will have the biddingStrategyConfiguration. Could you please try the example code in your test account and let me know if the error persists?
Reply all
Reply to author
Forward
0 new messages