Tableau Public has been instrumental in helping me build an online portfolio of data visualisations since I started using the product in early 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'due south weblog mail service on how to use the Tableau Public API and it turned out to be the perfect method for beingness able to reply my questions.

Jeff'southward blog provides an fantabulous step-by-step guide on obtaining your Tableau Public information through the API and I follow those steps below along with some screenshots.  I then give an overview of the fields I institute useful to visualise and visualisation I created. Finally, I provide a template workbook that y'all can employ to build your ain custom Tableau Public explorer dashboard.

Create the API URL

Using the API is surprisingly elementary; you paste a URL into a browser and all of your Tableau Public data magically appears on screen.   There is a fix format for the URL and to create yours, all yous need to practice is supersede profile.name in the beneath link with your own profile name – this is the proper name you login to Tableau Public with and which you will also encounter in the browser URL once logged in.

https://public.tableau.com/contour/api/profile.proper name/workbooks?count=100&index=0

For case, the API URL for myself is:

https://public.tableau.com/profile/api/marc.reid/workbooks?count=100&index=0

In that location are two parameters at the end of the URL: count and index. I learned more than near these from Josh Tapley'south weblog post in relation to his great work on the Cerebro Project. In summary:

  • count – specifies the number of visualisations yous would like to fetch data for. I've set this to 100 as that'south how many visualisations I take on my profile. Josh notes that the API can fourth dimension out if you go in a higher place 300, then if you have more than 300 visualisations on your contour then, first of all, congratulations! that'southward pretty good going; secondly, you lot'll need to make multiple API calls, and that'south where the second parameter comes in.
  • index – this is the starting indicate for the count, so let'due south say I have 200 visualisations and I want to extract the information in two batches of 100, the kickoff phone call would end with: ?count=100&index=0 and the second call would end with: ?count=100&index=101.

Save JSON Data

One time you accept your URL, paste information technology into a browser and striking return. After a few seconds, something similar to the below should appear on screen:

This is the JSON information that has been returned past the Tableau Public API.

To save the data, right click anywhere in the screen and select "Save As…" and give it a proper noun, such as "your_name.json":

Import to Tableau

As Tableau can read JSON files natively, we tin can open the JSON file directly in Tableau Desktop without any data prep required:

The JSON schema tin can have a hierarchy of levels; in the consign there are 2 levels – one for the primary data and one for Attributions.  The Attributions level is deselected by default, so to import this we can plummet the hierarchy and and then ensure the cheque boxes for both levels are checked (note, if y'all have not made whatever attributions on Tableau Public and then you will not see this 2nd level):

The familiar data preview screen then shows with all the fields that have been parsed out of the JSON file, a pocket-sized sample of which are shown beneath:

You may find something a bit odd virtually the 2 date fields in the above image.  These need to be cleaned up with a adding to turn them into proper dates, equally do a couple of other fields.  Thankfully, Jeff provides these calculations in his web log mail service and I've used the same appointment 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 instance. Beneath is the Thumbnail calculation I used, which is also in the template workbook I link to at the end of this post:

"https://public.tableau.com/thumb/views/" +
[Workbook Repo Url] + "/" +
REPLACE(
REGEXP_REPLACE(
REGEXP_REPLACE([Default View Name],'.$',''),
'[^-a-zA-Z0-9~]+','')
,"|","")

Note that when a JSON file is imported into Tableau Desktop, Tableau automatically creates LOD calculations based on the raw measures.  This is washed because when Tableau flattens out the JSON data, information technology 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 folio.

What Questions Can We Ask?

The JSON data returned from the API has over 50 fields, however, some of these are not and then useful for analysis.  Below are some of the fields I thought would exist useful along with some examples of the questions they could help to answer:

View Count per Certificate
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 information?

Date Outset 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 involvement?

Championship and Description
Searching these text fields for hashtags, we could enquire: How many visualisations accept been made for Tableau customs projects such every bit #MakeoverMonday or #WorkoutWednesday etc. I'm now in the addiction of adding these hashtags in Tableau Public when I upload a visualisation, so this will piece of work for me, but it won't piece of work for you unless yous are also adding these tags.

Attributions
Nosotros can use the Attribution part of the JSON schema, with fields such equally "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 prototype of a visualisation and provide a link to the workbook on Tableau Public

Final Visualisation

Below is an image of the dashboard I created to explore my Tableau Public data.

Click hither 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/Hibernate Container functionality in version 2019.2) to alter 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 nautical chart, either by number of views or number of favourites.

Create Your Own Tableau Public Dashboard

If yous'd like to build your ain version of this Tableau API dashboard, but download the template from this link. Note, to use this template yous volition need Tableau version 2019.2 as the workbook makes employ of Show/Hide Containers and parameter actions, which are new to that release.

In one case you lot've downloaded the template workbook:

  • Follow the steps at the outset of this web log to download your API data in JSON format
  • Add a new data source in the dashboard and connect to the JSON file.
  • Finally, supplant the existing data source ("marc-reid") with your own JSON data source you just added

The screenshots beneath show the steps to replace a data source:

If you're interested in learning more nigh and/or adding additional popup windows or parameter actions in your dashboard, take a look at my other blog posts on these topics:

https://datavis.blog/2019/03/17/popup-charts/

https://datavis.blog/2019/03/ten/testify-hide-containers/

https://datavis.blog/2019/04/16/tableau-parameter-deportment/

Thanks!
Marc