3

I am trying to fetch insights of bulk campaigns, ads and adsets but i can only fetch data of default date_preset value which is i guess 7 days or something. When i use sandbox account i get data value but after using original account i do not receive any data since the date_preset param is missing. This is my request and i cant figure out how to add date_preset param in it.

me?fields=adaccounts{campaigns{status,spend_cap,account_id,can_use_spend_cap,start_time,stop_time,name,id,adsets{id,name,bid_amount,billing_event,daily_budget,end_time,lifetime_budget,optimization_goal,promoted_object,start_time,targetingsentencelines{params,id,targetingsentencelines},insights,ads{insights{frequency,impressions,reach,social_reach,social_spend,social_impressions,spend,cpm,cost_per_total_action,ad_id},id,name}},insights{frequency,impressions,reach,social_clicks,social_reach,social_impressions,social_spend,spend,cpm,cost_per_total_action}},activities},id

You can use it in graph api explorer it will return proper insights if you are using sandbox account. I am using the

api version 2.12

Syed Abdur Rehman Kazmi
  • 1,640
  • 3
  • 13
  • 30

1 Answers1

0

Here is how we can use the date_preset parameter This field is ignored if time_range or time_ranges is specified.

?<AD_ID>/insights?fields=impressions,clicks,ctr,campaign_name&date_preset=last_30d

In the above URL you may also use < ACCOUNT_ID > , < CAMPAIGN_ID > or < ADSET_ID > as well for querying those objects and date_preset parameter will work fine .

Allowed values for this date_preset are

enum{today, yesterday, this_month, last_month, this_quarter, lifetime, last_3d, last_7d, last_14d, last_28d, last_30d, last_90d, last_week_mon_sun, last_week_sun_sat, last_quarter, last_year, this_week_mon_today, this_week_sun_today, this_year}

Link To The FB Docs Page

TheVigilant
  • 720
  • 8
  • 16