IMPORTANT:
- You must be the owner or an administrator of the Facebook page, application or domain.
- Insights data is only available for properties you are an administrator for. There must also be AT LEAST 30 Likes for the page or Facebook object for Insights data to become available.
Usage
Before using the connector you must authenticate the connector with Facebook (by pressing the Authenticate button) as well as entering the id for the Facebook object you would like insights data for.
Insights Object Id
Often you will be interested in insights data for a Facebook fan page you are administrator to. To find the id (which you will need to enter into this connector) browse to the Facebook page you wish to access.
If the Facebook page has a 'vanity' URL like this:

The you should enter this value into the text box.
Otherwise it will probably look something more like the following, in which case you should enter the highlighted numeric identifier into QVSource:

It is also possible to enter the id of other Facebook object types in order to retrieve insights - if you are having trouble locating the ID of the Facebook object you are interested in please contact us.
Using the Connector
The first step is to click the 'Authenticate' button - this should lead through a short authentication process.

If you successfully authenticate you should see an access token has been saved into the connector.
Once you have done this, enter the id of an object which supported Facebook Insights (for example a Fan Page, Domain, Application, Post or even a Like button) and press the 'Connect' button.

You should then see a list of tables on the 'Connector Data' tab.
Please note - The list of tables you receive will depend on what type of Facebook object (e.g. Fan Page, domain, application, Like button etc.) you are accessing Insights data for and so may not be the same as the screen shots here.
See
here for more info on the various tables returned.

'Realtime' Tables
Version 1.0.11 of this connector or later only.
In April 2012
Faceboook announced that the following tables would be available in 'realtime' (meaning that they should be refreshed approximately every 15 minutes).
- page_storytellers
- post_stories
- post_storytellers
- post_stories_by_action_type
- post_storytellers_by_action_type
- post_impressions
- post_impressions_unique
- post_impressions_paid
- post_impressions_paid_unique
- post_impressions_organic
- post_impressions_organic_unique
- post_impressions_viral
- post_impressions_viral_unique
- post_impressions_by_story_type
- post_impressions_by_story_type_unique
- post_consumptions
- post_consumptions_unique
- post_consumptions_by_type
- post_consumptions_by_type_unique
- post_engaged_users
- post_negative_feedback
- post_negative_feedback_unique
- post_negative_feedback_by_type
- post_negative_feedback_by_type_unique
QVSource higlights these tables in the table listing by appending (Realtime) to the table name, as illustrated below:

The 'TableNames' table also has a new column which indicates which tables are realtime:

Sample Usage / Tutorial
Here is a simple guide on how to use the connector to pull out the like count for a domain you own. We'll use our own website,
http://www.QVSource.com which, at time of writing has a like count of 80:

PLEASE NOTE: The Facebook Insights web page has changed since this tutorial was written and may no longer match exactly the screen shots below.
First we go to
https://www.facebook.com/insights/ and locate the website we would like the insights data for. Once you select the website or domain (or other object type you are interested in) you are interested in you should be looking at a screen something like this:

With a URL something like this:
https://www.facebook.com/insights/?sk=wo_12345678987654321The part after the wo_ is the id you need to copy and enter into the QVSource Facebook Insights connector - in this case
12345678987654321 as shown below. Notice that we have also set the since date to a time before the website was created in order to capture as much data as possible.
Next we press the 'Connect' button.

And then move to the 'Connector Data' tab where we select the domain_widget_likes table:

We can then copy the QlikView load script:

And paste it into a new QlikView application:

We can now reload the QlikView application and create the following chart to show how our like count increased over time:

If you found this tutorial useful please consider liking us!
A note about end_time
The end_time seems to always be returned as midnight pacific time, e.g. something like this:
2011-12-01T08:00:00+0000This means the data you see in your QlikView reports might not match exactly what you see in the Facebook Insights interface. We are investigating a way to be able to set which time zone this end_time is configured to.
Caching
This connector should cache the data for 23 hours before rerequesting the same data from Facebook insights.
Demo Application
We have a demo application
here.
Change Log
1.0.11 - 07/05/2012
- Added ' (Realtime)' to the end of all table names which should support realtime (see https://developers.facebook.com/blog/post/2012/04/25/platform-updatesoperation-developer-love/).
- TableNames table now also highlights realtime tables.
- Added additional note to config UI reminding user that they must be an administrator of the Facebook object they would like insights for.
1.0.10 - 20/04/2012
- Better handling when Facebook returns empty attributes in json - these are now automatically replaced with 'EMPTY' and you may find this in your results.
1.0.9 - 12/04/2012
- Authentication procedure will now inform user if token has an expiry date and recommend that they set a note to remind them to reauthenticate with the connector before this time.
- Added CheckAccessToken table.
1.0.8 - 05/03/2012
- Minor performance improvements.
1.0.7 - 31/01/2012
- Minor tidy up for authentication code. expires_in parameter no longer erroneously part of token (although this was not causing any issues).
- Fixed tab order.
1.0.6 - 08/01/2012
- Fixed issue where ( and ) character were causing issue if they was part of an element name in the returned results.
- Minor change to contents logged when API call tracking is turned on.
1.0.5 - 21/12/2011
- Fixed issue where ` character was causing issue if it was part of an element name in the returned results.
- Added a more robust method of avoiding errors with the above type of character issue in element names.
1.0.4 - 14/12/2011
- Fixed issue where comma (,) and question mark (?) characters were sometimes causing issue if it was part of an element name in the returned results.
1.0.3 - 06/11/2011
- Can now enter post ids for posts made by pages authenticated user is admin to.
1.0.2 - 04/11/2011
- Added new 'TableNames' table to enumerate all the available tables from QlikView script.
- Added to 2 new expression based columns end_time_qvdatetime and end_time_qvdate.
- Fixed minor issue where some symbols were appearing in token form in results (e.g. a + was being returned as _plus_).
1.0.1 - 01/11/2011
- Issue where Facebook Insights data containing apostrophes was causing error should now be resolved.
1.0.0 - 15/11/2011
- IndustrialCodeBox_FacebookInsightsConnector now referred to as FacebookInsightsConnector in load script.
- First non beta release.
==API Status==
APIs are not error free or always 100% available. If you are having issues with the connector please first check that there are no problems at the API end point.
http://developers.facebook.com/live_status/
Also - if you are experiencing an issue with the connector (for example after it was previously working ok) you might also try searching on the
Facebook bug tracker for recent bugs which might explain the experience you are having. This will probably be the first place we will look after checking the
API status.