The following steps shows how to integrate Tableau Javascript API in your web pages.
1. Create a web page and include the JavaScript API file from the Tableau Server that hosts your visualizations:
<script src="https://YOUR-SERVER/javascripts/api/tableau-2.min.js"></script>
2. Create a div
element in the page body
where you want to insert the Tableau visualization:
<div id="vizContainer"></div>
3. Write a function in a JavaScript file to display the visualization:
function initViz() {
var containerDiv = document.getElementById("vizContainer"),
url = "https://YOUR-SERVER/views/YOUR-VISUALIZATION";
var viz = new tableau.Viz(containerDiv, url);
}
4. Call the function when the page is done loading:
initViz();