Skip to main content

Embedded: Integrate Into your Application

Generate Embed Tokens

After generating permissions, filters, and settings you need to generate a token. The payload of the token should contain the permissions, filters, settings (which we had already generated above), and expired time, which specifies a time to expire your issued token.

Note that: permissions, filters and settings must be in JSON type.


# Will expire after 1 day, change it to the value you want.
# Note that expired_time is of type Unix Time. E.g 1498795702
expired_time = + 24 * 60

payload = {
settings: settings,
permissions: permissions,
filters: filters,
exp: expired_time

We use JWT (JSON Web Token) as a mechanism to authenticate the code.

token = JWT.encode(payload, secret_key, 'HS256')

You can get the secret_key of the embed link by opening Embedded Analytics Sandbox and looking for secret_key in the Embed code section

Secret Key

Generate Embed URL and integrate into your application

Next, render an iframe pointing to the embed link, with the token baked into it. Holistics then use this token to authenticate and figure out which Customer is logging in, and display your dashboard with only that customer’s data.

Generate embed URL with embed_code and token (we had already generated token above):

embed_url = '' + embed_code + '?_token=' + token

You can get embed_code in Embed code section in Embedded Analytics Sandbox.

Embed Code

Finally, simply include an iframe with that URL in your application:

<!-- Below code uses Embedded Ruby(erb) template -->
<iframe src="<%= embed_url %>"
style="width: 100%;height: 600px"

Let us know what you think about this document :)