1 Reply Latest reply on May 7, 2018 1:39 PM by Patrick Van Der Hyde

    How to calculate viz or tableau api loading/rendering time in javascript?

    Jordan Sanjaya

      I need to know if there is any way to find tableau api (viz) loading/rendering time in a webpage using javascript/jquery. I want to add some diagnostic info collection to the page. I thought I could add a timer that shows how long tableau api took to render the viz. Once I have the value, I want to show it to the console (chrome or firefox) during the debugging process.


      My code looks this, but I am not sure if I am on right track to do this. Please let me know if you can help me to find a way. Thanks!


      //Initialize the viz

      function startVIZ() {

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

                  var options = {

                      hideTabs: true,

                      hideToolbar: true,

                      // onFirstInteractive is a callback that happens once the Viz is loaded

                      onFirstInteractive: function () {

                          workbook = viz.getWorkbook();

                          sheet = book.getActiveSheet();



      //Count the timer how long to render the viz

                  var startTime = new Date().getTime();

                  divholder.onload = function () {

                      var loadtime = new Date().getTime() - startTime;

                      console.log("viz took " + loadtime + "ms to load");



      // Creates the actual viz

                  if (viz) {

                      /// there is already a viz in there


                      viz = new tableau.Viz(divholder, selected_report_url_with_filter, options);

                  } else {

                      /// page load - default viz

                      viz = new tableau.Viz(divholder, viz_url, options);