you should use budget resource.
and you can check Campaign resource class.
It is important to look at the class definition and variable types and 
names while using the google ads api.
this is my past working code snippet. 
$budgetResourceName = self::addCampaignBudget($googleAdsClient, 
$cam_infos['customer_id'], $cam_infos['campaign_budget']);
.....
$campaign = new Campaign([
                'name' => $cam_infos['campaign_name'],
                'advertising_channel_type' => 
$cam_infos['advertising_channel_type'],              
                'status' => $cam_infos['status'],
                'manual_cpc' => new 
ManualCpc(['enhanced_cpc_enabled'=>true]),
                
'bidding_strategy_type'=>$cam_infos['bidding_strategy_type'],
                'tracking_url_template'=>$cam_infos['tracking_template'],
                'campaign_budget' => $budgetResourceName,
                'network_settings' => $networkSettings,
                'start_date' => $cam_infos['start_date'],
                //'end_date' => $cam_infos['end_date']
            ]);
......
private static function addCampaignBudget(GoogleAdsClient $googleAdsClient, 
int $customerId,int $campaign_budget){
        // Creates a campaign budget.
        $budget = new CampaignBudget([
            'name' => 'non shared budget#' . Helper::getPrintableDatetime(),
            'delivery_method' => BudgetDeliveryMethod::STANDARD,
            'amount_micros' => $campaign_budget,
            'explicitly_shared' => false // this is for non-shared budget
        ]);

        // Creates a campaign budget operation.
        $campaignBudgetOperation = new CampaignBudgetOperation();
        $campaignBudgetOperation->setCreate($budget);

        // Issues a mutate request.
        $campaignBudgetServiceClient = 
$googleAdsClient->getCampaignBudgetServiceClient();
        $response = $campaignBudgetServiceClient->mutateCampaignBudgets(
            $customerId,
            [$campaignBudgetOperation]
        );

        /** @var CampaignBudget $addedBudget */
        $addedBudget = $response->getResults()[0];
        //printf("Added budget named '%s'%s", 
$addedBudget->getResourceName(), PHP_EOL);

        return $addedBudget->getResourceName();
    }
On Monday, November 15, 2021 at 3:18:19 PM UTC+8 ol...@disrupt.social wrote:

> Hello
> when i try to run this script,  I can see new budget(shared budget) with 
> new campaign.
> php examples/BasicOperations/AddCampaigns.php --customerId 9641267633
> I only want to create new campaign with individual campaign budget (only 
> budget number) not user addCampaignBudget 
> for example
> $campaign = new Campaign([
>                 'name' => 'campaign1',
>                 ....
>                 'campaign_budget' => 10,
>                 ...
>             ]);
>
> How can i do that?
> Thanks
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/421a9eea-1408-4f3b-b6d3-71b6bc804442n%40googlegroups.com.
  • bu... Oleg Disrupt
    • ... 'Google Ads API Forum Advisor' via AdWords API and Google Ads API Forum
    • ... jindong o
      • ... jindong o
        • ... 'Google Ads API Forum Advisor' via AdWords API and Google Ads API Forum

Reply via email to