Embed Code for Custom Views

The embed code for Tableau Server 2022.3 and later and Tableau Cloud has changed to use the Embedding API v3. For current information on embedding custom views, see Embed Custom Views in the Embedding API help. The information in this topic is for prior versions of embedding (using the Tableau JavaScript API v1 and v2).

Embed custom views using prior versions of embedding

When you embed a custom view of a workbook or sheet, the default view is determined by these factors:

  • If the embed code URL specifically refers to a custom view, that view is displayed by default.
  • If the embed code URL does not refer to a custom view, the Default custom view is displayed by default.
  • If no Default custom view has been defined, the original view is displayed by default.

Note: To ensure the original view will be displayed by default in an embedded view, make sure the embed code URL for the name parameter does not explicitly refer to a custom view, and include the following filter parameter in the embed code: <param name='filter' value=':original_view=yes'/>.

In the following example, the embed code will always display the original view of the Profit Analysis sheet in the Profit Analysis workbook, because the filter parameter is set to :original_yes, and the name parameter does not refer to a specific custom view in the URL for the sheet.

<script type='text/javascript' src='http://mysite.myserver.com/javascripts/api/viz_v1.js'></script>
  <div class='tableauPlaceholder' style='width: 1496px; height: 749px;'>
  <object class='tableauViz' width='1496' height='749' style='display:none;'>
  <param name='host_url' value='http://mysite.myserver.com' />
  <param name='site_root' value='' />
  <param name='name' value='ProfitAnalysis/ProfitAnalysis' />
  <param name='tabs' value='yes' />
  <param name='toolbar' value='yes' />
  <param name='filter' value=':original_view=yes' /></object></div>

In this example, the setting for the nameparameter in this example specifically refers to the URL for a custom view named Furniture (in the Profit Analysis sheet in the Profit Analysis workbook).

<script type='text/javascript' src='http://mysite.myserver.com/javascripts/api/viz_v1.js'></script>
  <div class='tableauPlaceholder' style='width: 1496px; height: 749px;'>
  <object class='tableauViz' width='1496' height='749' style='display:none;'>
  <param name='host_url' value='http://mysite.myserver.com' />
  <param name='site_root' value='' />
  <param name='name' value='ProfitAnalysis/ProfitAnalysis/Furniture' />
  <param name='tabs' value='yes' />
  <param name='toolbar' value='yes' /></object></div>

In this example, the name parameter does not refer to a specific custom view in the URL for the sheet, and the original_view parameter has not been specified. The embed code here will display the custom view that has been set to Default in the Profit Analysis sheet in the Profit Analysis workbook. However, if the original view is still the Default (no other custom view has been set to Default), then the original view will be displayed as the default view.

<script type='text/javascript' src='http://mysite.myserver.com/javascripts/api/viz_v1.js'></script>
  <div class='tableauPlaceholder' style='width: 1496px; height: 749px;'>
  <object class='tableauViz' width='1496' height='749' style='display:none;'>
  <param name='host_url' value='http://mysite.myserver.com' />
  <param name='site_root' value='' />
  <param name='name' value='ProfitAnalysis/ProfitAnalysis' />
  <param name='tabs' value='yes' />
  <param name='toolbar' value='yes' /></object></div>
Thanks for your feedback!Your feedback has been successfully submitted. Thank you!