PROHIBITED_SEGMENT_WITH_METRIC_IN_SELECT_OR_WHERE_CLAUSE

119 views
Skip to first unread message

Bryan Yen

unread,
Mar 28, 2023, 10:28:59 PM3/28/23
to Google Ads API and AdWords API Forum
Hi, 

I have a query that works but after adding in "segments.conversion_attribution_event_type" into the SELECT clause, I get the following error:

"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.conversion_attribution_event_type'(unsupported metrics: 'all_conversions_from_interactions_rate', 'average_cpc', 'clicks', 'cost_micros', 'cost_per_all_conversions', 'cost_per_conversion', 'ctr', 'impressions')."
}
]


My query looks like this:

"SELECT campaign.name, campaign.status, campaign.advertising_channel_type, campaign.start_date, campaign.end_date, metrics.impressions, metrics.clicks, metrics.ctr, metrics.average_cpc, metrics.cost_micros, metrics.conversions, metrics.cost_per_all_conversions, metrics.cost_per_conversion, metrics.all_conversions_from_interactions_rate, segments.conversion_attribution_event_type
            FROM campaign
            WHERE segments.date DURING LAST_30_DAYS"

It looks like the segment is not compatible with some of the metric fields. I added in "segments.conversion_attribution_event_type" to be able to know if the conversion was from a signup, download, etc. Is there a way I can find that information another way? Also does anyone know why that segment is incompatible with some metrics in the SELECT? Thanks!

Bryan

Google Ads API Forum Advisor

unread,
Mar 29, 2023, 4:58:28 AM3/29/23
to bryan...@gmail.com, adwor...@googlegroups.com
Hi Bryan, 

Thank you for raising this concern to the Google Ads API Forum. We hope that today is going well for you!

I can confirm that your understanding is correct, the PROHIBITED_SEGMENT_WITH_METRIC_IN_SELECT_OR_WHERE_CLAUSE is encountered because a segment may have been included together with a metric that it is incompatible with in the SELECT or WHERE clause. For more information you may see this document about segmentation

In order to get the information that you are referring from Google Ads UI to Google Ads API, you may just share with us the full Google Ads UI together with the CID so that we can check this on our end. For privacy purposes, you can provide it via the Reply privately to author option. If this option is not available, then send it instead on this email address googleadsapi-support@google.com.

 ​Additionally, kindly note that it is normal that there are fields that are incompatible with other fields, as the API only mirrors the feature in the UI. With this, I would recommend that you use the Google Ads Query Builder  and Query Validator tools for constructing queries.

Best regards,
Google Logo Google Ads API Team


ref:_00D1U1174p._5004Q2kClZC:ref
Reply all
Reply to author
Forward
Message has been deleted
0 new messages