Embed a Dashboard Using a Generated Snippet and Trusted Access Tokens
insightsoftware recommends using Trusted Access for all embed-related workflows.
- Verify that the embedded dashboard prerequisites have been met. See Embedded Component Prerequisites.
- Use the Self-Service Analytics API to register your host application as a Trusted Access client of your Self-Service Analytics instance and obtain a client ID and client secret. See Trusted Access - Register a Client.
-
Add a
window.composerGetTokenfunction to your host application to obtain an access token and expiration for a user session when a user uses the embedded dashboard. ThecomposerGetTokenfunction must communicate with a server you have created (see Step 4) that takes information about the active user session (the user name) and contacts Self-Service Analytics to generate an access token for the user session. This is anasyncfunction that returns a promise. For example:Where<access-token>is the Trusted Access token you obtain from your server and<seconds>is the number of seconds until the token expires. -
Implement your own server-side code that accepts requests generated by the
window.composerGetTokenfunction and, in turn, makes requests to Self-Service Analytics to generate a token for the specific user session of a user using the embedded dashboard. Your server-side code should respond to these requests with a token and expiration information. To generate an access token for the user, call the Trusted Access push/tokens API to generate tokens for new Self-Service Analytics users, or the pull/tokens API to retrieve tokens for existing users. See Trusted Access API Endpoints and Trusted Access - Generate and copy the embeddable snippet for your dashboard. See Embeddable Component Snippets.
-
Insert the generated snippet into your host application using the appropriate
scripttag, configured to show the embedded dashboard in the appropriate HTML element.
Embed Multiple Dashboards On a Single Page
You can embed multiple dashboards on a single page of your application and in a single<div> in your application, including embedding one or more empty dashboards. You can also embed the same dashboard multiple times on a page and each embedded instance can use its own property settings (theme, mode, header, title). Finally, the dashboards can be embedded using different methods: you can embed one dashboard using generated embed code and another dashboard using JavaScript.
When more than one dashboard is embedded in application, the cross-visual filters that are published for a visual on one of the dashboards can be subscribed to by any visual on any of the embedded dashboards. However, this is not true unless the dashboards are embedded in the same application. Visuals in a dashboard open in one window or tab cannot subscribe to cross-visual filters published by visuals in a different window or tab.