Search code examples
facebookfacebook-graph-apifacebook-marketing-api

Facebook Marketing API Fetching Only Facebook/Instagram Data


I'm using Facebook Marketing API to fetch Campaign, AdSet, Ad and Insight data.

I want to fetch only Facebook Campaigns or only Instagram Campaings. There is publisher_platform breakdown but I think is is only available for Insight data.

Is there a way to fetch platform specific campaign, adset, ad and insight data or is it only for insight.

I tried following example but no data was shown.

curl -X GET -G \
  -d 'fields="impressions"' \
  -d 'breakdown="publisher_platform"' \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v9.0/<AD_SET_ID>/insights

Solution

  • I'm not aware of any filtering option, but my solution was to fetch all campaigns and adsets, specifically listing the field targeting on adsets. This allows you to see which targeting.publisher_platforms were selected. You can check them in AdSets Field Reference, for Placement Targeting Options see here.

    Using a simple programming language could split adsets in two groups: Facebook and Instagram.

    Please keep in mind, that you specify publisher_platforms on adset-level, not on campaigns. So you must decide what happens, if adsets advertising on both platforms.