Learner
Learner

Reputation: 23

How to get the Individual campaign id, For each Campaign ID, having fields Post Engagement, Page Engagement, Link Click

ttps://graph.facebook.com/v14.0/act_XXXXXX/insights?fields=account_name,campaign_id,campaign_name,adset_id,adset_name,ad_id,ad_name,spend,actions&filtering=[{field: "action_type",operator:"IN", value['link_click','page_engagement','post_engagement']}]&access_token=XXXXXX

I'm trying the above Graph API CURL: For getting the overall post engagement, page Engagement, and Link Clicks, for this account. Can you please help? "{ "data": [ { "account_name": "ABCD", "spend": "232", "actions": [ { "action_type": "link_click", "value": "5962" }, { "action_type": "page_engagement", "value": "26525" }, { "action_type": "post_engagement", "value": "26525" } ], "date_start": "2022-07-27", "date_stop": "2022-08-25" } ], "paging": { "cursors": { "before": "xxxx", "after": "xxxx" } } }'

Upvotes: 1

Views: 981

Answers (1)

Vivek
Vivek

Reputation: 1523

Use level as parameter to Insights API for getting data at required levels.

Supported levels:

  • delivery_ad
  • politicalad
  • ad
  • adset
  • campaign
  • account

Example for fetching data at campaign level -

https://graph.facebook.com/v14.0/act_XXXXXX/insights?
  fields=account_name,campaign_id,campaign_name,adset_id,adset_name,ad_id,ad_name,spend,actions&
  filtering=[{"field": "action_type",operator:"IN", "value":["link_click","page_engagement","post_engagement"]}]&
  level=campaign

Reference: https://developers.facebook.com/docs/marketing-api/insights/#levels

Upvotes: 2

Related Questions