sisense.com

Sisense Embed SDK Reference

Feature Availability

The Embed SDK is available on:

  • Sisense for Windows 8.1 or newer
  • Sisense for Linux L8.2.1 or newer

Some features in this reference are only available from Sisense version 8.1.1/L8.2.1 or higher - they are marked with the 8.1.1 and L8.2.1 badges, respectively.

The Sisense Embed SDK is a JavaScript library used for embedding Sisense Dashboards into web applications and facilitating the interaction between the host page and the embedded dashboard.

Using the SDK

Prerequisites

Importing the SDK

The SDK is bundled with the Sisense Web Server starting with Sisense v8.1; To use it on your web page or application, follow these steps:

  1. Include the SDK file from your Sisense Web Server:

    <script src="https://example.com/js/frame.js"></script>
    

    (Replace https://example.com with the IP or DNS address of your Sisense Web Server)

  2. Import the module:

    const { SisenseFrame, enums } = window['sisense.embed'];
    

    (enums is optional, and contains values for different options in the API)

SisenseFrame Class

Main SDK Entry point - An instance of this class represents a single Sisense embedded iFrame on the host page, and provides the API for interacting with the embedded Sisense application.

The SDK can either wrap an existing iFrame element by passing the element property to the constructor, or generate an iFrame element automatically into any DOM element provided as the container argument of render().

Notes:

  • Application related methods such as getUser are contained under the app property. These are methods that relate to the entire Sisense application, regardless of the frame's current state.
  • Dashboard related methods such as applyFilters are contained under the dashboard property. These are methods that relate to the currently Dashboard loaded in the iFrame and to navigation between dashboards.
  • Each of the above objects (app and dashboard) have their own on and off methods to subscribe to events in either the global application or dashboard contexts, and each has specific supported events.

Constructor

new SisenseFrame(init)

Create a new instance of SisenseFrame to interact with a Sisense iFrame-embedded application.

NameTypeDescription
initinitInitial configuration for the frame

Properties

Note: The properties below will only be available once the render() method was called.

PropertyTypeDescription
idstringiFrame element's id
urlstringiFrame base URL
elementHTMLElementiFrame DOM element

Methods

render

render([container], [hidden])Promise<null>

Create the iFrame according to current settings.

If an iFrame DOM element was provided in the constructor via the element property, container is optional and can be left as undefined/null; Otherwise, a DOM element is required, into which the iFrame element will be rendered.

Parameters

NameTypeDefaultDescription
[container]DOMElementA container DOM element to render the iFrame into
[hidden]booleanfalseWhether the iFrame should be rendered in hidden mode

Returns

A Promise that resolves with no data when the iFrame element has been rendered.

show

show()

Show the iFrame element.

Parameters

N/A

Returns

N/A

hide

hide()

Hide the iFrame element.

Parameters

N/A

Returns

N/A

getSettings

getSettings()uiSettings

Get the current UI settings for the iFrame.

Parameters

N/A

Returns

A uiSettings type object

updateSettings

updateSettings(settings)Promise

Update the frame's UI settings.

Parameters

NameTypeDescription
settingsuiSettingsUI settings to apply to the iFrame

Returns

A Promise that resolves with no data when the new settings have been applied

getState

getState()frameState

Get the current state of the frame, with information on what is currently displayed within it.

Parameters

N/A

Returns

A frameState type object

getSize

getSize()Promise<sizingInfo>

Get frame content sizing information

Parameters

N/A

Returns

A Promise that resolves with a sizingInfo object.

app.on

app.on(eventName, eventHandler)

Subscribe a handler to an application event.

Parameters

NameTypeDescription
eventNamestringName of event to subscribe to 1
eventHandlerfunctionEvent handler function
1 Supported events:

Returns

N/A

app.off

app.off(eventName, eventHandler)

Un-subscribe a handler from an application event. The same event handler function must be passed as the eventHandler argument.

Parameters

NameTypeDescription
eventNamestringName of event to unsubscribe from 1
eventHandlerfunctionEvent handler function to unsubscribe
1 Supported events:

Returns

N/A

app.getInfo

app.getInfo()Promise.<AppInfo>

Get information about the Sisense application currently displayed in the iFrame.

Parameters

N/A

Returns

A Promise that resolves to the AppInfo type

app.getUser

app.getUser()Promise.<UserInfo>

Get information about the current user logged in to the Sisense application currently displayed in the iFrame.

Parameters

N/A

Returns

A Promise that resolves to the UserInfo type

app.logout

app.logout()

Log out from Sisense.

The iFrame will automatically redirect to the login page, hence usually this will be called before the host page is navigated elsewhere or together with the hide() method to avoid showing the login page to the user.

Parameters

N/A

Returns

N/A

app.setTheme L2021.3

app.setTheme(themeOid)Promise

Applies the specified theme (by its oid) to the embedded Sisense UI. This action can be reverted using the app.clearTheme method.

Parameters

NameTypeDescription
themeOidstringoid of theme to apply

Returns

A promise that resolves once the theme has been applied.

app.clearTheme L2021.3

app.clearTheme()Promise

Clears the custom theme applied with the app.setTheme method, reverting to the user's default theme.

Parameters

N/A

Returns

A promise that resolves once the theme has been cleared.

dashboard.on

dashboard.on(eventName, eventHandler)string

Subscribe a handler to a dashboard event.

Parameters

NameTypeDescription
eventNamestringName of event to subscribe to 1
eventHandlerfunctionEvent handler function
1 Supported Events

Returns

N/A

dashboard.off

dashboard.off(eventName, eventHandler)

Un-subscribe a handler from a dashboard event. The same event handler function must be passed as the eventHandler argument.

Parameters

NameTypeDescription
eventNamestringName of event to unsubscribe from 1
eventHandlerfunctionEvent handler function to unsubscribe
1 Supported Events

Returns

N/A

dashboard.open

dashboard.open(dashboardId, [editMode])Promise.<DashboardInfo>

Navigate the frame to a dashboard by the dashboard's OID. Calling this may trigger both dashboardunloaded and then dashboardloaded events.

Parameters

NameTypeDefaultDescription
dashboardIdstringOID of dashboard to open
[editMode]booeanfalseShould dashboard be shown in edit mode

Returns

A Promise that resolves to the <DashboardInfo> type once the new dashboard is loaded

dashboard.getCurrent

dashboard.getCurrent()Promise.<DashboardInfo>

Get information about the current dashboard displayed in the iFrame, including a list of filters applied to it. If no dashboard is being displayed, the Promise will be rejected.

Parameters

N/A

Returns

A Promise that resolves to the <DashboardInfo> type

dashboard.applyFilters

dashboard.applyFilters(filters, persist)Promise.<Array.<Object>>

Apply (add or update) one or more filters to the current dashboard. If a filter already exists for the same dimension (field), it will be replaced. By default, Filter changes will not persist after refresh/reload and will not affect the current user's dashboard instance in Sisense, unless a true value is passed as the persist argument.

Parameters

NameTypeDescription
filtersArray.<DashboardFilter>An array of filters to apply to the dashboard.
persistbooleanShould the filter change be persisted.

Returns

Promise.<Array.<Object>> - An array containing all currently applied filters, after the operation is complete

dashboard.removeFilters

dashboard.removeFilters(filters, persist)Promise.<Array.<Object>>

Remove one or more filters from the current dashboard. Filters are matched using the dimension (field) name, so it is sufficient to provide just the jaql.dim property without the actual filter details to remove. By default, Filter changes will not persist after refresh/reload and will not affect the current user's dashboard instance in Sisense, unless a true value is passed as the persist argument.

Parameters

NameTypeDescription
filtersArray.<DashboardFilter>An array of filters to remove from the dashboard.
persistbooleanShould the filter change be persisted.

Returns

Promise.<Array.<Object>> - An array containing all currently applied filters, after the operation is complete

dashboard.clearFilters L2022.1

dashboard.clearFilters(persist)Promise

Clears all dashboard filters.
By default, Filter changes will not persist after refresh/reload and will not affect the current user's dashboard instance in Sisense, unless a true value is passed as the persist argument.

Parameters

NameTypeDescription
persistbooleanShould the filter change be persisted.

Returns

Promise - A promise that resolves once the operation is complete

dashboard.export

dashboard.export([mode])Promise

Trigger a dashboard export process - this command will open the export UI modal window within the iFrame, where the user can configure the export and download it.

Parameters

NameTypeDefaultDescription
[mode]string"pdf"Either "pdf" or "png" 1

1 Represented by enums.ExportMode.PDF and enums.ExportMode.PNG

Returns

A Promise that resolves with no data when the user closed the export window

dashboard.openSimplyAsk L8.2.1

dashboard.openSimplyAsk()

Opens the SimplyAsk NLQ popup as a modal dialog within the iFrame.

Parameters

N/A

Returns

N/A

Example

sisenseFrame.dashboard.openSimplyAsk();

dashboard.share L2021.8

dashboard.share()

Opens the Share Dashboard popup as a modal dialog within the iFrame, allowing dashboard designers to share the dashboard directly from the embedded interface even if the dashboard toolbar element is hidden.

Parameters

N/A

Returns

N/A

Example

sisenseFrame.dashboard.share();

dashboard.createWidget L2021.8

dashboard.createWidget()

Opens the New Widget popup as a modal dialog within the iFrame, allowing dashboard designers to create a new widget on the dashboard, even if the dashboard toolbar is hidden.

Parameters

N/A

Returns

N/A

Example

sisenseFrame.dashboard.createWidget();

dashboard.createTextWidget L2021.8

dashboard.createTextWidget()

Creates a blank new Text Widget within the embedded dashboard, allowing dashboard designers to create a new text widget on the dashboard, even if the dashboard toolbar is hidden.

Parameters

N/A

Returns

N/A

Example

sisenseFrame.dashboard.createTextWidget();

dashboard.new L2022.8

dashboard.new()Promise.<DashboardInfo>

Creates a blank new dashboard and navigates to it, allowing dashboard designers to create a new dashboard, even if the navigation toolbar is hidden.

Parameters

N/A

Returns

A Promise that resolves to the <DashboardInfo> type once the new dashboard is created & loaded.

Example

sisenseFrame.dashboard.new();

widget.on 8.1.1 L8.2.1

widget.on(eventName, eventHandler)string

Subscribe a handler to a widget event.

Parameters

NameTypeDescription
eventNamestringName of event to subscribe to 1
eventHandlerfunctionEvent handler function
1 Supported Events

Returns

N/A

widget.off 8.1.1 L8.2.1

widget.off(eventName, eventHandler)

Un-subscribe a handler from a widget event. The same event handler function must be passed as the eventHandler argument.

Parameters

NameTypeDescription
eventNamestringName of event to unsubscribe from 1
eventHandlerfunctionEvent handler function to unsubscribe
1 Supported Events

Returns

N/A

widget.open 8.1.1 L8.2.1

widget.open(dashboardId, widgetId, [editMode])Promise WidgetInfo

Navigate the frame to a widget by the dashboard and widget's OID. Calling this may trigger both widgetloaded and then widgetunloaded events.

Parameters

NameTypeDefaultDescription
dashboardIdstringOID of dashboard containing the widget
widgetIdstringOID of widget to open
[editMode]booeanfalseShould dashboard be shown in edit mode

Returns

A Promise that resolves to the WidgetInfo type once the new dashboard is loaded

widget.getCurrent 8.1.1 L8.2.1

widget.getCurrent()Promise.WidgetInfo

Get information about the current widget displayed in the iFrame. If no widget is being displayed, the Promise will be rejected.

Parameters

N/A

Returns

A Promise that resolves to the WidgetInfo type

widget.save 8.1.1 L8.2.1

widget.save([returnToDashboard])Promise.WidgetInfo

Applies changes to the widget, same as the "Apply" UI button would do, for cases when it is not visible. By default will keep the frame showing the widget. If true value is passed as the first argument, will automatically navigate back to the dashboard. Calling this may trigger both widgetsave and then widgetunloaded events.

Parameters

NameTypeDefaultDescription
[returnToDashboard]booeanfalseShould dashboard be shown after save

Returns

A Promise that resolves to the WidgetInfo type once the widget is saved

Events

sisenseapploaded

Application Loaded event will fire when the Sisense application is loaded in the iFrame. At this point, app.getUser() and app.getInfo() become available.

Use constant enums.ApplicationEventType.LOADED.

Can only be used with app.on()/app.off()

NameTypeDefaultDescription
eventNamestring"sisenseapploaded"Event name

appstatechanged L2022.6

Application State Changed event will fire when the Sisense application is changing state (navigating to a different view).

Below you can find a table of available states. This event allows you to react to navigation happening within the embedded Sisense application.

For example: When a user deletes a dashboard they are currently viewing, they will be navigated to the home page by default. If you wish to override this behavior, for example by navigating them to a different page in your host application (instead of the Sisense home page that is now embedded within), this event will allow you to detect when this navigation happens and handle it.

Use constant enums.ApplicationEventType.STATECHANGED.

Can only be used with app.on()/app.off()

NameTypeDefaultDescription
eventNamestring"appstatechanged"Event name
fromStatestringPrevious state
toStatestringNew state

Available states

State nameDescription
homeDefault home page ("all dashboards")
home.folderHome page, focused on a specific folder
dashboardDashboard
widget.editWidget editor
widget.newNew widget wizard

Example

sisenseFrame.app.on(enums.ApplicationEventType.STATECHANGED, (args) => {
   if (args.toState.startsWith('home')) {
      // if user is entering the "home" view, navigate to a different page
      window.location = 'https://example.com/analytics/home';
   }
});

dashboardloaded

Dashboard Loaded event will fire when a new dashboard is loaded in the iFrame.

Use constant enums.DashboardEventType.LOADED.

Can only be used with dashboard.on()/dashboard.off()

Properties

NameTypeDefaultDescription
eventNamestring"'dashboardloaded'"Event name
dashboardDashboardInfoDashboard information

dashboardunloaded

Dashboard un-loaded event will fire when a dashboard is being unloaded from the iFrame, such as when navigating to a different dashboard or transitioning to a different state.

Use constant enums.DashboardEventType.UNLOADED.

Can only be used with dashboard.on()/dashboard.off()

Properties

NameTypeDefaultDescription
eventNamestring"'dashboardunloaded'"Event name
dashboardDashboardInfoDashboard information

dashboardfilterschanged

Dashboard filters changed event will fire when the dashboard filters have been modified.

Use constant enums.DashboardEventType.FILTERS_CHANGED.

Can only be used with dashboard.on()/dashboard.off()

Properties

NameTypeDefaultDescription
eventNamestring"'dashboardfilterschanged'"Event name
dashboardDashboardInfoDashboard information

dashboardrefreshed

Dashboard refreshed event will fire when the dashboard has been refreshed (and widget queries re-run), usually as a result of filters being changed.

Use constant enums.DashboardEventType.REFRESHED.

Can only be used with dashboard.on()/dashboard.off()

Properties

NameTypeDefaultDescription
eventNamestring"'dashboardrefreshed'"Event name
dashboardDashboardInfoDashboard information

dashboardstylechanged

Dashboard style changed event will fire when the dashboard's style has been changed.

Use constant enums.DashboardEventType.STYLE_CHANGED.

Can only be used with dashboard.on()/dashboard.off()

Properties

NameTypeDefaultDescription
eventNamestring"'dashboardstylechanged'"Event name
dashboardDashboardInfoDashboard information

dashboardwidgetadded

Dashboard widget added event will fire when a new widget is added to the dashboard.

Use constant enums.DashboardEventType.WIDGET_ADDED.

Can only be used with dashboard.on()/dashboard.off()

Properties

NameTypeDefaultDescription
eventNamestring"'dashboardwidgetadded'"Event name
dashboardDashboardInfoDashboard information

sizechanged

Dashboard size changed event will fire when the dashboard size changes.

Use constant enums.DashboardEventType.SIZECHANGED.

Can only be used with dashboard.on()/dashboard.off()

Properties

NameTypeDefaultDescription
eventNamestring"'sizechanged'"Event name

widgetready 8.1.1 L8.2.1

Widget Loaded event will fire when a widget displayed in the iFrame is rendered and ready

Use constant enums.WidgetEventType.READY.

Can only be used with widget.on()/widget.off()

Properties

NameTypeDefaultDescription
eventNamestring"'widgetready'"Event name
widgetWidgetInfoWidget information

widgetloaded 8.1.1 L8.2.1

Widget Loaded event will fire when a new widget is loaded in the iFrame.

Use constant enums.WidgetEventType.LOADED.

Can only be used with widget.on()/widget.off()

Properties

NameTypeDefaultDescription
eventNamestring"'widgetloaded'"Event name
widgetWidgetInfoWidget information

widgetunloaded 8.1.1 L8.2.1

Widget un-loaded event will fire when a widget is being unloaded from the iFrame, such as when navigating to a different widget or transitioning to a different state.

Use constant enums.WidgetEventType.UNLOADED.

Can only be used with widget.on()/widget.off()

Properties

NameTypeDefaultDescription
eventNamestring"'widgetunloaded'"Event name
widgetWidgetInfoWidget information

widgetchanged 8.1.1 L8.2.1

Widget metadata changed event will fire when the current widget's metadata has been changed, such as new dimensions added or widget filters removed

Use constant enums.WidgetEventType.CHANGED.

Can only be used with widget.on()/widget.off()

Properties

NameTypeDefaultDescription
eventNamestring"'widgetchanged'"Event name
widgetWidgetInfoWidget information

widgetsave 8.1.1 L8.2.1

Widget Saved event will fire when the widget is saved, either via UI button or the widget.save() function

Use constant enums.WidgetEventType.SAVE.

Can only be used with widget.on()/widget.off()

Properties

NameTypeDefaultDescription
eventNamestring"'widgetsave'"Event name
widgetWidgetInfoWidget information

Types

frameState

Frame state properties

Properties

NameTypeDescription
modeintegerCurrent mode. See FrameStateMode enum
dashboardstringOID of the current dashboard displayed, if applicable
widgetstringOID of the current widget displayed, if applicable

sizingInfo

Frame sizing information

Properties

NameTypeDescription
header.widthintegerheader width
header.heightintegerheader height
toolbar.widthintegertoolbar width
toolbar.heightintegertoolbar height
leftpane.widthintegerleftpane width
leftpane.heightintegerleftpane height
rightpane.widthintegerrightpane width
rightpane.heightintegerrightpane height
midpane.widthintegermidpane width
midpane.heightintegermidpane height
content.widthintegercontent width
content.heightintegercontent height

uiSettings

Sisense UI settings, defining which panels are displayed in the iFrame

Properties

NameTypeDefaultDescription
[showToolbar]booleanfalseShould the toolbar be displayed?
[showLeftPane]booleanfalseShould the left panel be displayed?
[showRightPane]booleanfalseShould the right panel be displayed?
Panels in Dashboard mode
  • Toolbar: dashboard header
  • Left Pane: dashboard navigation panel
  • Right Pane: dashboard filters panel

init

Initial configuration required by the SisenseFrame() constructor.

Properties

NameTypeDescription
[id]stringAn optional ID to assign to the iFrame element (if not specified, a random GUID will be assigned). Only applicable when iFrame is created by the SDK, ignored otherwise.
urlstringBase URL of the Sisense application. Includes only the protocol, hostname and port, for example: https://example.com
[dashboard]stringOID of the dashboard to open. If not provided, home page will be opened
[widget]stringOID of the widget to open. Must be provided alongside a dashboard OID. 8.1.1 L8.2.1
[settings]uiSettingsInitial UI settings
[element]HTMLElementAn iFrame element to attach to. If not specified, iFrame will be created by the SDK
[editMode]booleanWhether the embedding component should initially load in editMode - defaults to false.
[theme]stringAn optional theme oid to apply to the dashboard/widget. If not specified, the user's default theme is applied
[wat]stringA Web Access Token L2021.10
[language]stringAn optional language setting to apply to the Sisense UI L2022.1
[volatile]booleanAn optional setting to prevent user changes from persisting upon reload L2022.2. Defaults to false.

Volatile Mode vs Edit Mode

Please note - "edit mode" for dashboards and widgets is not compatible with volatile mode (as edit mode relies on storing user changes).
When configuring the Embed SDK with volatile: true, the editMode parameter will be ignored.

Supported Languages
  • de-DE
  • en-US
  • es-AR
  • es-ES
  • fr-FR
  • it-IT
  • ja-JP
  • ko-KR
  • nl-NL
  • pt-BR
  • ru-RU
  • tr-TR
  • zh-CN

AppInfo

Application info object.

Properties

NameTypeDescription
versionstringCurrent Sisense version
isTrialbooleanTrue if the Sisense application is a trial version

UserInfo

User info object.

Properties

NameTypeDescription
oidstringUser's ID
emailstringUser's email
usernamestringUser's username
firstNamestringUser's first name
lastNamestringUser's last name
roleobject
role.oidstringUser's role ID
role.namestringUser's role title

DashboardInfo

Dashboard Response Object

Properties

NameTypeDescription
oidstringDashboard OID
titlestringDashboard title
descriptionstringDashboard description
instanceTypestring"owner" or "user" 1
ownerstringDashboard owner user OID
userIdstringDashboard user OID (who's version of the dashboard is loaded)
datasourceDatasourceDashboard's primary datasource
filtersArray.<DashboardFilter>Dashboard filters array
createdDateDashboard creation time
lastUpdatedDateDashboard last update
lastUsedDateDashboard last used
lastOpenedDateDashboard last opened

1 Represented by enums.DashboardInstanceType.OWNER and enums.DashboardInstanceType.USER

WidgetInfo 8.1.1 L8.2.1

Widget Response Object

Properties

NameTypeDescription
oidstringWidget OID
titlestringWidget title
typestringWidget type
subtypestringWidget subtype
ownerstringWidget owner OID
userIdstringInstance user OID
createdDateWidget creation time
lastUpdatedDateDashboard last update
lastUsedstringDashboard last used
tagsstring[]Widget tags
instanceTypestring"owner" or "user" 1
datasourceDatasourceWidget's datasource
dashboardidstringDashboard OID
queryStartTimeDatewidget's last query start time
metadataMetadataItem[]Widget metadata
dataobject[][]Widget data
jaqlQuerystringWidget JAQL

1 Represented by enums.WidgetInstanceType.OWNER and enums.WidgetInstanceType.USER

Datasource

Dashboard datasource Object

Properties

NameTypeDescription
titlestringDatasource title
fullnamestringDatasource fullname
idstringDatasource id
addressstringDatasource address
databasestringDatasource database name

DashboardFilter

Dashboard filter Object

Properties

NameTypeDescription
disabledbooleanIs filter disabled
isCascadingbooleanIs a cascading filter
jaqlObjectFilter JAQL (See JAQL reference)

Enums

FrameStateMode

  • enums.FrameStateMode.HOME: 1
  • enums.FrameStateMode.DASHBOARD: 2
  • enums.FrameStateMode.WIDGET: 3

DashboardInstanceType

  • enums.DashboardInstanceType.OWNER: 'owner'
  • enums.DashboardInstanceType.USER: 'user'

WidgetInstanceType 8.1.1 L8.2.1

  • enums.WidgetInstanceType.OWNER: 'owner'
  • enums.WidgetInstanceType.USER: 'user'

DashboardEventType

  • enums.DashboardEventType.LOADED: 'dashboardloaded'
  • enums.DashboardEventType.UNLOADED: 'dashboardunloaded'
  • enums.DashboardEventType.FILTERS_CHANGED: 'dashboardfilterschanged'
  • enums.DashboardEventType.REFRESHED: 'dashboardrefreshed'
  • enums.DashboardEventType.STYLE_CHANGED: 'dashboardstylechanged'
  • enums.DashboardEventType.WIDGET_ADDED: 'dashboardwidgetadded'
  • enums.DashboardEventType.SIZECHANGED: 'sizechanged'

WidgetEventType 8.1.1 L8.2.1

  • enums.WidgetEventType.READY: 'widgetready'
  • enums.WidgetEventType.LOADED: 'widgetloaded'
  • enums.WidgetEventType.UNLOADED: 'widgetunloaded'
  • enums.WidgetEventType.SAVE: 'widgetsave'
  • enums.WidgetEventType.CHANGED: 'widgetchanged'

ExportMode

  • enums.ExportMode.PDF: 'pdf'
  • enums.ExportMode.PNG: 'png'

ApplicationEventType

  • enums.ApplicationEventType.LOADED: 'sisenseapploaded'
  • enums.ApplicationEventType.STATECHANGED: 'appstatechanged'
Last Updated: