I have been using the Facebook web data connector from tableaujunkie.com for a while. However, it is limited to only a couple of the insights you can get out of Facebook. Moreover, it was using a rather old version of Facebook’s API. So I decided to write my own versions of the Facebook Web Data Connectors for Tableau. The outcome is two connectors:

Facebook Page Insights Web Data Connector

This connector is meant to get the actual insights for the page. Each record is a date.

https://www.sorendam.com/tableau/facebook/page-insights-web-connect.html

Facebook Page Feed Web Data Connector

This is looking at the page feed data. Each record is a post on the page feed.

https://www.sorendam.com/tableau/facebook/page-feed-web-connect.html

How to use the connector

First, make sure you are using a recent version of Tableau as these scripts are using version 2 of the Web Data Connector. As far as I remember you need to have version 10.1 or above.

  • Open Tableau and select “Web Data Connector” from the menu.
  • Enter one of the URLs above

Tableau Facebook Web Data Connector Login

  • Go ahead and log in with your Facebook account. You need to have access to the insights of a page at a minimum. Furthermore, you need to accept that the app will get access to the relevant details.
  • Once this is done you should be able to see all the pages that you have access to

Tableau Facebook Web Data Connector - select pages

  • After selecting the pages you want to analyse press the “Get Page insights” button and you are ready to go.
  • Now you are ready to extract the data. Note that it can take quite a while to extract it. Go ahead and analyse. You should be able to something like this easily…

Compare page likes and page post impressions for two pages

Tableau Web Data Connector - Facebook Insights via API

Is there a relation between character count in a message/post and the number of impressions and likes it receives? It looks like it…

Tableau Facebook Character Count

Want to host this yourself?

That is possible as the code is available on GitHub. You will have to create a Facebook App with login permissions as well as permissions to read insights.

Changes you need to make in the files

You need to change the APP_ID and the BASEURL constants in the JavaScript files.

Facebook app setup

Under settings remember to add your App Domains and your website URL

Facebook App settings

Under Facebook Login make sure to set the “Valid OAuth redirect URIs” to match where you have placed the pages on your server

Facebook App login

Finally, you want to make sure that you can use the app.

Facebook Approved Items

I hope this has helped you analysing your Facebook data.

