I've been trying to get the results from the bid simulator in Google ads via the API but have not been successful. I have tried to follow the steps outlined by google in these guides:

https://support.google.com/google-ads/answer/9634060?hl=en https://developers.google.com/adwords/api/docs/guides/bid-landscapes#python_3

I have very slightly modified the code and it does run:

from googleads import adwords CAMPAIGN_ID = '---------' PAGE_SIZE = 100 def main(client, campaign_id):     # Initialize appropriate service.     data_service = client.GetService('DataService', version='v201809')     # Get all the campaigns for this account.     selector = {         'fields': ['CampaignId', 'CriterionId', 'StartDate', 'EndDate',                    'BidModifier', 'LocalClicks', 'LocalCost', 'LocalImpressions',                    'TotalLocalClicks', 'TotalLocalCost', 'TotalLocalImpressions',                    'RequiredBudget'],         'paging': {             'startIndex': 0,             'numberResults': PAGE_SIZE         },         'predicates': [{             'field': 'CampaignId', 'operator': 'IN', 'values': [campaign_id]         }]     }     # Set initial values.     offset = 0     more_pages = True     while more_pages is True:         num_landscape_points = 0         page = data_service.getCampaignCriterionBidLandscape(selector)         # Display results.         if 'entries' in page:             for bid_modifier_landscape in page['entries']:                 num_landscape_points = 0             print(f'Found campaign-level criterion bid modifier landscapes for '                   f"criterion with ID {bid_modifier_landscape['criterionId']},"                   f" start date {bid_modifier_landscape['startDate']}, end date     {bid_modifier_landscape['endDate']},"                   f" and landscape points:")             for landscape_point in bid_modifier_landscape['landscapePoints']:                 num_landscape_points += 1                 print(f"\tbid modifier: {landscape_point['bidModifier']},"                       f" clicks: {landscape_point['clicks']},"                       f" cost: {landscape_point['cost']['microAmount']},"                       f" impressions: {landscape_point['impressions']},"                       f"total clicks: {landscape_point['totalLocalClicks']},"                       f" total cost: {landscape_point['totalLocalCost']['microAmount']},"                       f" total impressions: {landscape_point['totalLocalImpressions']},"                       f"and required budget: {landscape_point['requiredBudget']['microAmount']}")         else:             print('No bid modifier landscapes found.')         # Need to increment by the total # of landscape points within the page,         # NOT the number of entries (bid landscapes) in the page.         offset += num_landscape_points         selector['paging']['startIndex'] = str(offset)         more_pages = num_landscape_points >= PAGE_SIZE if __name__ == '__main__':     # Initialize client object.     adwords_client = adwords.AdWordsClient.LoadFromStorage()     main(adwords_client, CAMPAIGN_ID) 

This does not however let me get the predicted conversion value, only the clicks and impressions etc which is not really what I am looking for. This seems to line up with the documentation but in the GUI I can get conversion value but seemingly no matter what key I try to query for the API won't let me get the same simulator output as in the GUI.

Any thoughts?

Tag:google-ads-api, python

Add a new comment.