Not able to pull historical_quality_score for Customer, AdGroup and Campaign

91 views
Skip to first unread message

Darshan Pradhan

unread,
Mar 20, 2019, 11:55:32 AM3/20/19
to AdWords API and Google Ads API Forum
Hi Support, 
I am trying to pull metrics.historical_quality_score of customer, ad_group, campaign and keyword_view resources but getting an error message in the response for all except keyword_view resource. The documentation mentions historical_quality_score can be pulled for these resources but I guess not. Please advice.

-- customer resource
message: "Cannot select or filter on the following metrics: \'historical_quality_score\'(could not support requested resources: \'CUSTOMER\'), since metric is incompatible with the resource in the FROM clause or other selected segmenting resources."
* Campaign resource
message: "Cannot select or filter on the following metrics: \'historical_quality_score\'(could not support requested resources: \'CAMPAIGN\'), since metric is incompatible with the resource in the FROM clause or other selected segmenting resources."


Request
-------
MethodName: google.ads.googleads.v1.services.GoogleAdsService/Search
Headers: {developer-token=REDACTED, login-customer-id=************, x-goog-api-client=gl-java/11.0.1 gapic/ gax/1.35.0 grpc/1.16.1}
Body: customer_id: "**********"
query: "Select  metrics.historical_quality_score,  campaign.idcustomer.id FROM campaign limit 100"
page_size: 1000


Response
--------
Headers: Metadata(content-type=application/grpc,request-id=ILT3HQXIh7bumINi9XhKVA,date=Wed, 20 Mar 2019 15:51:20 GMT,alt-svc=quic=":443"; ma=2592000; v="46,44,43,39")
Body: null
Status: Status{code=INVALID_ARGUMENT, description=Request contains an invalid argument., cause=null}.
Request ID ILT3HQXIh7bumINi9XhKVA failed due to GoogleAdsException. Underlying errors:
  Error 0: error_code {
  query_error: PROHIBITED_METRIC_IN_SELECT_OR_WHERE_CLAUSE
}
message: "Cannot select or filter on the following metrics: \'historical_quality_score\'(could not support requested resources: \'CAMPAIGN\'), since metric is incompatible with the resource in the FROM clause or other selected segmenting resources."

googleadsapi...@google.com

unread,
Mar 20, 2019, 5:26:06 PM3/20/19
to dar...@companionlabs.com, AdWords API and Google Ads API Forum
Greetings!

There's a rule that I had to get used to when first querying. You can go up the tree from most specific to general, but you can't go down the tree. So, if I select FROM campaign, I can't select ad_group. However, if I select FROM ad_group, I can select campaign. So, to get what you need, you would do this:

SELECT
campaign.id,
customer.id,
ad_group.id,
metrics.historical_quality_score
FROM
ad_group
LIMIT
100

Just to sanity check myself, I use the Query Builder all the time, especially with more complicated queries. I took this query and built it using the Query Builder just to be sure that the syntax made sense.

Take care,
Nadine Sundquist, Google Ads API Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

On 03/20/19 09:28:49 dar...@companionlabs.com wrote:
Hi Support, 
I am trying to pull metrics.historical_quality_score of customer, ad_group, campaign and keyword_view resources but I am getting following message in the response for all except keyword_view. The documentation mentions I should be able to pull for these resources. Please advice.

-- customer resource
message: "Cannot select or filter on the following metrics: \'historical_quality_score\'(could not support requested resources: \'CUSTOMER\'), since metric is incompatible with the resource in the FROM clause or other selected segmenting resources."
* ad_group resource
message: "Cannot select fields from the following resource: \'AD_GROUP\', since the resource is incompatible with the resource in FROM clause."


Request
-------
MethodName: google.ads.googleads.v1.services.GoogleAdsService/Search
Headers: {developer-token=REDACTED, login-customer-id=***********, x-goog-api-client=gl-java/11.0.1 gapic/ gax/1.35.0 grpc/1.16.1}
Body: customer_id: "**********"
query: "Select  metrics.historical_quality_score,  ad_group.idcampaign.idcustomer.id FROM campaign limit 100"
page_size: 1000


Response
--------
Headers: Metadata(content-type=application/grpc,request-id=vDMcF0EmG2UIxWrQ8-wtxQ,date=Wed, 20 Mar 2019 13:20:49 GMT,alt-svc=quic=":443"; ma=2592000; v="46,44,43,39")
Body: null
Status: Status{code=INVALID_ARGUMENT, description=Request contains an invalid argument., cause=null}.
Request ID vDMcF0EmG2UIxWrQ8-wtxQ failed due to GoogleAdsException. Underlying errors:
  Error 0: error_code {
  query_error: PROHIBITED_RESOURCE_TYPE_IN_SELECT_CLAUSE
}
message: "Cannot select fields from the following resource: \'AD_GROUP\', since the resource is incompatible with the resource in FROM clause."

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
 
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/0c34e7b5-aefe-460b-91cb-277b4774ac71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Darshan Pradhan

