Facebook Marketing API - pulling reports from business manager account

我是研究僧i 提交于 2019-12-22 10:35:07

问题


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

来源:https://stackoverflow.com/questions/51526809/facebook-marketing-api-pulling-reports-from-business-manager-account

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!