Google Ads API keyword performance report

1,740 views
Skip to first unread message

jubap...@gmail.com

unread,
Mar 8, 2022, 2:47:44 PM3/8/22
to Google Ads API and AdWords API Forum
I am trying to download the keyword performance report by the new API.
I found that there are no keyword-level resources with metrics. Is there a way for keyword performance report by using SearchGoogleAdsStreamRequest ?

Also, have one more question about how to adjust the keyword enabled and pause button by API call.

Thanks

jubap...@gmail.com

unread,
Mar 8, 2022, 3:37:22 PM3/8/22
to Google Ads API and AdWords API Forum
I would like to contain these fields in my performance report, however I couldn't find the right method for keyword metrices. 
report_type = 'KEYWORDS_PERFORMANCE_REPORT'
    fields = ['CampaignName','CampaignId','CampaignStatus', 
              'AdGroupName', 'AdGroupId', 'AdGroupStatus',
              'Id', 'Status',
              'Impressions', 'Clicks','Cost',
              'Conversions','ConversionValue',
              'TopImpressionPercentage','AbsoluteTopImpressionPercentage']
  

Google Ads API Forum Advisor

unread,
Mar 9, 2022, 1:41:05 AM3/9/22
to jubap...@gmail.com, adwor...@googlegroups.com

Hi,

Thank you for raising this concern to Google Ads API team.

I see that your concern is mainly about keyword fields. With this, you can use this Resource Mapping on mapping fields on both AdWords API and Google Ads API for keywords fields.

As for updating the status of the keywords, you can use the AdGroupCriterionOperation update of the AdGroupCriterionService.MutateAdGroupCriteria to change the status field of the keyword criterion. Please note that the update operation requires resource name so that the API will know which criterion needs to update.

I hope this helps. Let us know if you have any questions.

Regards,

Google Logo
Carmela
Google Ads API Team
 


ref:_00D1U1174p._5004Q2XmeLo:ref

jubap...@gmail.com

unread,
Mar 9, 2022, 4:28:02 PM3/9/22
to Google Ads API and AdWords API Forum
Hi, Carmela

Thanks for the tips! Resource Mapping is really helpful!
Now I know that 'ID' will be corresponding to 'ad_group_criterion.criterion_id'.
However, I want to get ad_group_criterion.criterion_id and a couple of metrics in this report, and select from ad_group_criterion can not select or filter on metrics. Any suggestions at this point?

For the updating status of the keywords. the resource name format is customers/{customer_id}/adGroupCriteria/{ad_group_id}~{criterion_id}
for this format, the criterion_id is ad_group_criterion.criterion_id, correct? 
I got confused about the name criterion_id. Is it an id that will be different if I use a different service?
like If I am using the adGroupBidModifier service, the criterion_id will be the platform like desktop, mobile.
This means criterion_id needs to match with service to achieve different services? 

Thank you


Google Ads API Forum Advisor

unread,
Mar 10, 2022, 10:40:35 AM3/10/22
to jubap...@gmail.com, adwor...@googlegroups.com
Hello,

Yes, the criterion ID for a specific ad group criterion is given by ad_group_criterion.criterion_id. The criterion ID is constant so it will be the same as ad_group_bid_modifier.criterion_id, for example.

Regards,
Matt
Google Ads API Team

Google Logo
Matt
Google Ads API Team
 

 

ref:_00D1U1174p._5004Q2XmeLo:ref

jubap...@gmail.com

unread,
Mar 10, 2022, 11:41:16 AM3/10/22
to Google Ads API and AdWords API Forum
Hi,
Thanks for clearify my queston about criteria_id

I want to get ad_group_criterion.criterion_id and a couple of metrics in the keyword performance report
however, select from ad_group_criterion can not select or filter on metrics. Any suggestions at this point?

Thank you

Google Ads API Forum Advisor

unread,
Mar 10, 2022, 9:42:54 PM3/10/22
to jubap...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for your reply and additional details.

For keywords metrics, you can use the keyword_view and include attributes from the ad_group_criterion resource in your query, since this is an Attributed resource of the said keyword report. You can also use the query builder and query validator tools, to help you construct your queries. Let me know if this helps.

Best regards,

Google Logo
Peter Laurence
Google Ads API Team
 


ref:_00D1U1174p._5004Q2XmeLo:ref
Message has been deleted
Message has been deleted

Google Ads API Forum Advisor

unread,
Mar 22, 2022, 11:00:09 PM3/22/22
to jubap...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for your reply.

I noticed as well that you deleted your recent responses. However, and just in case, allow me to provide my responses to those items you sent over :

I am wondering can I changed maxCPC on keyword layer?

You can perform a request using the AdGroupCriterionService.MutateAdGroupCriteriaRequest and also while using the update operation, to pass an updated value for the cpc_bid_micros field.

