Significance of segments.date in select column vs where clause

149 views
Skip to first unread message

Felicity Tiebel

unread,
Sep 26, 2023, 12:59:41 AM9/26/23
to Google Ads API and AdWords API Forum
Hi, 

I'm struggling to understand why I am getting a vastly different number of campaigns depending on whether I add the field segments.date to the select columns or only use segments.date in the where clause?

From the documentation i understood that there is no need to use segments.date in the select columns it's enough to use it in the where clause but when i do so I get about 5 times more results.

so this query:

SELECT

    campaign.app_campaign_setting.app_id,

    campaign.app_campaign_setting.app_store,

    campaign.id,

    campaign.name,

    segments.date

FROM campaign

WHERE customer.id = account_id

AND segments.date = date


gets way less result than this one: 

SELECT

    campaign.app_campaign_setting.app_id,

    campaign.app_campaign_setting.app_store,

    campaign.id,

    campaign.name

FROM campaign

WHERE customer.id = account_id

AND segments.date = date


Can you explain to me how the presence of the segments.date column in the select clause affects the query result?


Thank you!


Felicity

Felicity Tiebel

unread,
Oct 10, 2023, 1:00:53 AM10/10/23
to Google Ads API and AdWords API Forum
No answer yet?

The significance of the segments.date column seems something that should be documented better. In a different use case I now understand that there is no querying of campaign states by date - even though doing so does not give any error and simply falsely returns whatever date is queried on in the the where clause in the select column. 
however the query itself always returns the same information no matter on what date it is queried.

riddle me that, I would really appreciate an in depth explanation or a pointer to some documentation (couldn't find anything useful on this)

Thank you!

Google Ads API Forum Advisor

unread,
Oct 10, 2023, 6:55:52 AM10/10/23
to adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

After reviewing your query, I understand that your concern is related to segments in Google Ads API. I would suggest you refer to the document Date Ranges to get more information. Also, please refer to the Query Structure to know how the segments.date column in the select clause affects the query result. Kindly go through the Common Use Case Example.

If you still require any further assistance, kindly get back to us.

 
This message is in relation to case "ref:_00D1U1174p._5004Q2pQHLD:ref"

Thanks,
 
Google Logo Google Ads API Team


Felicity Tiebel

unread,
Oct 11, 2023, 1:38:25 AM10/11/23
to Google Ads API and AdWords API Forum
yes i did all that of course. for example i found out by trial and error and pure inference (nothing in the docs) that a paused campaign doesn't really have a segment.date so when filtering on a specific date, you actually only get the active campaigns. that's what i infer from the results but I'm looking for an explanation as to why that is and a more in depth explanation as to in what cases a segment.date filter is not in fact applied even though the query is valid.

I can also see that filtering for different dates in the where clause doesn't actually affect the result - it just returns whatever is the current campaign snapshot. That is misleading and not explained - unless there is an part of the documentation i missed (not from the links provided)

Thanks for your help!

Google Ads API Forum Advisor

unread,
Oct 11, 2023, 6:26:09 AM10/11/23
to adwor...@googlegroups.com
Hi,

Thank you for getting back to us.

After reviewing your concern, I understand that you are getting different campaign records when including the segment.date field in the SELECT columns or only use segments.date in the WHERE clause. To investigate further, could you provide the complete request and response logs with request ID and request header along with uncropped UI screenshot generated at your end?

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java , .Net , PHP , Python , Ruby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

You can send the details via Reply privately to the author option, or direct private reply to this email.
Reply all
Reply to author
Forward
0 new messages