1. Marketing API Quickstart
To get started with the Marketing API, start by creating an app. Once created, you can add Marketing API as a product and go through the Quickstart experience within your app dashboard.
Marketing API Quickstart simplifies using the Marketing API by generating sample code for you. It is a step-by-step on-boarding flow that helps you use ad management and insights tools built on Facebook's Marketing API. You can start getting insights from your Facebook Pixel or App Ads SDKs by clicking the Create Ad reports below.Marketing API Quickstart
2. Example Query: Campaign Statistics
To get the statistics of a campaign's last 7 day performance run the following query:
use FacebookAds\Object\AdCampaign; use FacebookAds\Object\Values\InsightsPresets; $campaign = new AdCampaign('<AD_CAMPAIGN_ID>'); $params = array( 'date_preset' => InsightsPresets::LAST_7_DAYS, ); $insights = $campaign->getInsights(null, $params); print_r($insights);
To learn more about how to query statistics, see the ad insights edge documentation.
3. All References
The Ads Insights API has the following references that we strongly recommend to read:
Any endpoints not in the above list are not covered in this API.
If you are planning to include reports for Facebook in your product interface, please refer to section 14.7 of the Ads API policy.