EXPECTED_FILTERS_ON_DATE_RANGE

343 views
Skip to first unread message

Alexander

unread,
May 10, 2019, 6:20:08 AM5/10/19
to AdWords API and Google Ads API Forum
SELECT  metrics.conversions, metrics.interactions, metrics.average_cpm, metrics.engagements, metrics.interaction_event_types, metrics.average_cpv, metrics.engagement_rate, segments.device, metrics.all_conversions, segments.week, metrics.video_quartile_25_rate, metrics.gmail_forwards, metrics.active_view_impressions, metrics.video_view_rate, metrics.clicks, metrics.all_conversions_from_interactions_rate, metrics.active_view_measurable_impressions, metrics.cost_per_conversion, metrics.average_cpc, metrics.video_quartile_50_rate, metrics.active_view_measurability, metrics.ctr, metrics.all_conversions_value_per_cost, metrics.average_cpe, metrics.all_conversions_from_interactions_value_per_interaction, metrics.video_quartile_100_rate, segments.ad_network_type, metrics.interaction_rate, metrics.impressions, metrics.video_quartile_75_rate, metrics.active_view_viewability, metrics.gmail_saves, metrics.all_conversions_value, metrics.video_views, metrics.gmail_secondary_clicks, metrics.value_per_conversion, metrics.active_view_cpm, metrics.active_view_ctr, metrics.active_view_measurable_cost_micros, metrics.cost_micros, segments.date  FROM ad_group_audience_view WHERE segments.date BETWEEN "2019-05-09" AND "2019-05-09" LIMIT 100


Failure message: errors {
  error_code {
    query_error: EXPECTED_FILTERS_ON_DATE_RANGE
  }
  message: "Expects filters on the following field to limit a finite date range: \'segments.week\'"
}


I have a filter on segments.date. Why do I need additional filters on segments.week? Is this a bug, or expected behaviour?

SeriousJ

unread,
May 21, 2019, 1:30:28 PM5/21/19
to AdWords API and Google Ads API Forum
Same issue here.

This is my query:

SELECT metrics.cost_micros, campaign.name, segments.week FROM campaign WHERE segments.date >= '2018-07-01' AND segments.date <= '2018-08-07'

and I get the following error message: Expects filters on the following field to limit a finite date range: 'segments.week' 

Is this a bug?

Google Ads API Forum Advisor Prod

unread,
May 21, 2019, 5:49:47 PM5/21/19
to adwor...@googlegroups.com
Hello,

While applying where condition for date segment in a query, you have to make sure all the date segments are in the WHERE condition only. 

Regards,
Sai Teja, Google Ads API Team

ref:_00D1U1174p._5001UAqFgy:ref

SeriousJ

unread,
May 22, 2019, 5:29:18 AM5/22/19
to AdWords API and Google Ads API Forum
Well, no.

This query gets me good results:

1) SELECT metrics.cost_micros, campaign.name, segments.month FROM campaign WHERE segments.date >= '2018-07-01' AND segments.date <= '2018-08-07'

whereas this query doesn't get any result:

2) SELECT metrics.cost_micros, campaign.name FROM campaign WHERE segments.month >= '2018-07-01' AND segments.month <= '2018-08-07'

So obviously making sure "all the date segments are in the WHERE condition only" is not a correct answer.
 

This query gives me the error message "Expects filters on the following field to limit a finite date range: 'segments.week'":

3) SELECT metrics.cost_micros, campaign.name, segments.week FROM campaign WHERE segments.date >= '2018-07-01' AND segments.date <= '2018-08-07'
 
This is not consistent with the behavior of query #1, which makes us think of a bug.


And this query doesn't get any result:

4) SELECT metrics.cost_micros, campaign.name FROM campaign WHERE segments.week >= '2018-07-01' AND segments.week <= '2018-08-07

Is there anyone at Google who can tell us how to get results by week?

SeriousJ

unread,
May 22, 2019, 12:09:14 PM5/22/19
to AdWords API and Google Ads API Forum
Don't listen to Google Ads API Team members. They don't have a clue either.

So for all of you struggling with this idiotic API, here is a solution:

SELECT metrics.cost_micros, campaign.name, segments.week FROM campaign WHERE segments.week >= '2018-07-01' AND segments.week <= '2018-08-07

Yes, it's not consistent with queries for other date segments (like month, year, date, etc...) But Google programmers forgot logic and consistency a long time ago. 

And one last surprise: the above query returns data for the whole week, not just up to the last date. So if you're asking for data from week 1 and half of week 2, you will get results for the whole week 2. Of course, it's also not consistent with queries for other date segments. For example, if you ask for half a month, you will get half a month. But week is different. Why? Because it's Google and they don't care.

Google Ads API Forum Advisor Prod

unread,
May 22, 2019, 1:17:22 PM5/22/19
to j...@miratech.fr, adwor...@googlegroups.com
Greetings!

First of all, thank you so much for helping out here by posting a solution that works. Second, thanks for clearly outlining what appears to be a possible bug in our query language. We shouldn't have date-like segments behaving differently. So, I filed an issue over here to get that resolved. I would be frustrated, too, if I had code acting like that, especially when getting started. It's like being in the Matrix where you might as well ask the Oracle what happens next, and we're not in the Matrix...at least I hope we aren't. On the other hand, the Matrix would be kind of cool if I could defy physics. Now, back to reality. I'll work on getting this one sorted out, and we'll update our guides to help with making this more clear.

