Klips: Connecting to Facebook Ads

 

If you want to create data sources for custom Klips, you're in the right place.

If you want to add pre-built Klips, see Pre-built Klips and the Klip Gallery and Klip Gallery: Facebook Ads.

If you're using PowerMetrics and want to create data sources for custom metrics, go here.

 

Visualize, discover, and act on your data with Klips and Klip dashboards.

Ready to get the most from your Facebook advertising data? Get started by setting up a connection between Klipfolio and your Facebook Ads data and adding some data sources.

When you're finished adding Facebook Ads data sources, you'll use them to power your custom Klips.

Note: To bring Facebook Ads data into Klipfolio you'll need access to a Facebook Ads account. See this Facebook Ads article to learn how: How do I add people to my Facebook Ads account?

This article includes:

Connecting to your Facebook Ads data

Here are a couple things to note about connecting Klipfolio to your Facebook Ads data:

Your data is safe with us. The first time you connect your Facebook Ads data to Klipfolio, you'll be prompted to sign in to Facebook and give permission to allow Klipfolio to securely access data within your Facebook Ads account. We are serious about protecting your data privacy.

Managing your connections. By default, your connection name looks like this: yourname@Facebook <date and time created>. You can modify the default connection name when you create a new connection or from your list of connections, accessed by clicking your Account Name (located at the bottom of the left navigation sidebar) and selecting Account > Connected Accounts or by clicking the button in the left navigation sidebar and selecting Connections.

You can use and reuse the same account connection every time you connect to Facebook Ads. If you have trouble accessing an existing connection, your OAuth token may have expired. If that happens to you, check out these troubleshooting tips.

How do I find my Facebook Ads Account ID?

If you choose to create a custom Facebook Ads data source, you may need to enter your Facebook Ads Account ID into a specific spot in the query.

To 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.

Adding a Facebook Ads pre-built data source

Our pre-built data sources focus on the most sought-after Facebook Ads data. Either use them as complete solutions or as starting points for custom building.

To add a Facebook Ads pre-built data source:

  1. Click the + beside Data Sources in the left navigation sidebar.

If you don’t see the option above, go to the bottom of the left navigation sidebar and click your Account Name > Data Sources > Create a New Data Source.

  1. On the Where is your data? page, select Facebook Ads.
  2. Select a pre-built data source from the left section of the Choose a pre-built or custom connection page.
  3. If this is your first time connecting to Facebook Ads:
    • Click Login with Facebook. Enter your Facebook login credentials and click Next. If prompted, click Allow Access to enable Klipfolio to securely access your Facebook Ads data. Click Continue.
  4. If you have connected with Facebook Ads before:
    • Select an existing connection (token) from the drop-down list and click Continue.
  5. On the Configure your data source page, select your Facebook Ads Account Name from the drop-down list, and then, if requested, select a Campaign.
  6. Click Get data or, if you want to modify the pre-built data request, click Switch to Custom settings.
    Note: If you switch back to the Basic settings page after making changes in the Custom settings page, your changes will not be saved.
  7. Ensure this is the data you’re looking for and, optionally, select the checkbox to Model your data. Learn more about modelling your data source. Note: Facebook Ads returns JSON formatted data. Learn how to model JSON data.
  8. Click Continue.
  9. Name, choose refresh settings, and, optionally, share your data source.
  10. Click Save.

If you clicked Switch to Custom settings:

  1. On the Configure your data source page, modify the Query URL to get the data you want. You can use the existing information in the Query URL text box as a base. It was auto-filled based on the pre-built data source you selected on the Choose a pre-built or custom connection page.
  2. Click Get data.
  3. Ensure this is the data you’re looking for and, optionally, select the checkbox to Model your data. Learn more about modelling your data source. Note: Facebook Ads returns JSON formatted data. Learn how to model JSON data.
  4. Click Continue.
  5. Name, choose refresh settings, and, optionally, share your data source.
  6. Click Save.

The data source is added to your account and is ready to use for custom Klips. You can see all your data sources in your Data Source Library, accessed by clicking Data Sources in the left navigation sidebar.

Adding a Facebook custom data source

Need a unique set of data? When our pre-built data sources don't include exactly what you're looking for, create your own custom data source. You can either use a pre-built data source query as a base or write your own queries from scratch.

To add a Facebook Ads custom data source:

  1. Click the + beside Data Sources in the left navigation sidebar.

If you don’t see the option above, go to the bottom of the left navigation sidebar and click your Account Name > Data Sources > Create a New Data Source.

  1. On the Where is your data? page, select Facebook Ads.
  2. On the Choose a pre-built or custom connection page, click Create a custom Facebook Ads data source.
  3. If this is your first time connecting to Facebook Ads:
    • Click Connect an account. Enter your Facebook login credentials and click Next. If prompted, click Allow Access to enable Klipfolio to securely access your Facebook Ads data. Click Continue.
  4. If you have connected with Facebook Ads before:
    • Select an existing connection (token) from the drop-down list and click Continue.
  5. On the Configure your data source page, adjust the Query URL information to replace any generic placeholder query information with your own. For example, replace <your-account-ID> with your own Facebook Ads Account ID.
  6. Edit the Query URL to return the data you need. Refer to the Facebook API documentation for details.
  7. Click Get data.
  8. Ensure this is the data you’re looking for and, optionally, select the checkbox to Model your dataLearn more about modelling your data source. Note: Facebook Ads returns JSON formatted data. Learn how to model JSON data.
  9. Click Continue.
  10. Name, choose refresh settings, and, optionally, share your data source.
  11. Click Save.

The data source is added to your account and is ready to use for custom Klips. You can see all your data sources in your Data Source Library, accessed by clicking Data Sources in the left navigation sidebar.

Custom building: About APIs and queries

Want to learn more about custom building? This section is for you. Klipfolio connects to hundreds of services in the cloud that have a REST API. If you take the time to learn your service’s API to create queries for the data you want, your possibilities are endless. Here’s a quick overview video on APIs and Klipfolio:

Klipfolio API's 101

If you need help using APIs, ask a data analyst or developer.

Use the Facebook API Explorer to build and test your Facebook Marketing API queries before you use them to bring data into Klipfolio.

Refer to the Facebook Ads API documentation to discover more data requests.

See the reference table below for API related information and sample queries.

API Documentation Facebook Ads API documentation
API Explorer Facebook API Explorer

To learn more, see Marketing API Best Practices.

Authentication Method

OAuth Token Authentication
Response Format JSON

API Limits and Notes

To learn about Facebook Ads API limits, see Marketing API Rate Limiting.

Date Format

Example date formats:

&date_preset=last_90_days

or

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

For your active campaigns:

https://graph.facebook.com/v20.0/act_<your-account-ID>/campaigns?fields=id,name,created_time,effective_status&effective_status=['ACTIVE']&limit=100

For your ads campaign placements:

https://graph.facebook.com/v20.0/<your-account-ID>/insights?time_range[since]={date.add(-93).format('yyyy-MM-dd')}&time_range[until]={date.today}&time_increment=1&fields=campaign_name,campaign_id,actions,spend,ctr,clicks,impressions,reach,cost_per_thruplay,video_thruplay_watched_actions,video_avg_time_watched_actions&breakdowns=publisher_platform&limit=100

Next steps

Great! You've connected to your Facebook Ads data and created one (or more) data sources. Now you're ready to use those data sources in custom Klips.

Want to learn more?

Check out these related articles:

Have more questions? Submit a request