Confusing results from CRITERIA_PERFORMANCE_REPORT

46 views
Skip to first unread message

Igor Grigorev

unread,
May 26, 2020, 10:44:01 AM5/26/20
to AdWords API and Google Ads API Forum
Hi!
I'm using the following Python function to get criteria performance. And I'm getting lots of rows with different AdGroups and Criteria types, but all the performance stats like: Clicks, Impressions, etc. are just zeros. If I'm using additional filter in AWQL (Impressions > 1) I'm just getting empty df as result.
I'm requesting data from the last year in AWQL (tried many time intervals) and performance stats are not zeros in the UI even for one day. So it looks rather strange. am I missing something or is this a bug? Please help.

Python function:
import io
from googleads import adwords
import pandas as pd

def get_criteria_performance_report(report_downloader, start_date='20190502', end_date='20200502', criteria_type='AGE_RANGE'):
'''Function to get criteria statistics
Specs for the CRITERIA REPORT can be found here:
criteria_type (str): AGE_RANGE, GENDER, PARENT, INCOME_RANGE, ...
report_downloder should be created via:
adwords_client = adwords.AdWordsClient.LoadFromStorage(path='googleads.yaml')
report_downloder = adwords_client.GetReportDownloader(version='v201809')
'''

# Define output as a string
output = io.StringIO()

# Initialize appropriate service.
# report_downloader = client.GetReportDownloader(version='v201809')

# Create report query.
report_query = (adwords.ReportQueryBuilder()
.Select('CampaignName', 'CampaignId', 'AdGroupId',
'AdGroupName',
'Impressions', 'Clicks', 'AverageCpc', 'Labels',
'CriteriaType', 'Criteria',
'ConversionValue', 'AllConversionValue',
'ConversionRate',
'CampaignStatus', 'Cost')
.From('CRITERIA_PERFORMANCE_REPORT')
# .Where('Impressions').GreaterThan(1)
.Where('CriteriaType').In(criteria_type)
.During(start_date=start_date, end_date=end_date)
.Build())

# You can provide a file object to write the output to. For this
# demonstration we use sys.stdout to write the report to the screen.
report_downloader.DownloadReportWithAwql(
report_query, 'CSV', output, skip_report_header=False,
skip_column_header=False, skip_report_summary=True,
include_zero_impressions=True)

output.seek(0)

df = pd.read_csv(output)
print(df)
df.reset_index(inplace=True)
df.columns = df.iloc[0]
df.drop(df.index[0], inplace=True)
df = df.astype({'Campaign ID': 'int', 'Cost': 'float',
'Clicks': 'float', 'Impressions': 'float'})
df.rename(columns={'Cost': 'CostMicroAmount',
}, inplace=True)

return df

if __name__ == '__main__':

adwords_client = adwords.AdWordsClient.LoadFromStorage(path='googleads.yaml')
report_downloader = adwords_client.GetReportDownloader(version='v201809')
result_df = get_criteria_performance_report(report_downloader)

Google Ads API Forum Advisor Prod

unread,
May 26, 2020, 5:27:37 PM5/26/20
to analys...@slingwave.com, adwor...@googlegroups.com

Hi Igor,

Thank you for reaching out. In order for me to further investigate, could you please share the client customer id and both the results you get from the API and screenshot of the UI showing the discrepancy via the Reply privately to author option?

Thanks and regards,
Xiaoming, Google Ads API Team



 

ref:_00D1U1174p._5004Q1zrvhp:ref
Reply all
Reply to author
Forward
0 new messages