Adwords api, check daily budget and change max cpc bid

109 views
Skip to first unread message

nicolò Cozzani

unread,
Sep 19, 2018, 2:43:35 PM9/19/18
to AdWords API and Google Ads API Forum
Hello,
I need some suggestions ,what i'm trying to do, if possibile is :
- check if a given campaing  yesterday had reached the daily budget
-  if so change the max cpc bid for keywords of that campaign.

For change the max cpc bid i was thinking to use this example :


        // Update the CPC bid if specified.
        if (!is_null($cpcBidMicroAmount)) {
            $bid = new CpcBid();
            $money = new Money();
            $money->setMicroAmount($cpcBidMicroAmount);
            $bid->setBid($money);
            $biddingStrategyConfiguration = new BiddingStrategyConfiguration();
            $biddingStrategyConfiguration->setBids([$bid]);
            $adGroup->setBiddingStrategyConfiguration($biddingStrategyConfiguration);
        }


Is this the best / correct way to do?

While im not sure what to do to achieve the first question (check if a given campaing  yesterday had reached the daily budget) if i have to use campaign perfmormance report or Budget Performance Report (or something else?). a pratical example would be wonderful.
Thanks

Bharani Cherukuri (AdWords API Team)

unread,
Sep 19, 2018, 6:04:17 PM9/19/18
to AdWords API and Google Ads API Forum
Hello, 

The daily budget for a campaign is of the type Attribute, which will return the current value in the account ignoring the date range. For this, you will need to generate a Campaign Performance Report by querying for the Amount field and pulling the report on a daily basis and store this in your local database to check if it is exceeding the daily set limits. To set MaxCpc bids for a specific keyword, you can check the PHP code sample as a reference. 

Let me know if you have any other questions. 

Regards,
Bharani, AdWords API Team
Reply all
Reply to author
Forward
0 new messages