- dashboards, lite dashboards
- visual authoring experience
- source editor
EmbedManager class are provided in Embedded JavaScript Examples.
Follow these steps:
- Step 1. Verify the Prerequisites Have Been Met
- Step 2. Make the Embed Manager Available to Your Application
- Step 3. Initialize and Authorize the Embed Manager
- Step 4. Create and Render a Component in Your Application
Step 1. Verify the Prerequisites Have Been Met
Verify that the embedded dashboard prerequisites have been met. See Embedded Component Prerequisites.Step 2. Make the Embed Manager Available to Your Application
To make the Self-Service Analytics’s embed manager available to your application, include this script in your HTML:<samplecomposerurl> is the URL of your Self-Service Analytics instance.
After this script is run, the initComposerEmbedManager function is available globally in window.
Step 3. Initialize and Authorize the Embed Manager
Use thewindow.initComposerEmbedManager function to initialize and authorize the embed manager. This can be done using the following configuration properties. Note that the token you supply must be obtained beforehand using the Trusted Access API, usually in backend code that supports your HTML.
The getToken property is a method that returns a token from Trusted Access prior to token expiration. Here is an example:
initComposerEmbedManager function is called, it returns a promise that resolves an instance of the EmbedManager class. The objects, methods, properties, and embedded events provided with the EmbedManager class can be used in your HTML.
Step 4. Create and Render a Component in Your Application
After theEmbedManager class has been initialized and authorized, you can use its methods to embed a Self-Service Analytics component in your application and set various properties for that component. In addition, you can use embedded events to control component behavior when specific events occur.
Other EmbedManager methods can be used to modify, refresh, and remove components in your application.
Complete descriptions of the supported EmbedManager methods and properties are provided in EmbedManager Methods, Embedded Dashboard Properties and Objects, and Embedded Visual Authoring Properties and Objects. Supported embedded events are described in Embedded Events.
The following simple example creates and renders an embedded dashboard:
IN, NOT, !=, <>, AND, and OR.
Embedded JavaScript Examples
This section provides JavaScript examples that use methods, properties, and embedded events of theEmbedManager class to embed, refresh, reauthenticate, or remove Self-Service Analytics components from your application.
Embedded Dashboard JavaScript Example
The following JavaScript example uses methods, properties, and embedded events of theEmbedManager class to embed, refresh, reauthenticate, and remove a dashboard.
- The
createOrGetEmbedManagerasynchronous function provides an initial access token using Trusted Access. - The
addDashboardasynchronous function embeds a dashboard in the application. It uses the dashboard ID as input so it knows which dashboard to embed. It also specifies some properties for the dashboard. - The
clearDashboardasynchronous function removes a dashboard from the application. It uses the dashboard ID as input so it knows which dashboard to remove. - The
refreshDashboardasynchronous function refreshes the authorization token for the embedded dashboard using Trusted Access. - The
applicationasynchronous function at the end combines the use of all the previous functions and uses embedded events to trigger some of them.
The Self-Service Analytics
EmbedManager class must be made available to your HTML application prior to using this sample in your application. See Embed Components Using JavaScript and Trusted Access.Self-Service Analytics provides a
componentInstanceId provides a as part of event details for dashboard, source, and visual events.Embedded Visual Authoring JavaScript Example
The following JavaScript example uses methods, properties, and embedded events of theEmbedManager class to embed a visual authoring instance.
The Self-Service Analytics
EmbedManager class must be made available to your HTML application prior to using this sample in your application. See Embed Components Using JavaScript and Trusted Access.Self-Service Analytics provides a
componentInstanceId provides a as part of event details for dashboard, source, and visual events.