AdWordsReportError

已查看 223 次
跳至第一个未读帖子

Zhen

未读,
2017年8月9日 01:37:512017/8/9
收件人 AdWords API Forum
Hi,
I'm trying to get GEO_PERFORMANCE_REPORT from API. 
When I tried with the sample "CRITERIA_PERFORMANCE_REPORT", the call is successful, when I tried with GEO_PERFORMANCE_REPORT, I get below errors:

from googleads import adwords

def
main(client):
 
# Initialize appropriate service.
    report_downloader
= client.GetReportDownloader(version='v201705')


 
# Create report query.
    report_query
= ('SELECT CampaignId FROM GEO_PERFORMANCE_REPORT '

                 
)


    queried_string
= report_downloader.DownloadReportAsStringWithAwql(
       report_query
, 'CSV', skip_report_header=False, skip_column_header=False,
       skip_report_summary
=False, include_zero_impressions=True)
   
return queried_string

adwords_client = adwords.AdWordsClient.LoadFromStorage()
query = main(adwords_client)

---------------------------------------------------------------------------
AdWordsReportError                        Traceback (most recent call last)
<ipython-input-55-7f179bb5e4c1> in <module>()
      1 adwords_client = adwords.AdWordsClient.LoadFromStorage('/home/zhge/purchase_journey/gg_api_call/googleads.yaml')
----> 2 query = main(adwords_client)

<ipython-input-54-6b10349e101a> in main(client)
     24     queried_string = report_downloader.DownloadReportAsStringWithAwql(
     25        report_query, 'CSV', skip_report_header=False, skip_column_header=False,
---> 26        skip_report_summary=False, include_zero_impressions=True)
     27     return queried_string
     28 

/home/zhge/purchase_journey/peanutbutter_jelly/env/local/lib/python2.7/site-packages/googleads/common.pyc in Wrapper(*args, **kwargs)
    527       with _UTILITY_LOCK:
    528         _utility_registry.Add(registry_name)
--> 529       return utility_method(*args, **kwargs)
    530     return Wrapper
    531 

/home/zhge/purchase_journey/peanutbutter_jelly/env/local/lib/python2.7/site-packages/googleads/adwords.pyc in DownloadReportAsStringWithAwql(self, query, file_format, **kwargs)
   1453     try:
   1454       response = self._DownloadReportAsStream(
-> 1455           self._SerializeAwql(query, file_format), **kwargs)
   1456       return response.read().decode('utf-8')
   1457     finally:

/home/zhge/purchase_journey/peanutbutter_jelly/env/local/lib/python2.7/site-packages/googleads/adwords.pyc in _DownloadReportAsStream(self, post_body, **kwargs)
   1616             'Request Summary: %s', self._ExtractRequestSummaryFields(
   1617                 request, error=e))
-> 1618       raise self._ExtractError(e)
   1619 
   1620   def _SanitizeRequestHeaders(self, headers):

AdWordsReportError: AdWords report download failed with HTTP status code: 400


I tried to get the fields for GEO_PERFORMANCE_REPORT, and I was able to do that.

Vincent Racaza (AdWords API Team)

未读,
2017年8月9日 03:05:102017/8/9
收件人 AdWords API Forum
Hi Zhen,

For Geo Performance Report, you need to include the CountryCriteriaId as one of your reporting fields so it won't generate an AdWordsReportError. You can do something like this in your report query:

report_query = ('SELECT CampaignId,  CountryCriteriaId, Impressions FROM GEO_PERFORMANCE_REPORT ')

Let me know if the issue persists after doing the suggestion.

Thanks,
Vincent
AdWords API Team

zhen

未读,
2017年8月9日 13:22:302017/8/9
收件人 AdWords API Forum
Thanks Vincent! Yes it worked.

Zhen

Zhen

未读,
2017年8月9日 15:44:072017/8/9
收件人 AdWords API Forum
Hi Vincent,
I'm getting the same error again trying to get the "Date" field" with below query:

report_query = ('SELECT Year, Date, DayOfWeek, MonthOfYear, CampaignId, CountryCriteriaId, CampaignName,'
                   
'CustomerDescriptiveName, CampaignStatus, AdGroupId ,'
                   
'AverageCost, Clicks, Cost, MostSpecificCriteriaId '
                   
'FROM GEO_PERFORMANCE_REPORT '
                   
'WHERE Year in [2016, 2017]'
                 
)

It works without "Date", but threw the same "AdWordsReportError" with "Date".

Zhen


On Wednesday, August 9, 2017 at 12:05:10 AM UTC-7, Vincent Racaza (AdWords API Team) wrote:

Vincent Racaza (AdWords API Team)

未读,
2017年8月9日 23:35:062017/8/9
收件人 AdWords API Forum
Hi Zhen,

If you are including a Date segment in your report, you also need to include a DURING clause in your report query. Please see sample code snippet below:

report_query = ('SELECT Year, Date, DayOfWeek, MonthOfYear, CampaignId, CountryCriteriaId, CampaignName,'
       
'CustomerDescriptiveName, CampaignStatus, AdGroupId ,'
       
'AverageCost, Clicks, Cost, MostSpecificCriteriaId '
       
'FROM GEO_PERFORMANCE_REPORT '

       
'WHERE Year in [2016, 2017] DURING LAST_MONTH')

Also, you may refer to this guide for the possible date ranges that you can set in the DURING clause.

I also recommend you to enable your SOAP logs so you can check for your detailed SOAP request and response. You can enable it by following the "How do I log SOAP interactions?" section of this document.

Zhen

未读,
2017年8月10日 13:21:022017/8/10
收件人 AdWords API Forum
Thanks! Vincent, it worked. I'll follow your suggestion.
Zhen
回复全部
回复作者
转发
0 个新帖子