Project

General

Profile

Actions

Feature #11447

closed

Tableau Embeds on Academic Commons Sites

Added by Michelle McSweeney over 5 years ago. Updated over 5 years ago.

Status:
Resolved
Priority name:
Normal
Assignee:
Category name:
WordPress - Media
Target version:
Start date:
2019-05-11
Due date:
% Done:

0%

Estimated time:
Deployment actions:

Description

Hi,
I'm teaching a class using Tableau this summer and fall. I'd like students to display their work on sites on the Commons, but there is a problem with embedding Tableau visualizations.
This is the current behavior: https://dhum73000.commons.gc.cuny.edu/blog-1/
This is the desired behavior: https://michellejm.github.io/dataviz_sample/blogpost1.html

There's a discussion here that suggests that wordpress.com limits the amount of code that can be embedded in a wordpress.com site. https://community.tableau.com/thread/289827

I see on the Commons that there are embed blocks pre-loaded for other media types and was wondering if creating a pre-structured embed may be possible for Tableau visualizations or if we can find another solution.
Thank you!
Best,
Michelle


Files

tableau-share-url.gif (57.4 KB) tableau-share-url.gif Raymond Hoh, 2019-05-13 04:52 PM

Related issues

Related to CUNY Academic Commons - Support #9207: display dashboards made in Tableau?AbandonedBoone Gorges2018-02-13

Actions
Actions #1

Updated by Matt Gold over 5 years ago

  • Status changed from New to Assigned
  • Assignee set to Boone Gorges

Hi Boone -- this is for the MS program in data analysis and visualization at the GC

Actions #2

Updated by Boone Gorges over 5 years ago

  • Status changed from Assigned to Reporter Feedback

Hi Michelle - It doesn't look like this is a problem with embed size, but instead it looks like the user embedded the content by pasting some embed code from Tableau that is not compatible with the Commons. Specifically, we don't allow users to enter

<script>
tags, for security reasons.

Could you provide more info about how the embedding process works? After a student creates content in Tableau, what comes next? Does Tableau provide some code for copy-and-paste? If so, what is it? Can you share a link to a Tableau project that shows this embed code?

It may be necessary for us to create a shortcode for embedding Tableau items, but I'll understand better once I've seen how Tableau embedding works.

Actions #3

Updated by Michelle McSweeney over 5 years ago

Hi Boone,

Thank you so much! This is the script that has to be copied from tableau:

<div class='tableauPlaceholder' id='viz1557762602028' style='position: relative'>
<noscript>
<a href='#'><img alt=' ' src='https://public.tableau.com/static/images/sh/shootings_1/Sheet1/1_rss.png' style='border: none' /></a>
</noscript>
<object class='tableauViz' style='display:none;'><param name='host_url' value='https%3A%2F%2Fpublic.tableau.com%2F' /> <param name='embed_code_version' value='3' /> <param name='site_root' value='' /><param name='name' value='shootings_1/Sheet1' /><param name='tabs' value='no' /><param name='toolbar' value='yes' /><param name='static_image' value='https://public.tableau.com/static/images/sh/shootings_1/Sheet1/1.png' /> <param name='animate_transition' value='yes' /><param name='display_static_image' value='yes' /><param name='display_spinner' value='yes' /><param name='display_overlay' value='yes' /><param name='display_count' value='yes' />
</object>
</div>
<script type='text/javascript'> var divElement = document.getElementById('viz1557762602028'); var vizElement = divElement.getElementsByTagName('object')[0]; vizElement.style.width='100%';vizElement.style.height=(divElement.offsetWidth*0.75)+'px'; var scriptElement = document.createElement('script'); scriptElement.src = 'https://public.tableau.com/javascripts/api/viz_v1.js'; vizElement.parentNode.insertBefore(scriptElement, vizElement);
</script>

Actions #4

Updated by Boone Gorges over 5 years ago

  • Related to Support #9207: display dashboards made in Tableau? added
