Happy Dashboarding

Using Facebook's Graph API Explorer to retrieve Insights data

Using Facebook's Graph API Explorer to retrieve Insights data

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.

Get your free guide!

Ready to start tracking your key marketing metrics? Get the 101 on KPIs in the Marketer's Guide to KPIs

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.


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:

And for the end date:

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

Get your free guide!

Ready to start tracking your key marketing metrics? Get the 101 on KPIs in the Marketer's Guide to KPIs

Conclusion: Why learning APIs is important

I'm going to 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 along with 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

How to Track Facebook Ads in Google Analytics