3 Replies Latest reply on Feb 13, 2017 12:09 AM by Ghouse Shaik

    Tableau embed API working slow

    Nikhil Lad

      Hi all,

       

      I am using Tableau Server 9.0. I use tableau embed api, to fetch the reports and show them up on my custom web portal in PHP. Where the things are working fine and i am able to fetch and view any report from tableau server. But it is working very slow. When i load any iFrame pointing to any report, it shows me waiting circle for couple of minutes, and then a report is being loaded. Wherein the report is very small, so it should not take that much time to load. I have checked my network connection as well. but there doesn't seem to be any problem with it. Also both of my servers are in our own data center; and not on cloud. So there should not be any latency as well.

       

      Could anyone please suggest me, whats actually going wrong? Any help is highly appreciated.

       

      Cheers,

      Nik

        • 1. Re: Tableau embed API working slow
          Johan De Groot

          Hi,

           

          since embedding is 'just' showing the visualisation from Tableau Server inside a webpage, it shouldn't slow down the rendering of the visualisation.

          Can you compare the loading-time between the embedded viz and the 'original' one in Tableau Server? I would assume they both load equally fast (or slow...).

           

           

          Kind regards,

          Johan de Groot

          • 2. Re: Tableau embed API working slow
            Robert Kuzma

            Hi,

             

            I also use Tableau embed and is taking really long time to load it:

             

            <script src='//server/javascripts/api/viz_v1.js'></script>

            <object class='tableauViz' width='1100' height='960' style='display:none;'>

                <param name='host_url' value='https://server/' />

                <param name='site_root' value='' />

                <param name='ticket' value='ticket' />

                <param name='name' value='Name/Name' />

                <param name='tabs' value='no' />

                <param name='toolbar' value='no' />

                <param name='load-order' value='-1' />

            </object>

             

            Any suggestions?

            • 3. Re: Tableau embed API working slow
              Ghouse Shaik

              Hi Nikhil,

              Go to the bin folder of the Tableau Server and run the following commands to get Trusted Authentication for the IP Address

                        1.tabadmin stop

                        2.tabadmin set wgserver.trusted_hosts IP_Address_Assigned_To_Trusted

                        3.tabadmin config

                        4.tabadmin start

               

              Create a New File in htdocs of the XAMPP folder with .php extension (Example : webportal.php) and Use the following Syntax to embed a Tableau Workbook in Web Portal.

               

              <?php

              $url = 'URL_of_Tableau_Server_With_Port_Number/trusted';

              $server = URL_of_Tableau_Server_With_Port_Number ';

              $data = array('username' => ' Administrator_User_Of_The_Tableau_Server ');

              $params = ':embed=yes&:toolbar=yes';

              $views = 'Views_URL_Of_The_Embedded_Workbook;

               

              // use key 'http' even if you send the request to https://...

              $options = array(

                  'http' => array(

              'header'  => "Content-type: application/x-www-form-urlencoded\r\n",

              'method'  => 'POST',

              'content' => http_build_query($data)

                  )

              );

              $context = stream_context_create($options);

              $result = file_get_contents($url, false, $context);

              if ($result === FALSE) { /* Handle error */ }

               

              $workbook = $url.'/'.$result.'/'.$views.'?'.$params;

               

              ?>

              <script type="text/javascript" src="https://public.tableau.com/javascripts/api/tableau-2.js"></script>

              <script type="text/javascript">

                              var viz;

               

                              window.onload = function(){

                              var vizDiv = document.getElementById('myViz');

                              var vizURL = "<?php echo $workbook;?>";

                              var options = {

                                              width: 'Width_Of_The_Embedded_Workbook_in_Web_Portal',

                                              height: 'Height_Of_The_Embedded_Workbook_in_Web_Portal'

                              };

                              viz = new tableau.Viz(vizDiv, vizURL, options);

              };

               

              //Content below is Resolving warning for missing 'tableau' object

              var tableau;

              </script>

               

              <div id="ID_Of_The_Embedded_Workbook_in_Web_Portal_Where_You_Want_To_Publish "></div>

               

              Please revert back if you have any further queries.

               

              Regards,

              Ghouse Shaik.