Issue setting bid strategy through API differs from UI

84 views
Skip to first unread message

Vinutha Nayak

unread,
Jun 27, 2019, 12:27:57 AM6/27/19
to AdWords API and Google Ads API Forum
Hi,

I have used the following setting in my code :

# Set the bidding strategy and budget.
campaign.manual_cpc.enhanced_cpc_enabled.value = False
campaign.campaign_budget.value = campaign_budget_response.results[0].resource_name
campaign.bidding_strategy_type = client.get_type('BiddingStrategyTypeEnum', version='v1').MANUAL_CPM

# Set the campaign network options.
campaign.network_settings.target_google_search.value = False
campaign.network_settings.target_search_network.value = False
campaign.network_settings.target_content_network.value = True
campaign.network_settings.target_partner_search_network.value = False


When I run this, the program runs fine, but when I open the UI , it shows me the "Bidding" set  to "Manual CPC".  

Could you please check on the same and revert ? Is it some known issue with the API ?


Thanks and Regards,
Vinutha Nayak

Google Ads API Forum Advisor Prod

unread,
Jun 27, 2019, 6:22:21 AM6/27/19
to adwor...@googlegroups.com

Hi Vinutha,

Thanks for posting your concern.

Could you clarify first whether you are using the AdWords API or Google Ads API? If you are using AdWords API, would you mind providing the complete SOAP request and response logs together with the customer ID via Reply privately to author option? You may refer to the readMe section of the respective client library for instructions on how to enable SOAP logging.

Also, could provide the screenshot of the created campaign in the UI including the campaign name and the campaign type.

Regards,
Ejay
Google Ads API Team



ref:_00D1U1174p._5001UCZl6w:ref

Vinutha Nayak

unread,
Jun 27, 2019, 8:50:54 AM6/27/19
to AdWords API and Google Ads API Forum
Hi Ejay,

I am using Google Ads API. Above is python code which I am running from terminal. I am not sure about SOAP request you are asking. 

I will try to check and see if I can provide that, meanwhile I think you could please  clarify the syntax that I am using is right ? If theak syntax is right, do you think it is some other internal issue for which you 
need the debug logs. Kindly clarify.

Thanks and Regards,
Vinutha Nayak

Google Ads API Forum Advisor Prod

unread,
Jun 28, 2019, 3:30:29 AM6/28/19
to adwor...@googlegroups.com
Hi Vinutha,

I am a colleague of Ejay. Your concern was passed on to me as this is a Google Ads API related concern.

It would be hard to troubleshoot the issue given a fragment of code only. I would need the complete JSON request and response logs that were generated when you made the API service call. Kindly refer to this guide on how to enable logging on the Python client library. After enabling, kindly make the service call again and provide the generated JSON logs so I could further investigate. You may use the reply privately to author option.

Regards,
Dannison

Vinutha Nayak

unread,
Jul 2, 2019, 12:29:07 AM7/2/19
to AdWords API and Google Ads API Forum
Hi Dannison, 

I have sent you the logs requested few days back.  Could you please let me know if you were able to progress ?

At the least I just need a response to convince myself that it is being looked upon please ? 

Thanks and Regards,
Vinutha Nayak

Google Ads API Forum Advisor Prod

unread,
Jul 2, 2019, 5:18:32 AM7/2/19
to nayakv...@gmail.com, adwor...@googlegroups.com
Hello,

It appears my response may have gotten lost. I've reproduced it below:

From the code you shared:
campaign.manual_cpc.enhanced_cpc_enabled.value = False
campaign.campaign_budget.value = campaign_budget_response.results[0].resource_name
campaign.bidding_strategy_type = client.get_type('BiddingStrategyTypeEnum', version='v1').MANUAL_CPM
You are using "campaign.manual_cpc", which is why the campaign is being created as MANUAL_CPC. You should instead use campaign.manual_cpm. Looking through the campaign.proto file, you can see that these two fields are part of the same "oneof" definition, which means that these fields are mutually exclusive.

