Tablueprints is a series where I share how to make my Tableau data visualizations. If you would like updates on future posts, be sure to subscribe. I will only email when I have something new to share and I will not share your email with anyone.
In this installment, I share:
– The making of a Tableau Public visualization view tracker
– How to use import.io to scrape Tableau Public view counts from the web
– How to make a progress to goal gauge in Tableau
– How to make capped bar charts in Tableau
– How to use Tableau URL dashboard actions
For more information about the visualization featured in this installment, see My Tableau Public Viz Views before reading further.
How to use import.io to scrape Tableau Public view counts from the web
While Tableau Public provides the view count of each visualization on profile pages, it does not provide the total view count of all the visualizations combined. It also does not provide an easy way to visually compare the view performance of visualizations to each other (i.e. as a bar chart). For these reasons, I wanted to create a mobile “app” where I could quickly see view counts across my Tableau Public portfolio and provide a table of contents of sorts that allows the end user to click through to view any of my visualizations.
The answer to consolidating the view count data into an easy to use data source for Tableau was import.io. import.io allows you to scrape data from a webpage and provides up to 500 queries per month for free!
To get started, sign up for an account at import.io. Once you’re in, navigate to your dashboard and set up a new extractor (the big button in the top left corner of the page). You will be asked to enter the URL for the page that you want to scrape data from; in this case, it’s the location of my Tableau Public profile page.
After a few seconds, import.io will take a guess at the type of data you’re wanting to scrape and provide a table of that data. This is usually not quite the format of the data that I want to use, so I opt to click the “Clear Table” button to start over. This takes you back to the webpage so you can tell import.io which columns to pull in. For the first column, I will pull in the visualization titles by simply clicking on them from my Tableau Public profile page.
To add the view counts for each visualization, I will click to the “Add column” button towards the top-right corner, and click on the view counts.
Click done and you will be taken back to the dashboard view. Now that you’ve set up the extractor, click “Run URLs” and your data source will be generated! After the extractor has run, you can either download the CSV so you can start working with the data right away, or click the Integrate tab to see how you can send the data to other places, such as a Google Sheets file.
How to make a progress to goal gauge in Tableau
After getting the view counts for all my Tableau Public visualizations into one data source, I was ready to start building the tracker. One of the inspirations behind putting this together was that I wanted to track my personal goal of hitting one million total views across my portfolio. To visualize this, I created a progress to goal gauge as one of the main components of my tracker:
There are at least three ways to create this gauge that I can think of:
- Make a calculated field that computes the goal minus the total view count, and put the total view count and the newly created calculated field into a stacked bar chart.
- Create a bar chart for total view count, then add a constant reference line at 1,000,000.
- Create a calculated field for the 1,000,000 view goal, then make a dual axis bar chart with view goal and total view count.
For maximum formatting flexibility, I chose to go with the third approach. Here are the steps:
- Create a calculated field that equals MIN(1000000); you can replace one million with your own goal.
- Put SUM([Views]) and the newly-created calculated field for goal onto the Columns Shelf.
- Click the second pill on the Columns Shelf and choose “Dual Axis”.
- Synchronize the axes by right clicking on either axis and choosing “Synchronize Axis”.
- Change the mark type for both marks to bar and make sure the total view count bar is in front of the goal bar.
This approach works because the two bars are laying on top of each other; this means that the portion of the goal bar that can be seen is the remaining views required to reach goal. I also like this approach because I can format the label and colors for each bar independently of each other.
How to make capped bar charts in Tableau
I recently came across some bar chart design inspiration from a video advertisement for Google Data Studio. In the bar chart, the ends of the bars had a defined, bold cap. This makes a simple bar chart more engaging, and the caps can serve as an additional reference point (such as a goal). I thought my viz view tracker was a perfect place to apply capped bar charts because I’ve always had an unofficial goal of reaching 10,000 views per viz. This chart type allowed me to view the total view count and whether the 10k goal was met for each respective visualization.
The secret sauce to capped bar charts are that the caps are Gantt bars on a dual axis. To create the caps, make a calculated field for the size of the caps. It is critical that you add a negative sign before the number so that the cap goes the correct direction. In my case, the goal for each bar is 10,000, so I will make a calculated field that looks like this:
Now I will create a horizontal bar chart as usual by placing the Viz dimension on the Rows Shelf and SUM([Views]) on the Columns Shelf. I’ve also sorted the vizzes by views in descending order.
Next, put SUM([Views]) on the Columns Shelf a second time, make the chart dual-axis by clicking on the second occurrence of Views and choosing “Dual Axis”, and synchronize the axes by right clicking on either axis and choosing “Synchronize Axis”.
At this point, we have a dual-axis dot plot, with the circles for both axes laying right on top of each other. To convert this into a capped bar chart, change the mark type for one of the axes to Bar, and the mark type for the remaining axis to Gantt Bar. I suggest clicking the Color Marks Card for the bar marks (leaving the Gantt marks as is) and reducing the opacity of the marks to about 65%.
Lastly, navigate to the Marks Cards for the Gantt Bar marks and place the Cap Size calculated field onto the Size Marks Card.
From here, you can hide the axes and add borders to clean up the capped bar chart. For best results, fix the axes to start at 0 so that you don’t see any negative values. I chose to use 10,000 as the cap size, but experiment with the cap size and width of the view to get the look and functionality that work best for you.
How to use Tableau URL dashboard actions
Another objective of this dashboard was to provide a means for myself and other end users to click through to view any of the visualizations. The import.io scrape did not include the share URLs for each dashboard, so I set up a one-time lookup table to bring this data into the view tracker. To create the lookup table, I set up a second tab in my data source that had Viz in one column and each respective share URL in another column.
Since the two tabs in my data source had the “Viz” field in common, I could do a simple join on Viz to bring in the URL for each visualization.
With my joined data source put together, I was ready to set up the links. The first step was to add the Link dimension to the Detail Marks Card on my capped bar chart. This step ensures that Tableau can access the URLs for each visualization.
Next, I added the capped bar chart to a dashboard so that I could add a dashboard action.
To add the dashboard action, navigate to Dashboard > Action (from within the dashboard you are adding the action to). After the dialog box opens, click the Add Action button in the bottom left corner and choose “URL…”.
I wanted Tableau Public to open each visualization when the respective bars were clicked, so I chose to run the dashboard action on “Select”. You also have to click the arrow to the right of the blank URL box in order to bring in the Link dimension. Here’s how the logic for my URL dashboard action was set up:
The <> brackets around the link dimension tell you that the link is dynamic, and will be based on the bar that is clicked.
That’s it! Make sure you test the links by clicking on some of the bars, but that’s all it takes to set up a Tableau Public viz view tracker and portfolio navigation.
Thanks for reading,