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.

 

On Wednesday, May 22, 2019 at 11:29:18 AM UTC+2, SeriousJ wrote:
>
> 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?
>
>
>
> On Tuesday, May 21, 2019 at 11:49:47 PM UTC+2, adsapiforumadvisor wrote:
>>
>> 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
>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@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+unsubscr...@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/a7490ca3-5692-44ea-aecc-0a723d1d0d1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to