Additionally, I think the bidding strategy type is determined by the campaign bidding strategy, so whatever you sent to the server is ignored and rather the one that is specified by the campaign_bidding_strategy oneof is used instead. Please try fixing the first line in the snippet above to use manual_cpm as intended and let me know how that goes.

Regards,
Mike, Google Ads API Team

ref:_00D1U1174p._5001UCZl6w:ref

Vinutha Nayak

unread,
Jul 3, 2019, 1:22:35 AM7/3/19
to AdWords API and Google Ads API Forum
Hi Mike,

Thanks for responding back . 

What should be the value of "campaign.manual_cpm" be set to ?  I tried several combinations but none seems to work . 

If I set it to :
campaign.manual_cpm = True
or
campaign.manual_cpm = "ManualCpm"
I get following error 
AttributeError: Assignment not allowed to field "manual_cpm" in protocol message object.

I have referred to this documentation "https://developers.google.com/google-ads/api/reference/rpc/google.ads.googleads.v2.resources#campaign"  wherever I have done the setting for different parameters.

From the documentation also it's not clear what should be used. Could you guide me there  please ? 


Thanks and Regards,
Vinutha Nayak


Google Ads API Forum Advisor Prod

unread,
Jul 3, 2019, 10:08:09 AM7/3/19
to nayakv...@gmail.com, adwor...@googlegroups.com
Hello,

The manual_cpm type doesn't have any parameters. You simply have to instantiate one like you would any other resource and then attach it to the campaign. I'm not an expert at the Python library, but from looking at other examples it looks like it would be something like this:
campaign.manual_cpm = client.get_type('ManualCpm', version='v1')
Let me know if this works for you.

Vinutha Nayak

unread,
Jul 4, 2019, 2:27:09 AM7/4/19
to AdWords API and Google Ads API Forum
Hi Mike,

I tried the syntax as you suggested . It still gives  same error :


googleadsquery.PNG






 File "test.py", line 68, in main
    campaign.manual_cpm = client.get_type('ManualCpm', version='v1')
AttributeError: Assignment not allowed to field "manual_cpm" in protocol message object.

Thanks and Regards,
Vinutha Nayak



Vinutha Nayak

unread,
Jul 8, 2019, 10:19:57 AM7/8/19
to AdWords API and Google Ads API Forum
Hi Mike,

Can you please get back on this one please ?

Thanks and Regards,
Vinutha Nayak

Google Ads API Forum Advisor Prod

unread,
Jul 10, 2019, 8:00:58 AM7/10/19
to nayakv...@gmail.com, adwor...@googlegroups.com
Hello,

Sorry for the delay. I'm going to route this issue to someone who has more familiarity with the python library, who should hopefully be able to assist.

Google Ads API Forum Advisor Prod

unread,
Jul 10, 2019, 9:13:10 AM7/10/19
to nayakv...@gmail.com, adwor...@googlegroups.com
Hi Vinuntha,

You'll want to use the CopyFrom method that is part of all message classes in Python, so for example:

manual_cpm = client.get_type('ManualCpm', version='v1')
campaign.manual_cpm.CopyFrom(manual_cpm)

Hope that helps! let me know if you have any additional questions.

Best,
Ben Karl, Google Ads API Team


ref:_00D1U1174p._5001UCZl6w:ref

Vinutha Nayak

unread,
Jul 12, 2019, 12:31:30 PM7/12/19
to AdWords API and Google Ads API Forum
Hi Ben,

Thank you. 

I used it as follows : campaign.manual_cpm.CopyFrom(client.get_type('ManualCpm', version='v1')) like you  suggested and it seems to work. 

Thanks again !
Vinutha Nayak

Google Ads API Forum Advisor Prod

unread,
Jul 15, 2019, 6:23:45 PM7/15/19
to nayakv...@gmail.com, adwor...@googlegroups.com
Hi Vinutha,

That's great! Thanks for letting me know. For future reference, since this is a confusing part of the library, I added a bit of documentation to our developer site to address this question. In case you run into this again, feel free to reference this page .

Best,
Ben, Google Ads API Team

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