Ronak Shah
Ronak Shah

Reputation: 420

Facebook Ads Insights API Could not fetch Budget

I am working on facebook ads api v2.5 to get the ad account stats.Below is the code I am using it to get the data :-

$params = array(
                'date_preset' => InsightsPresets::LAST_30_DAYS,
                'level' => InsightsLevels::CAMPAIGN,
                'limit' => 1000,
            );
            $fields = array(
                InsightsFields::CAMPAIGN_NAME,
                InsightsFields::CAMPAIGN_ID,
                InsightsFields::DATE_START,
                InsightsFields::DATE_STOP,
                InsightsFields::IMPRESSIONS,
                InsightsFields::SOCIAL_IMPRESSIONS,
                InsightsFields::UNIQUE_CLICKS,
                InsightsFields::REACH,
                InsightsFields::SPEND,
                InsightsFields::TOTAL_ACTIONS,
                InsightsFields::TOTAL_ACTION_VALUE,
                InsightsFields::ACTIONS
            );


            $insights = $account->getInsights($fields, $params);

I also need to fetch the campaign budget, but can't seems to find any way to get campaign budget.

Any idea how can I get Campaign budget??

Thanks, Ronak Shah

Upvotes: 1

Views: 1557

Answers (1)

David
David

Reputation: 1436

Budget is defined on adset level (see docs) and it's rather a static value than a statistical one. Therefore you have to use classic reading request on adset by its ID.

Campaign names and IDs are available in insights, so that you can pair the insights with advert objects.

Relevant adset fields are LIFETIME_BUDGET, DAILY_BUDGET and BUDGET_REMAINING.

There is also campaign field named SPEND_CAP, but I'm not sure that's something everyone can use. And really the budget is typically set on adset level.

Upvotes: 3

Related Questions