Hi
I'm a newbie using the Google Ad Manager API.
Currently I've configured my python environment in order to connect to my network. The conectivity test running the request
current_network = network_service.getCurrentNetwork()
And runs fine
But the scripts that I have executed from the documentation examples, they return blank results. The report is generated with the headers (names of the dimensions and metrics) but without records.
For example
get_top_level_ad_units
get_all_line_items
get_top_level_ad_units
Are a samples that returns empty information, but that script is the only one that returns data
"""Runs a report on Ad Exchange data via the Ad Manager API."""
import tempfile
# Import appropriate modules from the client library.
from googleads import ad_manager
from googleads import errors
def main(client):
# Initialize a DataDownloader.
report_downloader = client.GetDataDownloader(version='v202008')
# Create report job.
report_job = {
'reportQuery': {
'dimensions': ['DATE', 'PLACEMENT_NAME', 'DEVICE_CATEGORY_NAME', 'AGGREGATED_DEMAND_CHANNEL', 'LINE_ITEM_TYPE'],
'columns': ['TOTAL_LINE_ITEM_LEVEL_IMPRESSIONS', 'TOTAL_LINE_ITEM_LEVEL_CLICKS', 'TOTAL_LINE_ITEM_LEVEL_ALL_REVENUE', 'TOTAL_ACTIVE_VIEW_MEASURABLE_IMPRESSIONS', 'TOTAL_ACTIVE_VIEW_VIEWABLE_IMPRESSIONS'],
'dimensionAttributes': ['ADVERTISER_NAME'],
'dateRangeType': 'YESTERDAY'
}
}
try:
# Run the report and wait for it to finish.
report_job_id = report_downloader.WaitForReport(report_job)
except errors.AdManagerReportError as e:
print('Failed to generate report. Error was: %s' % e)
# Change to your preferred export format.
export_format = 'CSV_DUMP'
report_file = tempfile.NamedTemporaryFile(suffix='.csv.gz', delete=False)
# Download report data.
report_downloader.DownloadReportToFile(
report_job_id, export_format, report_file)
report_file.close()
# Display results.
print('Report job with id "%s" downloaded to:\n%s' % (
report_job_id, report_file.name))
if __name__ == '__main__':
# Initialize client object.
ad_manager_client = ad_manager.AdManagerClient.LoadFromStorage()
main(ad_manager_client)
What am I doing wrong?