unread,
Mar 21, 2019, 8:17:39 AM3/21/19
to googleadsapi...@google.com, AdWords API and Google Ads API Forum
Hi, i am aware of that rule so i corrected my query in the 2nd question. My issue is i am unable to pull historical_quality_score for customer, ad group or campaign. 


For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api...@googlegroups.com.

Darshan Pradhan

unread,
Mar 22, 2019, 10:00:08 AM3/22/19
to AdWords API and Google Ads API Forum
Hi Nadine, 

I am follow up here on the thread so that the thread is kept alive even just using Campaign I am getting an error(See Below). I get the same error for "select metrics. historical_quality_score FROM ad_group" also.



2019-03-22 09:52:08,733 WARN  [Gax-3] logging.RequestLogger (RequestLogger.java:153) - FAILURE REQUEST SUMMARY. Method: google.ads.googleads.v1.services.GoogleAdsService/Search, Endpoint: googleads.googleapis.com:443, CustomerID: 9254837834, RequestID: Y8n9_oFfwoEuZGR4kkE21Q, ResponseCode: INVALID_ARGUMENT, Fault: Request contains an invalid argument..
2019-03-22 09:52:09,001 INFO  [Gax-3] logging.RequestLogger (RequestLogger.java:151) - FAILURE REQUEST DETAIL.
Request
-------
MethodName: google.ads.googleads.v1.services.GoogleAdsService/Search
Headers: {developer-token=REDACTED, login-customer-id=**************, x-goog-api-client=gl-java/11.0.1 gapic/ gax/1.35.0 grpc/1.16.1}
Body: customer_id: "*************"
query: "Select  metrics.historical_quality_score  FROM campaign"
page_size: 1000


Response
--------
Headers: Metadata(content-type=application/grpc,request-id=Y8n9_oFfwoEuZGR4kkE21Q,date=Fri, 22 Mar 2019 13:52:08 GMT,alt-svc=quic=":443"; ma=2592000; v="46,44,43,39")
Body: null
Status: Status{code=INVALID_ARGUMENT, description=Request contains an invalid argument., cause=null}.
Request ID Y8n9_oFfwoEuZGR4kkE21Q failed due to GoogleAdsException. Underlying errors:
  Error 0: error_code {
  query_error: PROHIBITED_METRIC_IN_SELECT_OR_WHERE_CLAUSE
}
message: "Cannot select or filter on the following metrics: \'historical_quality_score\'(could not support requested resources: \'CAMPAIGN\'), since metric is incompatible with the resource in the FROM clause or other selected segmenting resources."


Process finished with exit code 0



===============================================================================================================================================



Hi,

Hello,


If you want granularity at a higher level, then you would change your from clause and remove the more detailed items in the select. For example, you can do this to get it by just campaign:


SELECT
metrics.historical_quality_score
FROM
campaign
LIMIT
100


or you can do this if you want granularity at the ad group level:


SELECT

metrics.historical_quality_score
FROM
ad_group
LIMIT
100


Of course, you can add more than that in the SELECT clause, but I was simplifying it to show you that this metric can be retrieved for other objects as well. If it is available for that resource, then it will be returned.


Regards,

Nadine, Google Ads API Team


On Thursday, March 21, 2019 at 8:17:39 AM UTC-4, Darshan Pradhan wrote:
Hi, i am aware of that rule so i corrected my query in the 2nd question. My issue is i am unable to pull historical_quality_score for customer, ad group or campaign. 


For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscribe@googlegroups.com.

googleadsapi...@google.com

unread,
Mar 22, 2019, 6:32:30 PM3/22/19
to dar...@companionlabs.com, AdWords API and Google Ads API Forum
Hello Darshan,

I was looking directly at the new documentation without considering that the documentation may be unclear and that historical quality score only makes sense in a certain context. In the AdWords API, HistoricalQualityScore was only available at the keyword level. You couldn't get it for campaign or ad group. This leads me to believe that the way the API is responding is correct, but the documentation we have is a bit, I admit, confusing. There is no historical quality score backing the campaign or ad group. It's only at the keyword level. That now makes sense why these queries are reacting this way. 

I can explain how to interpret the documentation. If you go to campaign, you'll see that there is a Metrics row for campaign. If you open up that list of metrics, there is no quality score there. This means that is campaign is in the FROM clause, then only these metrics can be in the SELECT clause. There is also a row under campaign called Selectable With where you do see quality score. This means that if you are retrieving a resource that does have this metrics and you have campaign in the select, then you can also call this metric in the select because they are compatible. So, in this case, quality score is not a metric for campaign, but if you are getting the the quality score for keywords and then you have campaign in the SELECT, then you can also get the metric.

I'm sorry about the confusion. I misread the wrong drop-down when I was responding back to you and didn't give it a try before responding. I hope that clears it up for you.

Take care,
Nadine, Google Ads API Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Darshan Pradhan

unread,
Mar 25, 2019, 11:51:58 AM3/25/19
to AdWords API and Google Ads API Forum
That makes sense, Nadine, great explanation of how to read the documentation.
Reply all
Reply to author
Forward
0 new messages