Add Filters to Embed Code for 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 about filtering, see Filter the View in the Embedding API help. The information in this topic is for prior versions of embedding (using the Tableau JavaScript API v1 and v2).

Filter using prior versions of embedding

You can include filter values in embedded views so they highlight just the data you want. For example, you may want to include a hyperlink from another part of your web application to an embedded sales performance view that shows only a specific region.

Note: Stories don't support embedded filters.

Filter on one field

Passing a filter on one field is a quick way to focus an embedded view on specific data.

Script tag example:

<script type='text/javascript' src='http://myserver/javascripts/api/viz_v1.js'> 
</script> 
<object class='tableauViz' width='800' height='600' style='display:none;'>
   <param name='host_url' value='http://myserver/' />  
   <param name='site_root' value='' /> 
   <param name='name' value='Superstore/Product' /> 
   <param name='filter' value='Region=East' /> 
</object> 

To pass through multiple filter values, just separate each with a comma. For example:

<param name='filter' value='Region=East,West' />

Iframe tag examples:

<iframe src="http://myserver/views/Superstore/Product?:embed=y&Region=East,West" 
width="800" height="600"></iframe> 

Filter on multiple fields

You can pass filters on as many fields as you want, including fields that are not in visible the original view.

Script tag example:

<script type='text/javascript' src='http://myserver/javascripts/api/viz_v1.js'> 
</script> 
<object class='tableauViz' width='800' height='600' style='display:none;'>    
   <param name='host_url' value='http://myserver/' />  
   <param name='site_root' value='' /> 
   <param name='name' value='Superstore/Product' /> 
   <param name='filter' value='Region=Central,South&Customer Segment=Consumer,Home Office' /> 
</object> 

Iframe tag example:

<iframe src="http://myserver/views/Superstore/Product?:embed=y&Region=Central,South&Segment=Consumer,Home Office" 
width="800" height="600"></iframe> 

The first image below shows an example of the URL you get when you click Share on a view and then click Copy Link.

The second image shows how you might modify the URL and add it to an iframe by deleting the showShareOptions and display_count parameters, adding filter parameters for Region and Segment, and adding width and height parameters, to create an embed link that displays only Consumer and Home Office products from the Central and South regions.

Link and iframe code

Note: If a filter value contains a special character, such as a comma, replace the character with the URL encoding sequence for \ (backslash, %5c) followed by the URL encoding sequence for the special character. The backslash is needed to escape the special character. For example, the URL encoding sequence for \, (backslash, comma) is %5c%2c.

Filter dates and times

If you want to filter on a Date/Time field, include the value using the default Tableau format shown below:

yyyy-mm-dd hh:mm:ss

The time part uses a 24-hour clock. Many databases store all date values as Datetime fields, so you may need to pass a time value along with your date.

Script tag example:

<script type='text/javascript' src='http://myserver/javascripts/api/viz_v1.js'></script> 
<object class='tableauViz' width='800' height='600' style='display:none;'> 
   <param name='host_url' value='http://myserver/' />  
   <param name='site_root' value='' /> 
   <param name='name' value='Sales/Sales-Performance' /> 
   <param name='filter' value='Date=2012-12-01' /> 
</object> 

This example filters on both a date field and a datetime field:

<param name='filter' value='2012-12-01%2022:18:00' /> 

Iframe tag example:

<iframe src="http://myserver/Sales/Sales­Performance?:embed=yes&Date=2008-12-01%2022:18:00" width="800" height="600"></iframe>

To filter multiple dates, separate each date with a comma.

Filter measures

You can filter measures by including one or more values. There is no support for greater than, less than, or ranges. The example below filters to show only $100 and $200 sales.

Script tag example:

<script type='text/javascript' src='http://myserver/javascripts/api/viz_v1.js'> 
</script> 
<object class='tableauViz' width='800' height='600'  style='display:none;'> 
   <param name='host_url' value='http://myserver/' />  
   <param name='site_root' value='' /> 
   <param name='name' value='Sales/Sales-Performance' /> 
   <param name='filter' value='Profit=100, 200' /> 
</object> 

Iframe tag example:

<iframe src="http://myserver/views/Sales/Sales-Performance?:embed=yes&Profit=100,200" 
width="800" height="600"></iframe>
Thanks for your feedback!Your feedback has been successfully submitted. Thank you!