Hello,
Thank you for reaching out to us.
With regard to the query error (PROHIBITED_SEGMENT_WITH_METRIC_IN_SELECT_OR_WHERE_CLAUSE), this signifies that a segment in the SELECT clause is incompatible with a metric in the SELECT or WHERE clause. Looking on your query, I can see that you have a device segment (segments.device) which is incompatible with the metrics.invalid_clicks field. Moving forward, please use the Google Ads Query Builder to validate your GAQL which already includes query syntax, field validity, field compatibility, and field selectability.
As an aside, I will be removing your original post as it contains your error logs. Please refrain from sharing logs in the Forum thread. We suggest sending those details privately or via our support alias (googleadsa...@google.com). Below is a copy of your post with the redacted details.
Hello,
I try to get a report campaign with column "metrics.invalid_clicks", but it return an error, could you look this error ? please
Page support: https://developers.google.com/google-ads/api/docs/migration/mapping#campaign_performance
you can find " metrics.invalid_clicks" is available for "campaign"
thanks for your reply.
ERROR LOG:
[2021-10-01T11:04:45.961064+02:00] google-ads.WARNING: Request made: Host: "googleads.googleapis.com", Method: "/google.ads.googleads.v8.services.GoogleAdsService/SearchStream", CustomerId: 5537212111, RequestId: "REDACTED", IsFault: 1, FaultMessage: "["Cannot select the following segments because at least one unsupported metric is found in SELECT or WHERE clause: 'segments.device'(unsupported metrics: 'invalid_clicks')."]"
[2021-10-01T11:04:45.961858+02:00] google-ads.NOTICE: Request
-------
Method Name: /google.ads.googleads.v8.services.GoogleAdsService/SearchStream
Host: googleads.googleapis.com
Headers: {
"x-goog-api-client": "gl-php\/7.4.23 gapic\/ gax\/1.9.0 grpc\/1.25.0 rest\/1.9.0",
"x-goog-request-params": "customer_id=5537212111",
"developer-token": "REDACTED",
"login-customer-id": "2839567378"
}
Request:
{"customerId":"5537212111","query":"\n SELECT\n segments.date,\n segments.device,\n campaign.id,\n campaign.name,\n metrics.impressions,\n metrics.clicks,\n metrics.cost_micros,\n customer.currency_code,\n customer.id,\n metrics.invalid_clicks\n FROM campaign\n WHERE segments.date DURING YESTERDAY\n "}
Response
-------
Headers: {
"request-id": "REDACTED",
"date": "Fri, 01 Oct 2021 09:04:47 GMT",
"alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\""
}
Fault
-------
Status code: 3
Details: Request contains an invalid argument.
Failure: {"errors":[{"errorCode":{"queryError":"PROHIBITED_SEGMENT_WITH_METRIC_IN_SELECT_OR_WHERE_CLAUSE"},"message":"Cannot select the following segments because at least one unsupported metric is found in SELECT or WHERE clause: 'segments.device'(unsupported metrics: 'invalid_clicks')."}],"requestId":"REDACTED"}
Request with ID 'REDACTED' has failed.
Google Ads failure details:
query_error: Cannot select the following segments because at least one unsupported metric is found in SELECT or WHERE clause: 'segments.device'(unsupported metrics: 'invalid_clicks').
Regards,
|
||||||