2 Replies Latest reply on Apr 24, 2018 2:08 PM by Chase Culver

    Embed not working

    Tariq Ansari

      I am trying to embed a dashboard to a webpage.

      I tried the sample code -> < https://onlinehelp.tableau.com/current/api/js_api/en-us/JavaScriptAPI/js_api_sample_basic_embed.html> , my version of the code below.


      URL of the dashboard http://host:xxxx/#/site/Tableau_POC/views/Tq_Test/Sheet1?:iid=9

      The last part ':iid=9' keeps changing, I dont know what it means. I tried the code below with the below combinations

      url = "http://host:xxxx/site/Tableau_POC/views/Tq_Test/Sheet1?:embed=yes",

      url = "http://host:xxxx/site/Tableau_POC/views/Tq_Test/Sheet1?:iid=9&:embed=yes",

      url = "http://host:xxxx/site/Tableau_POC/views/Tq_Test/Sheet1?:iid=9&:embed=y",

      url = "http://host:xxxx/site/Tableau_POC/views/Tq_Test/Sheet1?:iid=9",


      The server gives me a link to embed(works) when I click share, that is where I got ->  src="http://host:xxxx/javascripts/api/viz_v1.js,

      so I suppose this is what I have to use in my code,

      The page does not list the correct API to use for version 10.5-><https://onlinehelp.tableau.com/current/api/js_api/en-us/JavaScriptAPI/js_api_concepts_get_API.htm>

      I also tried other api options, none worked. Let me know if am doing something wrong?

      There are no errors, I just see blank screen.




          <title>Basic Embed</title>


          <script type="text/javascript"


          <script type="text/javascript">

              function initViz() {

                  var containerDiv = document.getElementById("vizContainer"),

                      url = "http://host:xxxx/site/Tableau_POC/views/Tq_Test/Sheet1?:embed=yes",

                      options = {

                          hideTabs: true,

                          onFirstInteractive: function () {

                              console.log("Run this code when the viz has finished loading.");




                  var viz = new tableau.Viz(containerDiv, url, options);

                  // Create a viz object and embed it in the container div.





      <body onload="initViz();">

          <div id="vizContainer" style="width:800px; height:700px;"></div>   






        • 1. Re: Embed not working
          Tariq Ansari

          nobody has any idea ?

          • 2. Re: Embed not working
            Chase Culver

            Hello Tariq,


            The appropriate JavaScript link will depend on whether you are utilizing the JavaScript API code, or the pre-generated Tableau JavaScript. Despite the similar names, they are actually quite different!


            The embed code found in the Share link is utilizes 'Tableau JavaScript'. However, the embed code from the JavaScript API 'Concepts' page, (as used in your post) is that of the JavaScript API. As such, the appropriate JavaScript URL will be one that points to the JavaScript API files located on your server. For example:


               <script type="text/javascript" src="https://<Your Tableau Server URL here>/javascripts/api/tableau-2.min.js"></script> <script type="text/javascript">


            For more information see Tableau JavaScript API Concepts--Accessing the API


            For more information on utilizing the pre-generated code from the 'Share link' please see Writing Embed Code.


            In any case, the iid portion of the URL should not be included in the embed code.


            I hope this helps!