Monday, August 15, 2016

Embedding Tableau Public in a Web Page

From a thread in Linkedin's Tableau group and the included blog and viz, I found that people may not know how to correctly embed a Tableau Public viz in a web page. There are a few blog posts on embedding. But the Tableau Public has evolved and some new features are not covered. So here is my post.

Tableau Public may mean a couple of things:
- A free desktop software for visual data analysis.
- A website for hosting Tableau Public vizzes (dashboards/charts/storyboards).

Here we are going to summarize a number of ways by which one can embed a Tableau Public viz in a web page.

1.Pop-up

This is my favorite way to embed a viz.

For example, click this link. You will see a viz popping up. Close the viz, and you see this post again.

How to embed a Tableau Public viz like that?
- Go to the viz's Tableau Public page. Copy link by clicking the share button.
Use that URL link anywhere in your web page, such as hyperlinking some text or an image.

Then go the viz's home page and edit its details. Fill the URL link of your web page, as the Permalink of the viz. And save the change! Then you are done.
2.Embed code

In blogger.com/blogpost.com editor, turn on the HTML mode. Copy the embed code and paste it into your html source. Place it carefully where you intend it to be.

There are two options for getting the embed code.

Option 1
Go to and viz and you see the embed code by clicking the share button. The code is a bit long and messy. But you don't need to care about it.
Here is a glance of the embed code for your curiosity.

Option 2
You can insert this cleaner code into the html source. Note that the URL is from the share button. The height and width are from your Tableau dashboard canvas.

<iframe 
frameborder="0" 
height="400" 
width="575" 
scrolling="no" src="https://public.tableau.com/views/Tableau10TorchRelay_Embed/Tab10TorchRelay?:embed=yes">
</iframe>

Check out this for embed in Weebly and this for Wordpress. You may notice that the share button and the embed code format changed in the latest version of Tableau Public.

3.Hiding Buttons using Parameters

There are a few parameters in the Tableau Public URL you can use to control the appearance of the viz. I don't know all of them. But this one could be very useful if you want to hide the extra control buttons of the viz, such as download, share etc. Just attach "&:showVizHome=no" to the previous URL.

<iframe 
frameborder="0" 
height="400" 
width="575" 
scrolling="no" src="https://public.tableau.com/views/Tableau10TorchRelay_Embed/Tab10TorchRelay?:embed=yes&:showVizHome=no">
</iframe>

Here is the result where the lower part is hidden.
That's it!

10 comments:

  1. Do you have any idea after removing to tool bar how to give the option to create a PDF, download the data to CDC/excel etc. I need these features but cannot allow the "share" option to be visable

    ReplyDelete
    Replies
    1. In your case, the simple solution is still to show the tool bar. There is another solution based on Javascript API. Check it out http://russellchristopher.me/htdocs2/htdocs/index.html

      Delete
    2. Hi Alexander, Thank-you for your response. I have managed to remove the toolbar and then created some javascript to do a range of different things (pdf/filters etc) my new problem lies in the fact that I'm publishing through WordPress which strips out the javascript.

      Delete
    3. Could you try another blog platform? Would like to see your js in action.

      Delete
    4. I've put the code I am using on drop box in a text file. https://www.dropbox.com/s/ypmbriu8ozr9p4z/Tableau%20Javascript.txt?dl=0
      I am stuck with WordPress at present for the platform and the material contained is commercially sensitive, however I have changed the code to a point at a Tableau Public file - just imagine that the ToolBar is not there the buttons do the work (Toolbar cannot be hidden on Public Dashboards)

      Delete
    5. Tried your code. It works! I also tried download workbook button. It also works. Blogspot doesn't allow js either.

      Delete
    6. If you wish, I may ask someone to host the page for you.

      Delete
  2. Hi.. How can we embed tableau public in our lms (wordpress) so that students can learn to use it.. The challenge also is we dont want the students redirected or to open a new tab but work within the website.. Thank you

    ReplyDelete
  3. thank you SO MUCH!! I was beyond frustrated until I found this.

    ReplyDelete
  4. thank you so much. this is really helpful in showcasing my vizzes in my blogsite.

    ReplyDelete