Embed Outputs in Web Pages

From Displayr
Jump to: navigation, search

You can embed Displayr outputs, tables, and charts in any web page on the Internet.


The embed code for the table below is <iframe class="displayr-embed" src="https://embedded.azureedge.net/66578/203130/545cc57d-f39a-498c-addd-bd5a2f01dd10.html?v=34394615382216" width="817.08" height="144.19" frameborder="0"></iframe>

You can use this embed code to test out the embedding functionality in your own web page.

Instructions for embedding a table in a web page

Get the HTML embed code

  1. Create the output in Displayr.
  2. Click on the output, then click Export > Selection > Embed > Embed.
  3. You will be instructed that a snapshot of your dashboard needs to be taken. Click Snapshot and View.
  4. The embed code will be generated. This may take up to a minute as a snapshot of your dashboard is performed.
  5. The embed code and a preview of the embedded table is shown as in the screenshot below.
  6. Select the embed code and copy it (CTRL+C on a PC).

Dashboard Embed Preview.PNG

Insert the HTML embed code

Inserting into a web page

  1. If using a blog or other visual web page editor, switch to HTML mode. You should see your web page text surrounded by HTML tags such as <p>, <div>, etc.
  2. Paste the embed code into the editor.
  3. Save your web page.
  4. View your web page again. You may need to reload your web browser to see the changes (CTRL+R or CTRL+F5 in most web browsers).

Inserting into a MediaWiki

  1. Edit your wiki page.
  2. Type <html>
  3. Paste the embed code afterwards.
  4. Then type </html> afterwards.

Note that this will only work if your MediaWiki software has the $wgAllowUserJs setting set to true. You should not turn this setting on if you have a public wiki, because it is a big security risk. It should only be turned on for private wikis where you trust the authors and prevent public editing.

Updating of embedded outputs

If any R Outputs change due to changes in data or settings (other than resizing), you need to press Export > Embed > Update All for these changes to flow through to the web pages where the output has been updated. However, this can take up to 24 hours for the updates to flow through to end users. If you instead repeat the embedding process, it will occur instantly.

Changes to the size of an R Output will not update when you re-publish. If you have changed the size of outputs, you need to embed them again, as the size is contained in the source code that you paste into your web or blog post page.

Search Engine Optimization (SEO) concerns

The content of embedded tables, charts and text boxes is included in Google search results.

In late 2014 an experiment was conducted where a blog (http://embeddingtests.blogspot.com/) was created with several embedded items. It found:

  1. Upon Google's initial crawl of the web page, only text was captured. Embedded content was not included in search results.
  2. At a later stage (between 3-7 days), the embedded content was captured and included in search results.

This can still be confirmed today by searching for a word that is only included in the embedded table, such as "Less than 18": https://www.google.com/#q=site:embeddingtests.blogspot.com+%22Less+than+18%22