Anirudh
Anirudh

Reputation: 3388

Getting empty data for Instagram Ad Campaigns via Facebook Marketing API

I'm currently using Facebook Marketing API to get Ad related data of my Facebook and Instagram page. (I have connected my Instagram page to Facebook page)

When I call the below API endpoint, I'm getting data for Facebook and Instagram Ads.

/v3.1/ad_account_id/insights?fields=spend,clicks,impressions&breakdowns=publisher_platform

When I call the below API endpoint, I'm able to get data from Facebook Campaigns only. I have checked in my Facebook Ad console, I'm able to see that there are active Instagram Ad campaigns.

/v3.1/ad_account_id/campaigns?breakdowns=publisher_platform

What could be causing this?

Upvotes: 0

Views: 412

Answers (2)

veuncent
veuncent

Reputation: 1712

For future reference, this could also be written as:
/v8.0/<ad account id>/campaigns?fields=insights.breakdowns(publisher_platform)

For Insights on ad level I use this: /v8.0/<ad account id>/campaigns?fields=created_time,start_time,stop_time,id,name,objective,adlabels,bid_strategy,budget_remaining,daily_budget,lifetime_budget,spend_cap,buying_type,configured_status,effective_status,status,adsets{created_time,id,name,bid_adjustments,bid_amount,bid_constraints,bid_info,bid_strategy,billing_event,budget_remaining,campaign_id,effective_status,status,ads{name,id,created_time,insights.breakdowns(publisher_platform){impressions,reach,spend,clicks,unique_clicks,actions,cost_per_action_type,cost_per_unique_click,cpc,cost_per_inline_post_engagement}}}

Upvotes: 0

MUHAMMED IQBAL
MUHAMMED IQBAL

Reputation: 697

Should be rewritten as

/v3.1/ad_account_id?fields=campaigns{insights.breakdowns(publisher_platform)}

Upvotes: 1

Related Questions