Hi everyone,
If you don't mind me appending to this thread, I'd like to add a similar
case with null values and a false positive in the GAQL Query Validator
(v14). All based on the campaign_search_term_insight report.
*1/3) Empty results - but correct number of items in result set*
I modified Alex's query. In particular the two segments
"search_subcategory" and "search_term" were added for more detail. Doing so
resulted in the API stating that a WHERE condition of the field
"campaign_search_term_insight.id" is required. Passing this as well,
returned the correct number of items successfully (here 14, just as I see
in the Google Ads Web UI). But all of them were empty. See query and result
here:
QUERY:
"""
SELECT
campaign_search_term_insight.campaign_id,
campaign_search_term_insight.category_label,
campaign_search_term_insight.id,
segments.search_subcategory,
segments.search_term
FROM campaign_search_term_insight
WHERE
campaign_search_term_insight.campaign_id = 'xxx'
and campaign_search_term_insight.id = 'yyy'
"""
RESULT:
"""
{'results': [
{'segments': {}},
{'segments': {}},
{'segments': {}},
{'segments': {}},
{'segments': {}},
{'segments': {}},
{'segments': {}},
{'segments': {}},
{'segments': {}},
{'segments': {}},
{'segments': {}},
{'segments': {}},
{'segments': {}},
{'segments': {}}],
'fieldMask':
'campaignSearchTermInsight.campaignId,campaignSearchTermInsight.categoryLabel,campaignSearchTermInsight.id,segments.searchSubcategory,segments.searchTerm'}
"""
*2/3) Internal Server Error*
And once I add a metric such as "metrics.impressions" to SELECT, an
internal error occurs.
QUERY:
"""
SELECT
campaign_search_term_insight.campaign_id,
campaign_search_term_insight.category_label,
campaign_search_term_insight.id,
segments.search_subcategory,
segments.search_term,
*metrics.impressions*
FROM campaign_search_term_insight
WHERE
campaign_search_term_insight.campaign_id = 'xxx'
and campaign_search_term_insight.id = 'yyy'
"""
ERROR:
"""
Request made:
ClientCustomerId: xxx,
Host: googleads.googleapis.com,
Method: /google.ads.googleads.v14.services.GoogleAdsService/Search,
RequestId: DpspNLx6Qb9V8b7DCVkeZQ,
IsFault: True,
FaultMessage: Internal error encountered.
"""
*3/3) False positive in GAQL Query Validator*
To see the false positive in the GAQL Query Validator, please validate this
query (which is the above one, but without the WHERE conditions):
https://developers.google.com/google-ads/api/fields/v14/query_validator
"""
SELECT
campaign_search_term_insight.campaign_id,
campaign_search_term_insight.category_label,
campaign_search_term_insight.id,
segments.search_subcategory,
segments.search_term
FROM campaign_search_term_insight
"""
The validation shows a valid query. But as stated above, the API requires
the campaign_id and id to be filtered by, within WHERE. Hence, I expected
the validator to hint for these two missing conditions.
"""
WHERE
campaign_search_term_insight.campaign_id = 'xxx'
and campaign_search_term_insight.id = 'yyy'
"""
*So my question is this: Is there anything I am missing in formulating the
GAQL query to retrieve actual data instead of the correct number of empty
items?*
*fyi, the Python code for running the queries, if relevant:*
*"""*
*#versions:*
*#Python 3.11.2*
*#google-ads 21.2.0#google-api-core
2.11.0#google-auth 2.22.0#google-auth-oauthlib
1.0.0#googleapis-common-protos 1.59.1*
*from google.ads.googleads.client import GoogleAdsClientfrom
google.protobuf.json_format import MessageToDictclient =
GoogleAdsClient.load_from_storage(xxx, version="v14")service =
client.get_service("GoogleAdsService")query = """xxx"""search_request =
client.get_type("SearchGoogleAdsRequest")search_request.customer_id =
xxxsearch_request.query = querysearch_request.page_size = 1000results =
service.search(request=search_request)MessageToDict(results._pb)*
*"""*
Thank you and kind regards,
Arthur
Google Ads API Forum Advisor schrieb am Donnerstag, 17. August 2023 um
15:05:49 UTC+2:
> Hi Alex,
>
> Thank you for reaching out to Google Ads API Forum.
>
> Kindly note that we could only provide support to Google Ads API-related
> concerns and technical implementations. With this, you may note that the
> API only reflects the UI which means that if there is available data in the
> UI then the API should be able to manage or pull the same. With regards to
> your concern, could you share with us the full UI screenshot (without
> cropping) showing the data you are trying to retrieve using the said query?
> This is so we could further check on our end and provide more appropriate
> guidance.
>
> You may then send the requested information privately via the Reply to
> author option. If this option is not available, you may send the details
> directly to our *[email protected]* alias instead.
> This message is in relation to case "ref:_00D1U1174p._5004Q2ntKRb:ref"
>
> Thanks,
>
> [image: Google Logo] Google Ads API Team
>
>
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/34c33bc7-b4a3-49cf-8bcd-e86b897b9ad3n%40googlegroups.com.