Facebook Marketing API - pulling reports from business manager account

1k Views Asked by At

I have an ads account on facebook business manager. I've created a report using the ads reporting UI. I'm trying to use the facebook_business python SDK to either list the reports that have been created for the Ad Account and/or download the report(s) to a .csv or store the report in a python variable.

I've been using the get_insights() method but I want to find a report thats already been created.

from facebook_business.adobjects.adaccount import AdAccount
from facebook_business.adobjects.adsinsights import AdsInsights
from facebook_business.api import FacebookAdsApi

FacebookAdsApi.init(app_id=app_id,
                app_secret=app_secret,
                access_token=access_token)

ad_account = AdAccount(ad_account_id)

fields = [
'campaign_name',
'adset_name',
'impressions',
'reach',
'clicks',
'inline_link_clicks',
'campaign_name',
'impressions',
'website_purchase_roas']

params = {
'level': 'adset',
'filtering': [],
'breakdowns': [],
'date_preset': 'last_7d'}

ad_account.get_insights(fields=fields,
                params=params)

The downside to using get_insights is that there are some metrics that I cannot input into fields such metrics as website purchases, website content views, website purchase conversions

0

There are 0 best solutions below