PHP Update Budget

67 views
Skip to first unread message

Mike Behr

unread,
Apr 11, 2022, 2:59:38 PM4/11/22
to Google Ads API and AdWords API Forum
I'm trying to update campaign budget

I can update the status & the name.

How can I update the budget:

        $campaign = new Campaign([
            'resource_name' => ResourceNames::forCampaign($customerId, $campaignId),
            'status' => CampaignStatus::PAUSED,
            'name' => 'Test ' . date( 'Y-m-d h:i' )
        ]);
        // Constructs an operation that will update the campaign with the specified resource name,
        // using the FieldMasks utility to derive the update mask. This mask tells the Google Ads
        // API which attributes of the campaign you want to change.
        $campaignOperation = new CampaignOperation();
        $campaignOperation->setUpdate($campaign);
        $campaignOperation->setUpdateMask(FieldMasks::allSetFieldsOf($campaign));

        // Issues a mutate request to update the campaign.
        $campaignServiceClient = $googleAdsClient->getCampaignServiceClient();
        $response = $campaignServiceClient->mutateCampaigns(
            $customerId,
            [$campaignOperation]
        );

Google Ads API Forum Advisor

unread,
Apr 12, 2022, 9:16:36 AM4/12/22
to mjb...@gmail.com, adwor...@googlegroups.com

Hi Mike,

Thanks for reaching out to the Google Ads API Forum.

To update the campaign budget, you may use the code sample for updating a campaign is given here. Can you please specify what part of the process that you're having trouble with? If you’re encountering any issues, could you provide us with the complete request and response logs with the request-id, so our team can better check?

You may enable logging for PHP client library by following this guide, and send the requested information via the Reply privately to author option. If this option is not available, you may send the details directly to our googleadsa...@google.com alias by referring to this thread.

Regards,

Google Logo
Yasar
Google Ads API Team
 


ref:_00D1U1174p._5004Q2ZM0zq:ref
Reply all
Reply to author
Forward
0 new messages