Tableau Public has been instrumental in helping me build an online portfolio of data visualisations over the last 2 years (since Jan 2017). I noticed recently that I was approaching 100 visualisations and thought it would be interesting to take a look at how I’ve interacted with the platform over the last couple of years and also how others have interacted with my visualisations over that time.
Fortunately, I had recently read Jeffrey Shaffer’s blog post on how to use the Tableau Public API and it turned out to be the perfect method for being able to answer my questions.
Jeff’s blog provides an excellent step-by-step guide on obtaining your Tableau Public data through the API and I follow those steps below along with some screenshots. I then give an overview of the fields I found useful to visualise and visualisation I created. Finally, I provide a template workbook that you can use to build your own custom Tableau Public explorer dashboard.
Create the API URL
Using the API is surprisingly simple; you paste a URL into a browser and all of your Tableau Public data magically appears on screen. There is a set format for the URL and to create yours, all you need to do is replace profile.name in the below link with your own profile name – this is the name you login to Tableau Public with and which you will also see in the browser URL once logged in.
For example, the API URL for myself is:
- count – specifies the number of visualisations you would like to fetch data for. I’ve set this to 100 as that’s how many visualisations I have on my profile. Josh notes that the API can time out if you go above 300, so if you have more than 300 visualisations on your profile then, first of all, congratulations! that’s pretty good going; secondly, you’ll need to make multiple API calls, and that’s where the second parameter comes in.
- index – this is the starting point for the count, so let’s say I have 200 visualisations and I want to extract the data in two batches of 100, the first call would end with: ?count=100&index=0 and the second call would end with: ?count=100&index=101.
Save JSON Data
Once you have your URL, paste it into a browser and hit return. After a few seconds, something similar to the below should appear on screen:
This is the JSON data that has been returned by the Tableau Public API.
To save the data, right click anywhere in the screen and select “Save As…” and give it a name, such as “your_name.json”:
Import to Tableau
As Tableau can read JSON files natively, we can open the JSON file directly in Tableau Desktop without any data prep required:
The JSON schema can have a hierarchy of levels; in the export there are two levels – one for the main data and one for Attributions. The Attributions level is deselected by default, so to import this we can collapse the hierarchy and then ensure the check boxes for both levels are checked (note, if you have not made any attributions on Tableau Public then you will not see this second level):
The familiar data preview screen then shows with all the fields that have been parsed out of the JSON file, a small sample of which are shown below:
You may notice something a bit odd about the two date fields in the above image. These need to be cleaned up with a calculation to turn them into proper dates, as do a couple of other fields. Thankfully, Jeff provides these calculations in his blog post and I’ve used the same date calculations.
I made a change to the Thumbnail calculation Jeff used to account for where workbooks have punctuation in the names. This was trial and error to some extent – when a thumbnail wasn’t loading I checked the name in the dashboard tab and tried updating the below calculation to capture that use case. Below is the Thumbnail calculation I used, which is also in the template workbook I link to at the end of this post:
[Workbook Repo Url] + "/" +
REGEXP_REPLACE([Default View Name],'.$',''),
Note that when a JSON file is imported into Tableau Desktop, Tableau automatically creates LOD calculations based on the raw measures. This is done because when Tableau flattens out the JSON data, it is possible that duplication of data could occur, so these LODs ensure the measures can be used while accurately representing the data at the schema level. You can read more about this on Tableau’s help page.
What Questions Can We Ask?
The JSON data returned from the API has over 50 fields, however, some of these are not so useful for analysis. Below are some of the fields I thought would be useful along with some examples of the questions they could help to answer:
View Count per Document
What is the total number of views across all visualisations?
Which visualisations have been viewed the most?
Size per Document
What are the sizes of the visualisations and their associated data?
Date First Published
What is the frequency of publishing visualisations to Tableau Public?
How long have I been using Tableau Public?
Number Of Favorites per Document
Which visualisations have attracted the most interest?
Title and Description
Searching these text fields for hashtags, we could ask: How many visualisations have been made for Tableau community projects such as #MakeoverMonday or #WorkoutWednesday etc. I’m now in the habit of adding these hashtags in Tableau Public when I upload a visualisation, so this will work for me, but it won’t work for you unless you are also adding these tags.
We can use the Attribution part of the JSON schema, with fields such as “Author Display Name“, to ask: Who has inspired my visualisations?
Workbook Repo Url
The URL calculations that Jeff created based on this field can be used to show a preview image of a visualisation and provide a link to the workbook on Tableau Public
Below is an image of the dashboard I created to explore my Tableau Public data.
Click here to load the interactive version on Tableau Public.
The below video shows some of the interaction features, such as pop-up windows (using the new Show/Hide Container functionality in version 2019.2) to change filters and configuration, loading interactive visualisations either within the dashboard or externally in Tableau Public and switching the method used to size the circles on the main chart, either by number of views or number of favourites.
Create Your Own Tableau Public Dashboard
If you’d like to build your own version of this Tableau API dashboard, simply download the template from this link. Note, to use this template you will need Tableau version 2019.2 as the workbook makes use of Show/Hide Containers and parameter actions, which are new to that release.
Once you’ve downloaded the template workbook:
- Follow the steps at the start of this blog to download your API data in JSON format
- Add a new data source in the dashboard and connect to the JSON file.
- Finally, replace the existing data source (“marc-reid”) with your own JSON data source you just added
The screenshots below show the steps to replace a data source:
If you’re interested in learning more about and/or adding additional popup windows or parameter actions in your dashboard, take a look at my other blog posts on these topics: