How to set the bidCeiling & bidFloor for a Target ROAS Portfolio strategy via api in python?

31 views
Skip to first unread message

Skyler Christensen

unread,
Jan 11, 2019, 10:37:11 PM1/11/19
to AdWords API and Google Ads API Forum
This is what I've got so far. I just don't know how to set the bidCeiling or how to structure the operations object.
STRATEGY_ID = '1855829761'


def main(client, strategy_id):
# Initialize appropriate service.
campaign_service = client.GetService('BiddingStrategyService', version='v201809')

# Construct operations and update campaign.
operations = [{
'operator': 'SET',
'operand': {
'id': strategy_id,
'name': 'TEST ' + strategy_id,
'biddingScheme': {
'TargetRoasBiddingScheme': {
'bidCeiling': {
'microAmount': '1000000'
}
}
# Optionally set additional bidding scheme parameters.
}
}
}]
campaigns = campaign_service.mutate(operations)

Message has been deleted

Skyler Christensen

unread,
Jan 12, 2019, 4:27:05 PM1/12/19
to AdWords API and Google Ads API Forum
Ok I got it to work. I needed to set the xsitype and also send all the fields for the respective biddingscheme object:
Here is the working code:
#!/usr/bin/env python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""This example updates a campaign by setting its status to PAUSED.

To get campaigns, run get_campaigns.py.

The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this file in your home
directory. For more information, see the "Caching authentication information"
section of our README.

"""
#test api strategy id
#1855829761

from googleads import adwords


STRATEGY_ID = '1855829761'


def main(client, strategy_id):
# Initialize appropriate service.
campaign_service = client.GetService('BiddingStrategyService', version='v201809')

# Construct operations and update campaign.
operations = [{
'operator': 'SET',
'operand': {
'id': strategy_id,
'name': 'TEST ' + strategy_id,
'biddingScheme': {
'xsi_type': 'TargetRoasBiddingScheme',
# Optionally set additional bidding scheme parameters.
'targetRoas': 2.5,

'bidCeiling': {
'microAmount': '3000000'
},
'bidFloor': {
'microAmount': '000000'
}
}
}
}]
campaigns = campaign_service.mutate(operations)

# Display results.
for campaign in campaigns['value']:
print ('Campaign with name "%s" and id "%s" was updated.'
% (campaign['name'], campaign['id']))

if __name__ == '__main__':
# Initialize client object.
adwords_client = adwords.AdWordsClient.LoadFromStorage()

main(adwords_client, STRATEGY_ID)
Reply all
Reply to author
Forward
0 new messages