2

I've embedded data studio report on a html page. I refresh the iframes' after an interval, but the reports do not update. The report on the embedded page gets updated only by going to the report on data studio's website and clicking "Refresh data" icon.

How can the report on html page be refreshed without manually clicking Refresh data icon on data studio website?

HTML page:

<!DOCTYPE html>
<html lang="en">

<head>
    <title></title>
</head>

<body>

    <div>    
        <iframe id="TODOcombined" width="800" height="600" src="https://datastudio.google.com/embed/reporting/1L5PqnHOl0kv3-bwMMVGcNgBi0cdaSMUN/page/Kj0j" frameborder="0" style="border:0" allowfullscreen></iframe>    
    </div>

    <div>    
        <iframe id="TODOmultipage" width="800" height="600" src="https://datastudio.google.com/embed/reporting/19ErM9ElRIHD18oBKo0gGTdrmU5ayXn3H/page/Kj0j" frameborder="0" style="border:0" allowfullscreen></iframe>    
    </div>

    <script>
        function refreshFrames() {
            console.log("Refreshing frames at:" + new Date);
            document.getElementById('TODOcombined').src = document.getElementById('TODOcombined').src;
            document.getElementById('TODOmultipage').src = document.getElementById('TODOmultipage').src;
        }
        setInterval(refreshFrames, 20000);
    </script>

</body>

</html>
user5155835
  • 4,392
  • 4
  • 53
  • 97
  • See https://stackoverflow.com/questions/86428/what-s-the-best-way-to-reload-refresh-an-iframe where the technique you have used is discussed in some detail in one of the answers - does any of that help? – MandyShaw Mar 15 '19 at 17:34
  • @MandyShaw The issue is not of iframe caching. It is what is mentioned in answer below – user5155835 Mar 16 '19 at 06:50

2 Answers2

2

When you create a datastudio report you can control whether you use caching (at the report settings level) and how fresh you want your data to be (at the connection level, with options ranging between 1, 4 and 12 hours).

Simply refreshing the page does not override these so you will need to change them to meet your needs.

See Manage Data Studio data freshness for details.

Minhaz Kazi
  • 3,115
  • 1
  • 10
  • 20
Elad Amit
  • 575
  • 3
  • 7
1

Hello, the first solution could be install a plugin in the chrome extensions called "Data Studio Auto Refresh" site here and set it up. (PD:For use this plugin its necessary to keep your page the chrome available, you could use one server for that or whatever you decide)

The second solution is create a script in jquery, ajax etc to reload the mark element without refresh the whole page.

Hope it works!