How to Embed Tableau Dashboards

Recently Tableau Public switched their embed codes to use JavaScript instead of an iframe. This is arguably a better solution as iframes are old and stinky and no one wants to use them on their site. However, JavaScript is even more frought with errors in my experience.

So when I tried to embed a viz from Tableau Public recently I ended up with something that was 150px by 300px and didn’t even render. This is due to some conflicting JavaScript already running on my site that prevented it from running properly.

My options were to either try to debug the JavaScript error and fix it or just use the old iframe solution. Here is my answer. I hope this helps anyone else in the same boat as me and that one day we’ll find a more bullet proof solution. Cheers!

See the Pen Tableau Embed Link Generator by Ben Sullins (@bsullins) on CodePen.

  • Chadd Bennett

    We’ve run into a similar issue with WordPress rewriting the dimensions to 300x150px…darn frustrating!

    While still unresolved on our end, it seems to occur for when switching between the source and WYSIWYG visual views in the default TinyMCE editor.

    You’d think that with the ubiquity of WP, more folks would have the issue — It’s also been noted by the great folks at Open Dev Mekong in Cambodia: https://github.com/OpenDevelopmentMekong/wp-odm_theme/issues/503 — we’re mostly stock WP, except added some code that allows for printing embedded Tableau dashboards (swaps in the PNG)…