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.

55 responses to “Tableau Web Data Connector for Facebook

  1. Hi Sorendam,

    Did you need to prepare a specific “privacy rights” and a “terms and condition” document to get the approval to publish your WDC connector?

    We wanted to create something really similar but we don’t know if we need a simple pro-forma or something more accurate.

    Thank you in advance,
    T.

  2. Hi,
    Thank you for the connector.
    The insight connector works well (after finding the right roles).
    However, I cannot get to get the feed connector to work. I tried adding all roles, but even then, when connecting to tableau, the feed connector doesn’t pull any data.

    1. I haven’t updated it in a while as I am not using Tableau anymore, so it might not work with newer versions of Tableau and the current version of Facebook’s API

  3. Hi,
    How were you able to get the App review be approved through facebook? I constantly get rejected. I think it’s because it requires the reviewer to have installed Tableau to test the App.

    How did you go about that?

  4. Hi
    I used your code to host web data connector myself.
    when I add to tableau it connects to facebook and displays my page correctly. When I click on get Page feed it just sits on Processing Request. Any idea?

    Thanks,
    Vinanti

  5. Any insight on what videos to include when hosting it on my own domain since there will be no other users outside myself?

  6. Hey Soren,

    Any chance you could add the ‘Page Followers’ metric to the Page Insight WDC (if available)?
    I’m struggling to find that value beyond manually entering it from the insights page

    Thanks

  7. hi, thanks for the excellent WDC. Unfortunately, I have 12 fb pages, but I am unable to scroll down to the remaining 5 pages as there is no scroll bar in the page selection, so I can never click on ” Get data” and go into Tableau.
    Can you please advise? I am using Tableau 2019.3

    thanks a lot

  8. Hey sorem, I like the connector, but doesn’t get data from campaigns, in this case to get data from the facebook ads. Do you have others solutions for this case ? Thanks!

  9. These connectors are great! However, I’m running into an issue trying to refresh my data. I got both connections to work (using the original WDC) but when I try to refresh the extract all of me sheets go blank (as if there isn’t data anymore). The only way for me to get data updated is to go to the data source and edit the connection and go through all the above steps again. I also tried loading my workbook the my Tableau Server and scheduling an extract but still didn’t get any new data. (the extract refresh didn’t ‘fail’, but it didn’t actually get any new data). Is this a current bug or am I doing something wrong!?

    1. I was doing this in 2019.1 version of desktop. I just tried again in 2018.1 and the refresh worked. Does that mean something with the code must be updated?

      1. It turns out that Facebook has changed some stuff in the login…

        I suggest that you try the following on a copy of your workbook so you don’t destroy anything important:

        1. Go to Facebook and remove the app named ‘Tableau Web Data Connector’. This can be done here https://www.facebook.com/settings?tab=business_tools
        2. In Tableau click the arrow next to ‘Facebook page feed’ under connections and select ‘Edit Connection…’
        3. Login to Facebook and approve all the pages that you need to use in the connector. (This is new compared to how it used to be). Leave the default settings to yes (administrate your pages and access insights). Click okay. Select the pages that you want to obtain data from.

        Let me know if this solves the issue.

  10. I’m having a hard time having facebook grant me read_insights access to use your tool. The test app I made with facebook works like a charm so I’m stoked to use this. Anyone know what facebook want me to show to allow read_insights?

  11. Hi soren,
    Plz! seen me others sheet in your Facebook fanpage workbook. I was import Data source but I don’t understand that data source to build dashbroad…plz!!!

  12. Hey Soren,

    I’m trying to use your Web Data Connector but I keep having the following message when I try to login: You must be assigned a Page Role for at least one Facebook Page to use this connector.

    I am Admin of the Facebook Page I want to connect to. Any thoughts on what could be happening?

  13. Hi, thanks a lot for creating this. It is very helpful for coding noobs like me. Quick question – I was able to get the data but of the 6 pages I selected, I only got data for 1 page. Everytime the data changes, sometimes it shows for 2 pages, sometimes 3. How do I get data for all 6 pages? Is there a limit of no. of rows that can be returned. If yes, what do I need to change in the JS files to only get data 2017 onwards?
    I also tried to open insights on FB pages before loading data but faced the same issue. Please help. Thanks!

    1. I think this is solved if you use the latest version on GitHub. The issue you describe has been there in an earlier version. Also, you could try to use my connector instead of your own and see if that works.

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

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

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

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

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

  19. 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?

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

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

  22. 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!

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

  24. 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!

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

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

  27. 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 *