And for changing keyword status, I know that it might be used for samples like client.enums.AdGroupCriterionStatusEnum.ENABLED. I want to change keyword status by an input pd data frame filed with the column of ad_gorup_id, criterion_id, criterion_status. Therefore, I am wondering what is the input format that I need to contact for client.enums.AdGroupCriterionStatusEnum.ENABLED ?

You can refer to the values specified here (see AdGroupCriterionStatus), for the status you can use. If this does not suffice, could you elaborate on this item?

I am not quite understanding the field mask and enums, the operations I am using are below. Thanks

For more information on field masks, and since it appears that you are using the Python client library, you may refer to this guide. As for the enums or values to use for the status, you may refer to my response to the above item. 

jubap...@gmail.com

unread,
Mar 23, 2022, 5:39:43 PM3/23/22
to Google Ads API and AdWords API Forum

Thanks for the update. I am not quite sure why those replies had been deleted.
 Let me elaborate my question with an example.

Q: for changing ad_group_criterion_status, is this operation correct?
Do I miss any parameter for updated ad_group_criterion.status?
I found that in sample code, if I want to update a campaign. I need to set campaign.status to PAUSE. 

Q. I found that in Enum doc. it can use .name to call the value. Therefore, if I want to change the status by input file:
I can use code like : ad_group_criterion.status. name = 'ENABLED' ?
My question is like for the resource_path and field mask, it has a function to generate it to list. 
Is client.enums.AdGroupCriterionStatusEnum has some kind of function?

Thank you

Google Ads API Forum Advisor

unread,
Mar 24, 2022, 9:11:04 PM3/24/22
to jubap...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for the reply. I am also a member of the Google Ads API team and let me provide support to your concern.

Please see my answer below for each question:

"Q: for changing ad_group_criterion_status, is this operation correct?
Do I miss any parameter for updated ad_group_criterion.status?
I found that in sample code, if I want to update a campaign. I need to set campaign.status to PAUSE.
"
-The process of setting status of the campaign is identical with the ad group criterion. The suggestion by my colleague seems to be applicable here and you can perform a request using the AdGroupCriterionService.MutateAdGroupCriteriaRequest and also while using the update operation, to pass an updated value for the status field.


Q. I found that in Enum doc. it can use .name to call the value. Therefore, if I want to change the status by input file:
I can use code like : ad_group_criterion.status. name = 'ENABLED' ?
My question is like for the resource_path and field mask, it has a function to generate it to list. 
Is client.enums.AdGroupCriterionStatusEnum has some kind of function?

-It appears that this question is code specific. With this, would you be able to specify the client library that you are using here so that I can route you to the author of the client library accordingly? The author of the client library is more equipped to provide support to the code specific and client library related concern.

Regards,
Google Logo
Ernie John
Google Ads API Team
 


ref:_00D1U1174p._5004Q2XmeLo:ref

jubap...@gmail.com

unread,
Mar 28, 2022, 5:40:18 PM3/28/22
to Google Ads API and AdWords API Forum
Hi, so I am using pything libary and the code I use is below. 
The question I ask that highlights this line : updated_agc.status.name = row['Keyword Status']

Sample df_input will be pandas data frame with column: Ad Group ID, Keyword ID, Keyword Status

def get_keyword_status_operations(client, customer_id, df_input):
    operations = []
    for index, row in df_input.iterrows():
        # resource name customers/{customer_id}/adGroupCriteria/{ad_group_id}~{criterion_id}
        agc_operation = client.get_type("AdGroupCriterionOperation")
        updated_agc = agc_operation.update
        updated_agc.resource_name = agc_service.ad_group_path(
        customer_id, row['Ad Group ID'], row['Keyword ID'])
       
        updated_agc.status.name = row['Keyword Status']
        client.copy_from(
            agc_operation.update_mask,
            protobuf_helpers.field_mask(None, updated_agc._pb))
       
        operations.append(ad_group_operation)
    return operations 

# running operations
agc_service = client.get_service("AdGroupCriterionService")
    while len(operations)>0:
    cur_operations = operations[0:500]
    print(cur_operations)
    agc_response = agc_service.mutate_ad_group_criteria(
        customer_id=customer_id,
        operations=[cur_operations],)
    operations = operations[500:]


Thank you!

Google Ads API Forum Advisor

unread,
Mar 29, 2022, 1:40:44 PM3/29/22
to jubap...@gmail.com, adwor...@googlegroups.com
Hello,

As Ernie suggested, you should seek further assistance with the Python client library owners, as they will be able to help your code specific inquiry.

Regards,
Matt
Google Ads API Team

Google Logo
Matt
Google Ads API Team
 


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