4 Replies Latest reply on Feb 7, 2015 3:28 PM by Russell Christopher

    How to serve private dashboards from Tableau Server through Tableau's javascript API

    Renee Jutras

      We have several licensed users on our Tableau Server that all have different usernames and passwords and access to different dashboards.
      I am trying to create a web page with our dashboards in it but this doesn't seem to be possible for a private dashboard (only public ones? which is not possible for us because our data is confidential).

       

      If there was a way for the page to prompt the user to log in to gain access like on our normal Tableau Server portal or to pass the credentials to the page before loading that would be perfect but I can't find anything on that anywhere.

       

      The code I've been using that works perfectly for a public dashboard is as follows.

       

      <html>

        <head>

          <script src="C:/Program Files/Tableau/Tableau Server/8.2/wgserver/public/javascripts/api/tableau_v8.js"></script>

        </head>

        <body>

        <div id="tableauViz" style="height:800px;width:1200px"></div>

      <script>

      ////////////////////////////////////////////////////////////////////////////////

      // Global Variables

      var viz, workbook, activeSheet;

      ////////////////////////////////////////////////////////////////////////////////

      // 1 - Create a View

      function initializeViz() {

        var placeholderDiv = document.getElementById("tableauViz");

        var url = "OUR URL";

        var options = {

          width: placeholderDiv.offsetWidth,

          height: placeholderDiv.offsetHeight,

          hideTabs: true,

          hideToolbar: true,

          onFirstInteractive: function () {

            workbook = viz.getWorkbook();

            activeSheet = workbook.getActiveSheet();

          }

        };

        viz = new tableauSoftware.Viz(placeholderDiv, url, options);

      }

      // Create the viz after the page is done loading

      initializeViz();

      </script>

        </body>

      </html>