If anyone else finds an inconsistency like this in the new API, please tell us either on this forum in a new thread, or you can file an issue on our Google Ads API site by clicking Send Feedback in the upper right-hand corner and choosing Google Ads API Product Feedback. As this new API comes online, we can still make modifications if something doesn't seem right, so please bring these up.

Thanks,
Nadine Sundquist, Google Ads API Team

ref:_00D1U1174p._5001UAqFgy:ref

SeriousJ

unread,
May 22, 2019, 1:37:51 PM5/22/19
to AdWords API and Google Ads API Forum
There are many inconsistencies in the language. Really a lot.

You want to have fun? Tell me what's the query to get the value of all extension_feed_items belonging to a campaign.

This new API is even more obscure than the previous one. No small feat. And of course, it's much much slower. About 4 times slower. And of course, what took a few seconds in the previous API now returns a deadline_exceeded error. But not always because random timeouts feel sooooo good. You Google guys are champions. I'm happy we have no other choice.

Google Ads API Forum Advisor Prod

unread,
May 23, 2019, 12:39:57 AM5/23/19
to j...@miratech.fr, adwor...@googlegroups.com
Hello All,

I've found the source of the inconsistency, so we can work on finding a resolution. Just so everyone has a summary of the current state, here is it:
  • You can have segments.month, segments.quarter in the SELECT clause with segments.date in the WHERE clause. The result is that you'll get metrics for your date range and the metrics will be empty for anything outside your date range. The only one that does not work like this is segments.week, so that's where we'll focus on getting that in line with the others.
  • If you select segments.month with segments.month in the WHERE or or segments.week with segments.week in the WHERE clause or segments.quarter with segments.quarter in the WHERE clause, then you'll only get back metrics for that time. Keep in mind that if you picked month that if your date spans the 1st of over 2 months, you'll get back 2 results, one for each month you've spanned. 
I've run all the variations and we're working on getting that sorted out.

Now, let's see about that second question on extension settings and feeds. This spanned multiple objects in AdWords API. So, let's take this one offline so we don't clutter this forum thread with a separate topic. It's easier for people searching later if there's one topic per thread. Just click Reply privately to author on the forum with what exactly you did in the AdWords API to get that exact result, and I can get you what you're looking for in the Google Ads API. Just as a starter query, I've found 'SELECT extension_feed_item.resource_name, extension_feed_item.extension_type, campaign.resource_name, campaign.id, campaign.name from extension_feed_item order by campaign.id limit 100' works, and I expand from there for specific types of extension feed items. 

As for the performance, I totally agree with you that there's a slowdown in certain places depending on the report, but we are very aware of it and we're working on it. My teammate Ben posted something on it if you're interested in the specifics. 

If you want to chat further on your query, feel free to click Reply privately to author. If you have a new question or topic, then please start a new thread to make it easier for your fellow readers.

Thanks,
Nadine, Google Ads API Team

ref:_00D1U1174p._5001UAqFgy:ref

SeriousJ

unread,
May 23, 2019, 5:41:32 AM5/23/19
to AdWords API and Google Ads API Forum
I don't want to reply privately as many other programmers are trying to make this work and can find this useful. It's also good to keep a public record of how bad things have become.

Your query 'SELECT extension_feed_item.resource_name, extension_feed_item.extension_type, campaign.resource_name, campaign.idcampaign.name from extension_feed_item order by campaign.id limit 100' does not work. It returns no results.

Not only is this API tremendously bad, but your random solutions don't work. Do you want to play one more time or do you want me to give you the answer again ?

Google Ads API Forum Advisor Prod

unread,
May 23, 2019, 10:22:18 AM5/23/19
to j...@miratech.fr, adwor...@googlegroups.com
Hello,

The reason I sent you this query is because I ran this exact query against a few of your company's accounts, and I got back results. I was hoping to work with you privately in order to find out which account was not getting results. You can provide me the account number publicly because that's not considered private information, but I feel that your company perhaps would appreciate this going offline so we can dig into the details of this particular problem. I can assure everyone that I've tried this query on multiple accounts, and it does work. It it does not work, it could be for a number of reasons ranging from feeds being used rather than extensions to possibly the extensions being linked to the customer or the ad group instead. I would be glad to put on my Sherlock Holmes hat here, but I need a few more details that may be better to take offline for now.

Take care,

SeriousJ

unread,
May 23, 2019, 10:31:29 AM5/23/19
to AdWords API and Google Ads API Forum
It's still not the answer. All the reasons that you give for not working don't apply to us. We use extensions, not feeds. Extensions are linked to the campaign. And I'm tired of debugging your answers.

I'll give you the answer.

First you need a query for getting all extensions and their details that belong to the account, including extensions that don't belong to a campaign:

SELECT
extension_feed_item.status,
extension_feed_item.extension_type,
extension_feed_item.callout_feed_item.callout_text,
extension_feed_item.structured_snippet_feed_item.header,
extension_feed_item.structured_snippet_feed_item.values,
extension_feed_item.sitelink_feed_item.link_text,
extension_feed_item.sitelink_feed_item.line1,
extension_feed_item.sitelink_feed_item.line2,
extension_feed_item.sitelink_feed_item.final_urls
FROM extension_feed_item
WHERE extension_feed_item.status != \'REMOVED\'

Store the results. Then you need to get extensions belonging to campaigns:

SELECT
campaign_extension_setting.campaign,
campaign_extension_setting.extension_feed_items,
campaign_extension_setting.extension_type
FROM campaign_extension_setting

But then you're not done because the second query just gives you extension IDs, not their details. Then you need to match the IDs that you got from the first query.

I can teach you more of your own language if you want.
Reply all
Reply to author
Forward
0 new messages