Using Facebook's Graph API Explorer to retrieve Insights data

Published 2014-04-11, updated 2023-02-22

klipfolio image

Summary - Quickly learn how to use Facebook's Graph API Explorer to retrieve Insights data from your page. Check out this step-by-step tutorial, designed for beginners.

A few years ago, the mere mention of the term "API" would send most marketers running to their development team. These days APIs are an accepted part of the marketing vocabulary and a sought after skill, especially amongst the growth hacking crowd. But why are APIs so popular?

The answer is that knowledge of APIs provides unparalleled access to the web services you use on a daily basis. For developers, this means creating applications that seamlessly integrate with services such as Facebook. For marketers, a basic knowledge of APIs can open doorways to growth hacking tactics, like the one AirBNB used to grow their business, or grant access to data and insights from your online marketing campaigns, like we're going to do in this tutorial.

Tutorial: Using Facebook's Graph API Explorer to retrieve Page Insights data

In this tutorial, we're going to use Facebook's Graph API Explorer to retrieve Insights from Facebook pages you manage. In the world of APIs, an "API Explorer" is an interface that helps you craft a request URL. This URL is a like a command line that tells Facebook to do something on your behalf. For instance, performing a GET request to pull data from your Facebook profile.

I recommend that you open the Graph API Explorer in another window so you can follow along.



Step1 Navigate Graph API Explorer

Step 1: Navigate to Facebook Developer Website

Navigate to

By default, your profile name and profile ID will be displayed in the explorer panel.

Step2 Select Insights Permission

Step 2: Set up your Access Token

You will need to create an Access Token with "read_insights" permission associated with it.

  1. Click the Get Access Token button.
  2. Under Extended Permissions, select Read Insights.
  3. When complete, click the Get Access Token button when complete.
Step3 View Profile Information

Step 3: Using the explorer panel

The explorer panel allows you see different items associated with your Facebook account. By default, you will see your profile ID. When an item is selected from the panel, the panel will update to show information about child elements and it will update the request URL.

  1. Select your profile ID. It is a clickable link within the explorer panel.

The Request URL is updated.

Step4 View Page Information

Step 4: Viewing Page information

You can access information on any Facebook Page for which you are a manager. To do this, type the name of your Page in the URL field. For instance, our Facebook Page is so we'd type /Klipfolio.

  1. Type the name of your Facebook Page into the URL request field.
  2. Click the Submit button.
Step5 View Page Insights
Level up data-driven decision making

Make metric analysis easy for everyone.

Get PowerMetrics Free

Step 5: Viewing Page Insights

You can access Page Insights by typing /insights after the name of your page in the URL field. This command will retrieve all of the Insights associated with your Page.

  1. Type "/insights" after your company name.
  2. Click the Submit button.
Step6 View Select Page Insights

Step 6: Viewing specific Insights

The basic "/insights" command will pull a large data file which contains every insight about your Page. In most cases, it's preferable to request a single Insight, such as "Unique page fan adds."

  1. Scroll through the explorer panel to locate the Insight you want to retrieve.
  2. Click on the "id" of that Insight.
Step7 Use Facebook Query

Step 7: Putting the query to use

The request URL is now set to retrieve a very specific insights. If you're a Klipfolio user, you can grab this query to create a data visualization (we'll show you how below).


Next steps: Integrated and automated with Klipfolio

If you completed the steps above, you will have a request URL that can be used to retrieve a specific Page Insights, such as the number of fan adds per day. In fact, as long as you have a way to authenticate using OAuth, you can use this request URL in other 3rd party services. What's important about the integration with Klipfolio is that your authentication credentials will be passed automatically with your request URL.

The other benefit of using this request URL in Klipfolio is that the data source will automatically refresh. This means that any visualizations using this data will always display the most current data from Facebook. Very handy if you're building a real-time social media dashboard.

Check out our documentation: Using Facebook as a data source

Modifying the request URL in Klipfolio

By default, many request URLs will only retrieve data for a set or limited period of time. For example, the daily fan adds request will retrieve data for the past 3 days. When it comes to building a visualization, it's helpful to have a bit more data over a well-defined time period. Within Klipfolio, you have the ability to modify the request URL to retrieve data over a period of time of your choosing. Here's a quick overview of how to works.

Adding date parameters to the request URL

Let's say this is your URL:

You can change the time period by adding query parameters to the URL. Typically, query parameters are specified after a "?"

The specific parameters you can use will look like this. For the start date:{date.last30Days}

And for the end date:{date.last30Days}&until={}

Now when you use this request URL, you will retrieve metrics for the past 30 days up to and including today's date.

For more information, check out this article: Using date range parameters

Conclusion: Why learning APIs is important

I'm going to be honest: learning APIs is heavy stuff. But it's well worth it in the end. This article tackles using APIs in social media analytics, although this barely scratches the surface of what you can do with APIs.

A powerful example is the ability to integrate and mashup data from multiple services in one place. For instance, pulling together Google Analytics data, Twitter data, email marketing data, and Facebook Insights to uncover deeper relationships between marketing campaigns. Learn how Klipfolio turns your data into insight.

Also see:

The marketer's guide to APIs

What are some good KPIs in Facebook?

The top 13 KPIs for social media managers

Guide to Facebook Analytics

Related Articles

Level up data-driven decision makingMake metric analysis easy for everyone.Get PowerMetrics Free