Reputation: 78324
I am using the adwords python api. I need to get the bid amount and type. E.g. bid=4 ad type = cpc.
I am given the adgroup id.
Below is an example on to create and ad group. Once created...how do I retrieve the settings? How do I get e.g. the bid I set?
ad_group_service = client.GetService('AdGroupService', version='v201402')
operations = [{
'operator': 'ADD',
'operand': {
'campaignId': campaign_id,
'name': 'Earth to Mars Cruises #%s' % uuid.uuid4(),
'status': 'ENABLED',
'biddingStrategyConfiguration': {
'bids': [
{
'xsi_type': 'CpcBid',
'bid': {
'microAmount': '1000000'
},
}
]
}
}
}]
ad_groups = ad_group_service.mutate(operations)
Upvotes: 2
Views: 1567
Reputation: 6282
Have a look at the corresponding example on googlads
's github page.
Basically you'll user the AdGroupService
's get
method with a selector containing the right fields and predicates to retrieve an AdGroupPage
containing the AdGroup
objects you're interested in:
selector = {
'fields': ['Id', 'Name', 'CpcBid'],
'predicates': [
{
'field': 'Id',
'operator': 'EQUALS',
'values': [given_adgroup_id]
}
]
}
page = adgroup_service.get(selector)
adgroup = page.entries[0]
print('Adgroup "%s" (%s) has CPC %s' % (adgroup.name, adgroup.id,
adgroup.biddingStrategyConfiguration.bids.bid))
The available fields' names and the attributes they populate in the returned objects can be found at the selector reference page.
The AdGroupService
's reference page might also be of interest.
Upvotes: 4