I am new to Google AdWords API.

Right now I am downloading the AD_PERFORMANCE_REPORT and I want to segment it by day, but I cant find the right example in their documentation

My code looks like this:

 def get_data(customer_id):     df = None     for item in customer_id:         report_query = (adwords.ReportQueryBuilder()                         .Select('AdGroupId', 'AdGroupName', 'AbsoluteTopImpressionPercentage', 'Impressions', 'Conversions')                         .From('AD_PERFORMANCE_REPORT')                         .During('LAST_7_DAYS')                         .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,             client_customer_id=item,  # denotes which adw account to pull from             skip_report_header=True,             skip_column_header=False,             skip_report_summary=True,             include_zero_impressions=False)         output.seek(0)         df = pd.read_csv(output)         if df is None:             df = pd.DataFrame(output)         else:             df = df.append(pd.DataFrame(output))     return df 

Thank you for your suggestions.

Tag:google-ads-api, google-api, python

Only one comment.

  1. dorian

    Just add Date to your field list (i.e. the Select clause of your query).

    As mentioned in the report's documentation, Date is a field with behavior "Segment", so adding it to the returned fields will result in a segmented report.

Add a new comment.