34 responses to “Tableau Web Data Connector for Facebook

  1. Hi Soren,

    Thanks for the connectors! I do have a issue through. When trying to extract my data with the ‘Page Insights Facebook Web Connector’ I literally get no statistics. The link and web connector work fine and I successfully have Facebook Page Insights as a connection as on Tableau, but when I try to drag a measure or dimension to a sheet I literally get nothing but a blank sheet. Do you know why the ‘Page Insights Facebook Web Connector’ isn’t working and how I can fix it?

    Thanks in advance.

    1. I have solved the issue. Apparently, Facebook no more wants me to take that much data at once (I was taking 90 days back for each request to the API). I have limited it to 30 days so now the connector will have to make three times as many requests to the API. That might make it a tiny bit slower to get the data from Facebook but else it should be the same.

  2. Hi Søren,

    Thanks for this! I have been exploring a few WDC of Facebook and the page feed WDC you created works best for me!

    Is it possible to get “reach” data (so organic, paid and viral) as well? I understand that you have “impressions” there but feel that it would be great if there is “reach” as well for comparison.

    Thanks.

  3. Hi Søren,
    I have noticed strange behaviour which started sometimes in January, namely, no Post Impression statistics show up in data feed anymore. Do you have any idea what might cause it?
    Thank you already in advance!
    Külli

  4. Hello there, great tool 🙂 i have tried with your set up and it works perfectly then i have set everything in Facebook + our own server…and at the end the connector is getting at least the list of fields in Tableau but i click refresh the data…still empty line. Looks like the connector is working but no data are coming back from Facebook…any clue

    1. You might have forgotten to change the Facebook APP_ID to you own. Else, you could take a look in the Tableau log file (Documents/My Tableau Repository/Logs/log.txt)

    1. Hi Liam,
      The way I did it was to download the simulator and look at the included examples. You can get it here http://tableau.github.io/webdataconnector/
      It is great for testing out if things are working the way they are supposed to. You also might want to take a look at the source code of some of the other free web data connectors around. You should be able to find these if you search on Google for web data connector tableau. Note, that there are different versions and that some of the examples might not work if you copy them directly into your test environment.

  5. Hi again Sorem,
    I have another query please. I managed the stats and analyse data for 4 Facebook pages. I successfully extracted all the available stats from 1 page, which was awesome. Thank you very much.
    I then tried to connect and extract stats from the other 3 pages. However, none of these show any results. I have removed and reconnected the connectors with my facebook account. I have also open the Insight tabs of all the pages.
    It just came back blank.
    Do you know why this is the case? Perhaps I missed something?
    Thanks in advance.
    Dalin

    1. I have experienced this as well. Try to see if you can make this work in a new workbook. It has solved that issue for me. Furthermore, make sure that you can get data from each page individually. Hope this helps.

  6. Hi Soren,
    My facebook account is disabled after I used the app.
    Need to secure then ask for photo and waiting……….
    Any solution for that ?

    1. Hi Joe,
      That sounds strange and I don’t think it is related to the app. The app only uses standard calls to Facebook’s API so there should be no violations of their terms in any ways as far as I know. Did you manage to get you Facebook account back again and did you figure out what caused them disabling it?

  7. Hi Soren, thank you so much for these two connectors. They are just what I needed.
    I have a question. I noticed that for both connectors, the metric Reach is not included. Do you have any plans to update the connectors to include Reach as well?
    Thanks, Dalin

    1. I currently don’t have any plans on updating the connector. However, I might do it if I need it myself.

  8. Hello Soren,

    May I know how to get rid of the ‘logged out’ problem? I cannot refresh the data after publishing to the server and i found that i have to login the web connector from time to time.

    Thanks,
    yriaf

  9. Hi Bjorn,

    Great work!!! I just tried the earliest create date is 2017, is it possible i get all the historical data. Thanks!

    1. I have seen this happen a couple of times. Try going to your insights on Facebook and browse a little around. Then try to connect again in Tableau and make sure to wait until it has fully loaded the data. That might help. Else, you could try to remove the app from your Facebook account and connect in a new Tableau document. Sometimes strange things happen with the API and Tableau.

      1. Thanks for your reply! I remember i stopped building the data extract. i rebuilt it and it works now!

  10. Hi, thanks a lot for that! For a test I selected only one page (from a list) and pressed the “Get insights” button. Now I would like to add more pages, but they are not visible in the list anymore, I can only see the one page I had selected first. I have repeated the process in new files, also after opening my insights tab of the other Facebook pages (if this is what the message means), but I can only see and select that first page. How can I extend the list to see (again) all the pages I have insights? Thanks in advance.

    1. Hi Ross,

      That’s strange. You could try removing the app from your Facebook account and then try again from Tableau. If that doesn’t solve the problem I have no idea what the issue is.

  11. Hi Bjorn!

    Thanks for the great tool! It seemed to be just what we needed – all the accounts connected just fine, but there was a strange issue in the end. It seems that connection is lost in some strange reason after a while – once I get to prepare some dashboards, then again, no visuals appear as apparently there’s no data behind all this. The only thing that seems to bring some kind of change is editing the connections, ie checking the accounts via connections and then updating the whole thing, but it’s not really a solution as after a while, connection is lost again. Do you have any idea what might be behind that? I’m talking about Page feed, not Post feed – this last one seems to work like a charm!

  12. What’s Up Soren,

    This is awesome thank you so much for creating this!

    My question is, I am currently only seeing facebook post data from about august 18th forward. the page I am conected to has been posting for many years. Do you have any idea why this may be and if I need to adjust something to get data for all of 2017?

    Thank so much,
    Tony

    1. Hi Tony,

      That’s strange. Can you see the data in Facebook’s native insight? Also, you might want to visit the native Facebook insight pages as doing so seems to solve some data issues temporarily. Once you have done so try the web data connnector again.

  13. Hey Soren! I’ve tried to reach out to you in a couple ways, but I’m in desperate need of some help. Your FB Page Feed WBC is exactly what I need, but whenever I use it, probably about 80% of the data comes back NULL. I’ve tried it on several different pages, and no matter what I do, a ton of the data is NULL. Any insight/advice/help you can provide? Thanks!

    1. This might be due to the retention policy on Facebook Insights. This is from https://developers.facebook.com/docs/graph-api/reference/v2.10/insights

      The Insights API only offers two years retention. Insights data older than two years is subject to removal.

      This does not mean that there are full two years of insights on all data. Some metrics might have only been introduced recently, etc,.

      I hope this answers your question. You might also want to inspect the same data in Facebook’s native Insights.

  14. Hey Soren,
    Great work on this. This may be a dumb question but what is the benefit of hosting your self vs. using the URL you provided.

    Thanks,
    Bjorn

    1. Hi Bjorn, you might want to host it yourself if you don’t trust me, my Facebook App or the script that is used to extract the data.

      1. Hey Soren,
        Thanks for the feedback do you have a twitter one as well and if not do you plan on making one 🙂

        Thanks again for the post!

Leave a Reply

Your email address will not be published. Required fields are marked *