I was trying to change the keyword status via Google Ads API the following code shows how to update the keyword bid... however, I was looking for a way to set the keyword status as paused, I haven't been able to find any info within the documentation to paused the keyword

from googleads import adwords AD_GROUP_ID = 'INSERT_AD_GROUP_ID_HERE' CRITERION_ID = 'INSERT_KEYWORD_CRITERION_ID_HERE' def main(client, ad_group_id, criterion_id):            # Initialize appropriate service.            ad_group_criterion_service = client.GetService(                                        'AdGroupCriterionService', version='v201809')            # Construct operations and update bids.            operations = [{                  'operator': 'SET',                  'operand': {                  'xsi_type': 'BiddableAdGroupCriterion',                  'adGroupId': ad_group_id,                  'criterion': {                  'id': criterion_id,                   },                 'biddingStrategyConfiguration': {                 'bids': [                      {                     'xsi_type': 'CpcBid',                     'bid': {                       'microAmount': '1000000'                       }                     }                   ]                 }               }             }]         ad_group_criteria = ad_group_criterion_service.mutate(operations)  # Display results.  if 'value' in ad_group_criteria:     for criterion in ad_group_criteria['value']:       if criterion['criterion']['Criterion.Type'] == 'Keyword':           print('Ad group criterion with ad group id "%s" and criterion id '                 '"%s" currently has bids:'                 % (criterion['adGroupId'], criterion['criterion']['id']))       for bid in criterion['biddingStrategyConfiguration']['bids']:          print('\tType: "%s", value: %s' % (bid['Bids.Type'],)               bid['bid']['microAmount']) else:     print('No ad group criteria were updated.') if __name__ == '__main__':      # Initialize client object.      adwords_client = adwords.AdWordsClient.LoadFromStorage()      main(adwords_client, AD_GROUP_ID, CRITERION_ID) 

Thanks in advance for the help...

Tag:google-ads-api, python

Only one comment.

  1. Isaac_R

    After more research I found the following guide.

    https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupCriterionService.BiddableAdGroupCriterion#userstatus

    In order to modified the keyword status the construct operations needs to be like this.

    operations = [{ 'operator': 'SET', 'operand': { 'xsi_type': 'BiddableAdGroupCriterion', 'adGroupId': ad_group_id, 'criterion': { 'id': criterion_id, }, 'userStatus': 'ENABLED' } }]

Add a new comment.