By default, the embeds use the data refresh rate set on the dashboard (or any of its reports) and the embed keeps itself up-to-date in the background, re-running the queries as necessary to get fresh results for any of the reports.
On the Business plan, when using embeds with the "Requires Secret" option, you have even better control of the currency of the data, where you can dynamically determine and pass a data_timestamp
value inside the sharingSecret
JWT token, that defines what constitutes "current" data. An example could be a time of last change in any data the dashboard shows, such as updated_at timestamp of records or the timestamp of last created item.
The code to specify an explicit data_timestamp
would look like this:
require 'JWT'
hash = {
sharing_token: 'fc77dd26-1b9d-417d-9489-518bc4ab7431', # value from sharing link
exp: (Time.now + 10.years).to_i, # should be short
data_timestamp: last_update_timestamp
}
secret='d880b5e74cea82a4e8998ae0e8775176fb440a4569eb097505f7e08e555b17b5aad78b5fa1f47acd1fbfbd876631dfdd' # value from Organization settings
JWT.encode(hash, secret)
The data_timestamp value in the JWT token is a UNIX timestamp, same as the expiration, i.e. number of seconds since 1970 - e.g. 1577836800 for 2020-01-01 00:00:00.