Actions #5

Updated by Boone Gorges over 5 years ago

Thanks, Michelle. It looks like it's going to be a challenge to build an embed code for this, because there are many different dynamic values. Is there a public URL where I can view the Tableau interface that shows this embed code?

I see that there's at least one publicly-available WP plugin that promises Tableau embeds, but I'll need a sample to test with. https://wordpress.org/plugins/simple-tableau-viz/

Actions #6

Updated by Michelle McSweeney over 5 years ago

I think you can use this one - I have the maximum free setting on it:
https://public.tableau.com/profile/michelle.mcsweeney5354#!/vizhome/shootings_1/Sheet1

At the bottom right hand corner is a 'share' icon (3 circles connected by 2 lines). It'll give you the option to copy the code block above (or you can use the code block above)

thank you again!!

Actions #7

Updated by Raymond Hoh over 5 years ago

Boone, you can kind of parse the values if you have the Tableau share URL and if you set the display_static_image parameter to no, so you wouldn't need the static_image parameter.

The only parameter we'd need to set is name, which is parseable.

Here's a simplified embed code that would work:

<div class='tableauPlaceholder' id='CAN_BE_ANYTHING' style='position: relative'>
<object class='tableauViz' style='display:none;'><param name='host_url' value='https%3A%2F%2Fpublic.tableau.com%2F' /> <param name='embed_code_version' value='3' /> <param name='site_root' value='' /><param name='name' value='shootings_1/Sheet1' /><param name='tabs' value='no' /><param name='toolbar' value='yes' /><param name='animate_transition' value='yes' /><param name='display_static_image' value='no' /><param name='display_spinner' value='yes' /><param name='display_overlay' value='no' /><param name='display_count' value='yes' />
</object>
</div>
<script type='text/javascript'> var divElement = document.getElementById('CAN_BE_ANYTHING'); var vizElement = divElement.getElementsByTagName('object')[0]; vizElement.style.width='100%';vizElement.style.height=(divElement.offsetWidth*0.75)+'px'; var scriptElement = document.createElement('script'); scriptElement.src = 'https://public.tableau.com/javascripts/api/viz_v1.js'; vizElement.parentNode.insertBefore(scriptElement, vizElement);
</script>

Requires javascript though.

The share URL for Michelle's example is: https://public.tableau.com/views/shootings_1/Sheet1?:embed=y&:display_count=yes

Actions #8

Updated by Boone Gorges over 5 years ago

  • Assignee changed from Boone Gorges to Raymond Hoh
  • Target version set to 1.15.2

Ah, I guess you're right, Ray. The "requires JavaScript" part of this is that we're no longer providing a static image for noscript. If we had a custom shortcode, we could potentially have our own custom noscript which would instead be a simple link "View original on tableau.com".

Ray, could you have a go at this shortcode?

Actions #9

Updated by Raymond Hoh over 5 years ago

Done. This will be available after tomorrow's maintenance release.

To embed, copy the Tableau share URL as per the following GIF:

And then:

  • For the Block Editor, select the "Shortcode" block and input the following:
[embed]PASTE TABLEAU SHARE URL HERE[/embed]
  • For the Classic Editor, simply paste the Tableau share URL on its own line.

(Code reference - https://github.com/cuny-academic-commons/cac/commit/30941853d341fbe04db638294ff107f5fcfa079d)

Actions #10

Updated by Raymond Hoh over 5 years ago

  • Target version changed from 1.15.2 to 1.15.1
Actions #11

Updated by Boone Gorges over 5 years ago

Awesome! Thanks, Ray.

Actions #12

Updated by Michelle McSweeney over 5 years ago

Thank you all so very much!! I can't wait to try it out!
Best,
Michelle

Actions #13

Updated by Boone Gorges over 5 years ago

  • Status changed from Staged for Production Release to Resolved
Actions

Also available in: Atom PDF