Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated report request example with age_gender report request #141

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions examples/v13/report_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,50 @@ def get_user_location_performance_report_request(

return report_request

def get_age_gender_performance_report(
account_id,
aggregation,
exclude_column_headers,
exclude_report_footer,
exclude_report_header,
report_file_format,
return_only_complete_data,
time):
report_request=reporting_service.factory.create('AgeGenderAudienceReportRequest')
report_request.Aggregation=aggregation
report_request.ExcludeColumnHeaders=exclude_column_headers
report_request.ExcludeReportFooter=exclude_report_footer
report_request.ExcludeReportHeader=exclude_report_header
report_request.Format=report_file_format
report_request.ReturnOnlyCompleteData=return_only_complete_data
report_request.Time=time
report_request.ReportName="User age gender performance report"
scope=reporting_service.factory.create('AccountThroughAdGroupReportScope')
scope.AccountIds={'long': [account_id] }
scope.Campaigns=None
scope.AdGroups=None
report_request.Scope=scope

report_columns = self.reporting_service.factory.create('ArrayOfAgeGenderAudienceReportColumn')
report_columns.AgeGenderAudienceReportColumn.append([
'AccountName',
'AccountNumber',
'AdGroupId',
'AdGroupName',
'AdGroupStatus',
'AgeGroup',
'Gender',
'Assists',
'CampaignName',
'Language',
'Spend',
'Impressions',
'Clicks'
])
report_request.Columns = report_columns

return report_request

# Main execution
if __name__ == '__main__':

Expand Down