cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member
The Embed Refresh Trigger PostMessage that is accepted by embedded dashboards can be used to allow public users to refresh their view of an embedded dashboard, or to set a refresh rate on those embeds. The data_ts parameter is sufficient for checking data freshness on page load, but some embeds stay open for a long period of time and the PostMessage can be used to refresh those without requiring a browser refresh.

To set an automatic refresh rate for the embed, the PostMessage call can be put in a setInterval() Method. That would look like this, using Javascript:

setInterval(function(){ $('iframe').contentWindow.postMessage({event_type: "refresh_charts"}, "") }, 6000010);

The above triggers the embed to refresh the charts every 10 minutes (60000 is the multiplier for milliseconds to minutes). The minimum rate is every one minutes, but above 10 is recommend.

If a constant refresh is not needed, you can instead opt to add a "refresh charts" button to the parent webpage that would trigger the charts to refresh. That could be done using something like this:

$( "#mybutton" ).click(function() {
$('iframe').contentWindow.postMessage({event_type: "refresh_charts"}, "*");
});

A button allows users to refresh the charts, without setting a refresh rate for the embed, so the amount of queries triggered by the embed is not as high. Please note that since this PostMessage triggers a full refresh of all the charts on the embedded dashboard, it is NOT recommended for sites that already experience heavy query load or query queues on their site. Public embeds can increase the number of queries run against a connection and increasing the number of refreshes requested may cause further delay and queuing. Embeds that use this API should be restricted to dashboards with few charts with low runtimes.
Rate this article:
Version history
Last update:
‎03-02-2023 09:00 AM
Updated by:
Contributors