Use Facebook Ads as a data source

Resources

Data Source Type Facebook
Authentication OAuthToken Authentication
Sample Query https://graph.facebook.com/v2.8/act_123456789/insights
API Documentation Facebook Marketing API documentation
Klip Gallery Save time and add pre-built Klips with the Klip Gallery! 
Klip Gallery: Facebook Ads.

Step-by-Step

Creating a data source using Facebook Ads

To create a data source using Facebook Ads, you need to accomplish 3 tasks:

  • Start the data source creation process.
  • Authenticate with Facebook Ads.
  • Write a query and enter it in Klipfolio.

Step 1: Start the data source creation process

To create a data source using Facebook Ads, go to the Connector Gallery page in Klipfolio and select Facebook Ads.

Step 2: Authenticate with Facebook Ads

  1. Choose your current Facebook token from the dropdown list, or create a new token by clicking Connect new account.
  2. If prompted, enter your username and password and click Log in.
  3. Save your OAuth Credentials.

Step 3: Write the query and enter it in Klipfolio

Refer to the Facebook Marketing API Documentation as you are writing a query. There are many query options available in the Facebook Ads API documentation; here are sample queries to get you started:

Daily Metrics
https://graph.facebook.com/v2.8/act_<your_account_id>/insights

Facebook Ads Metrics over the past 7 days

https://graph.facebook.com/v2.8/act_<your_account_id>/insights?date_preset=last_7_days&time_increment=1&fields=account_id,cpm,cpp,spend,impressions,reach

https://graph.facebook.com/v2.8/act_123456789/insights?level=ad&fields=ad_name,adset_name,campaign_name,spend,unique_clicks,cost_per_unique_click,cpm,ctr&sort=spend_descending&date_preset=last_7_days

 

Specify a date range

To specify a date range for your Facebook Ads query, you can select either a preset date range, for example,

   &date_preset=last_90_days

or a specific time range using the following parameters:

   &time_range[since]=yyyy-MM-dd&time_range[until]=yyyy-MM-dd

Find your Facebook Ads Account ID

Your Facebook Ads account ID must be included in your query. There are two places where you can find your Facebook Ads Account ID.

  • Navigate to your Facebook Business Manager page. Your Account ID is located on the homepage, under the Ad section. Copy the number after Account ID.

 

  • Navigate to your Facebook Ads Manager page. In the URL, copy the number after account_id=

Add new Facebook Ads users

To retrieve data from Facebook ads, you will need access to your company's Facebook Ads account. If you do not have access, follow these steps to add a new user:

  1. In the Facebook Ads manager page, on the left side menu, select Settings.
  2. On the Settings page, scroll down to Ad Account Roles.
  3. Click Add a person.
  4. You have added a new user to your Facebook Ads account.

Facebook Pixel

Facebook Ads is introducing Facebook Pixel for tracking conversions. To connect, make sure you have Facebook Pixel set up in your Facebook Ads account and that you have access to Facebook Pixel data.

Learn More