Skip to content

Embedding Panels and Dashboards (Enterprise) ​

Enterprise feature

Embedding is available in gdotv Enterprise. If you'd like to discuss upgrading to gdotv Enterprise, contact us at sales@gdotv.com.

You can show a published dashboard, or one of its panels, inside your own web application: an internal portal, a case-management tool, or a product your customers use. It stays live: an embedded dashboard keeps its filters and its tabs. People see it as themselves, with their gdotv permissions, and every query it runs is recorded in the audit trail.

Embedding works for people your application signs in with the same Keycloak realm as gdotv. Your application hands the signed-in person's access token to the embedded view in the page; gdotv checks it and shows the view for that person. For people without a gdotv sign-in there is guest embedding, and for pages whose visitors sign in nowhere, anonymous links.

A gdotv dashboard embedded in a bank's risk portal, with its filter bar and tabsA gdotv dashboard embedded in a bank's risk portal, with its filter bar and tabs

Panels that list graph elements

Vertex, edge, result and map panels can't be embedded yet. An embedded dashboard shows a placeholder in their place, and the Embed Panel… item isn't offered for them. Graph panels are embedded: see Graph panels.

Before you start ​

You need:

  • gdotv Enterprise, signed in through Keycloak.
  • A published dashboard. Drafts can't be embedded.
  • An administrator to turn embedding on for the connection (below).
  • A Keycloak client for your application that requests the gdotv-embed client scope, so its access tokens are meant for embedded views. The scope adds the gdotv-embed audience and the person's realm roles to the token. It ships with the gdotv realm; if your realm predates it, create a client scope named gdotv-embed with an audience mapper for gdotv-embed and a mapper that adds the person's realm roles to the access token, and add it to your client's default scopes.

Turn embedding on for a connection ​

Embedding is off for every connection until an administrator turns it on.

  1. Open Settings and select Embedding.
  2. Find the connection, switch Embedding on, and list the sites allowed to show its panels and dashboards, one per line:
    • https://portal.example.com allows that site only.
    • https://*.example.com allows every subdomain of example.com, but not example.com itself.
  3. Select Save.

Only administrators see Settings › Embedding.

Settings › Embedding for one connection: embedding on, the allowed sites, guest embedding and anonymous linksSettings › Embedding for one connection: embedding on, the allowed sites, guest embedding and anonymous links

A site is a scheme (http or https), a host and an optional port, with no path. Pages on any other site cannot display the connection's panels and dashboards: the browser refuses to show them. Turning embedding off, or removing a site, stops views that are already open the next time they load data.

Changes to these settings are recorded in the audit trail.

Get the embed code ​

  1. Open the published dashboard in gdotv.
  2. For the whole dashboard, select Embed dashboard… (next to Copy share link). For one panel, open the panel's menu and select Embed Panel….
  3. Copy the two snippets: the script tag, and the element with its ids.

The embed dialog of a dashboard: the script tag, the element with its ids, and the anonymous link sectionThe embed dialog of a dashboard: the script tag, the element with its ids, and the anonymous link section

Everyone who can view the dashboard can copy its embed code, in the web app. If the parameters have values that differ from their defaults, the code includes them.

Add a dashboard to your page ​

Load the gdotv embedding script once per page, from your gdotv server:

html
<script src="https://gdotv.example.com/api/embed/sdk.js"></script>

Place the dashboard where you want it, and tell it how to get the signed-in person's access token:

html
<gdotv-dashboard id="fraud-overview"
  server="https://gdotv.example.com"
  database-configuration-id="…"
  dashboard-id="…"
  theme="light"></gdotv-dashboard>
<script>
  const dashboard = document.getElementById('fraud-overview');
  // With keycloak-js:
  dashboard.fetchToken = () => keycloak.updateToken(70).then(() => keycloak.token);
  dashboard.parameters = { region: 'EMEA' };
  dashboard.addEventListener('gdotv:parameters-changed', (event) => saveFilters(event.detail.values));
</script>

The dashboard is shown as gdotv shows it: its filter bar, its tabs when it has more than one, and its panels laid out as on the dashboard. A tab's panels run the first time the tab is opened. In a space narrower than a phone screen, the panels stack one above the other. The element is as tall as the dashboard's content and follows it as tabs change; give the element a height and height="fill" to scroll inside it instead.

The element calls fetchToken when it opens and again shortly before its session ends, so it keeps working for as long as the person stays signed in to your application. The token is passed inside the page and is never put in an address.

A view's session ends no later than the token that opened it, and the view asks for the next token about a minute before that. Return a token with more than a minute left: with keycloak-js, updateToken(70) refreshes it when less than 70 seconds remain.

Add a panel to your page ​

A single panel works the same way, with <gdotv-panel> and its panel-id. Give it a height:

html
<gdotv-panel id="fraud-ring"
  server="https://gdotv.example.com"
  database-configuration-id="…"
  dashboard-id="…"
  panel-id="…"
  style="display: block; height: 480px"></gdotv-panel>
<script>
  const panel = document.getElementById('fraud-ring');
  panel.fetchToken = () => keycloak.updateToken(70).then(() => keycloak.token);
  panel.parameters = { customerId: '1042' };
</script>

Attributes and properties ​

NameElementWhat it does
serverbothYour gdotv address.
database-configuration-id, dashboard-idbothWhich dashboard. The embed dialog fills them in.
panel-id<gdotv-panel>Which of its panels.
themebothlight or dark. Change it at any time. Left out, the view follows the visitor's system setting.
filters<gdotv-dashboard>Leave it out to show the dashboard's filter bar. none hides it, for a page that sets the values itself.
height<gdotv-dashboard>Leave it out to size the element to the dashboard. fill fills the height you give the element.
frame<gdotv-panel>Leave it out to show the panel as a dashboard shows it, in its card with its title bar. none shows the panel alone, for a page that titles and frames it itself.
linkbothAn anonymous link's id, in place of the ids and fetchToken. The embed dialog fills it in.
titlebothThe embedded frame's title, read by screen readers. gdotv dashboard or gdotv panel unless you set one.
fetchTokenbothA function returning the person's access token, or a promise of it. Required, except for a link.
parametersbothParameter values, by parameter name, written as a share link writes them: text as is, lists as JSON.

Methods ​

MethodWhat it does
setParameters(values)Sets parameter values and runs the panels that use them again. On a locked anonymous link, the locked values stay as they are.
refresh()Runs the panels again with their current values. A panel on a tab that isn't showing runs when its tab is next opened.
setTheme('light' | 'dark')Switches the theme.

Events ​

Each event is a CustomEvent on the element; its detail holds the values below.

EventWhendetail
gdotv:readyThe view loaded and is about to make its session.protocol
gdotv:sessionThe view made its session for the person: when it opens, and each time it renews it.kind (panel or dashboard), user (id, username, name, email), dashboardName, panelName (a panel only), expiresAt, openUrl (the same view in gdotv). For an anonymous link, also anonymous: true and lockedParameters.
gdotv:renderedThe panels finished running and show their results.
gdotv:parameters-changedThe person changed a filter, or values set through setParameters were applied.values: every shown parameter's value
gdotv:selectionThe person clicked a node or an edge of a graph panel, or cleared the selection.elements: the selected element as { id, isVertex, label }, or an empty list
gdotv:resizeThe dashboard's content changed height (the element follows it for you).height
gdotv:errorSomething went wrong.code, message
gdotv:token-expiringThe view asked for a fresh token (handled for you).reason: expiry (the session is about to end) or rejected (gdotv refused the session)
js
dashboard.addEventListener('gdotv:parameters-changed', (event) => {
  history.replaceState(null, '', `?region=${encodeURIComponent(event.detail.values.region ?? '')}`);
});

Error codes ​

CodeMeaning
EMBED_DISABLEDEmbedding is off for the connection.
ORIGIN_NOT_ALLOWEDYour site is not in the connection's list of allowed sites.
TOKEN_INVALIDgdotv refused the access token: expired, from another realm, or missing the gdotv-embed audience. For a guest token: the wrong secret, no gdotv-embed audience, no exp, an iat in the future, no sub or one over 249 characters, or a lifetime over an hour.
GUEST_DISABLEDThe page sent a guest token, but guest embedding is off for the connection or it has no secret.
ACCESS_DENIEDThe person may not view this connection's dashboards.
DASHBOARD_NOT_FOUNDThe dashboard does not exist, is a draft, or is not on this connection.
PANEL_NOT_FOUNDThe panel is not part of the dashboard, or the view could not be loaded.
PANEL_NOT_EMBEDDABLEThe panel is a vertex, edge, result or map panel, which can't be embedded yet.
NO_TOKEN_PROVIDER, TOKEN_UNAVAILABLEfetchToken is missing, or did not return a token.
INVALID_SERVERserver is not an http or https address.
INVALID_REQUESTThe view asked for something gdotv could not read, such as a missing id.
LINK_NOT_FOUNDThe anonymous link does not exist, or was revoked.
ANONYMOUS_DISABLEDAnonymous links are off for the connection, or on the whole gdotv server.
LINK_DISABLEDThe anonymous link is turned off. Whoever shared it can turn it back on.
BUSYAn anonymous link went over its budget and the view gave up retrying.
SESSION_FAILEDThe view could not reach gdotv to make its session.
RUN_FAILEDA panel's query failed; message says why (for a dashboard, starting with the panel's name). The panel shows the error too.

Guest embedding: people without a gdotv sign-in ​

Most applications embed dashboards for people who are not gdotv users: customers, partners, a public site's visitors. For them, your application vouches for the person with a guest token it signs itself, and gdotv shows the view to that person with the business role.

  1. Open Settings, select Embedding, find the connection and select Make secret. The secret is made at once, without Save. Copy it: it is shown once. Store it where your application's server keeps its secrets, never in a page.
  2. Switch Guest embedding on and select Save. Embedding itself must be on, with the sites listed, as above.
  3. On your server, make a token for the signed-in person and hand it to the page through fetchToken, exactly as with a Keycloak token.

The token is a JWT signed with the secret (HS256) carrying:

ClaimMeaning
subWho the person is in your application, up to 249 characters. Required. The audit trail shows it as the person's username, with the id guest:<sub>.
name, emailOptional, shown in the audit trail.
audgdotv-embed. Required.
expWhen the token ends. Required; at most one hour after iat.
iatWhen it was made. Optional; without it, the hour is counted from when gdotv receives the token.

Only HS256 is accepted. The secret is used as it is shown, as text: sign with its UTF-8 bytes, not a base64 decoding of it. gdotv allows 30 seconds of difference between your server's clock and its own.

With Node.js and jose:

js
import { SignJWT } from 'jose';
const secret = new TextEncoder().encode(process.env.GDOTV_EMBED_GUEST_SECRET);
const token = await new SignJWT({ name: user.displayName, email: user.email })
  .setProtectedHeader({ alg: 'HS256' })
  .setSubject(user.id)
  .setAudience('gdotv-embed')
  .setIssuedAt()
  .setExpirationTime('10m')
  .sign(secret);

The page then uses it as the token: dashboard.fetchToken = () => fetch('/api/gdotv-token').then((r) => r.text()).

Guests see the view with the business role: they can view and run it, and nothing more. A guest's runs are recorded in the audit trail under their sub, with the name and email the token carried. Replacing the secret stops every token signed with the old one at once, and the views those tokens opened at their next request. Turning guest embedding off ends guest views the same way and keeps the secret for later.

For a public page, a status board, or a portal whose visitors never sign in anywhere, an administrator can make an anonymous link to a published dashboard or panel. Anyone holding the link sees it with the business role, in your page or as a page of its own. Nothing identifies the visitor, so anonymous links are off everywhere until an administrator turns them on, and they exist only on gdotv Enterprise.

  1. Open Settings, select Embedding, find the connection and switch Anonymous links on. Embedding itself must be on, with at least one site listed, as above. List the sites that will show the link's view; a link opened as a page of its own works from any site. Set how long a result is reused for anonymous visitors, then select Save.
  2. Open the published dashboard and select Embed dashboard…, or open a panel's menu and select Embed Panel…. The Anonymous link section is shown to administrators only.
  3. Under Anonymous link, leave Lock to the default values ticked to fix every filter at its default, then select Make a link. Copy the address, or the element that uses it:
html
<gdotv-dashboard server="https://gdotv.example.com" link="…"></gdotv-dashboard>

Locked to the default values, the link shows every parameter at the dashboard's default, and visitors cannot change any: a dashboard's filter bar has no control for them, and the server ignores values sent by the page or the address. The link follows the dashboard: publish a new default and the link shows it at once. A parameter that is required but has no default can't be locked, since its panels would wait for a value nobody can give: the checkbox is unavailable and names it until you give it a default. Unticked, visitors start from the defaults and can change them.

No fetchToken is needed: the link names the view and the page makes its own session from it. The element works as any other: parameters, setParameters, refresh, setTheme and the same events, except that setParameters leaves a locked link's values as they are.

The link is the address itself, so treat it as you would any public address:

  • Turn off keeps the link but refuses everyone until it is turned on again.
  • New address makes a new link for the same view and values; the old one stops working at once, as does every page that was using it.
  • Revoke removes it.

Turning anonymous links off for the connection stops every link on it. Each dashboard, and each panel, has at most one link.

Server operators can forbid anonymous links on the whole gdotv with GDOTV_EMBED_ANONYMOUS_ENABLED=false: every link stops at once, whatever its connection says, and no connection can turn them on. A connection that had them on keeps that setting until an administrator turns it off, and its other embedding settings can still be saved. The embed dialog says what stops a link: the server, the connection, or the link's own Turn off.

How anonymous links behave:

  • Results are reused. A result shown to an anonymous visitor is kept for the connection's reuse time (five minutes unless changed) and shown to the next visitors asking for the same panel with the same values, so a busy page does not run the queries once per visitor. Set the time to 0 to run them every time. Each gdotv replica keeps its own copy. Visitors who ask for the same result at the same moment share one run.
  • Each link has a budget. A link may cause 60 database runs and open 600 new sessions per minute; reused results do not count against it. Past that, the view shows its panels as loading and tries again by itself, up to five times, as gdotv tells it to wait (at most 30 seconds each time). Then a panel shows "This view is busy. Try again in N seconds." and the element reports a BUSY or RUN_FAILED error. Visitors changing an unlocked filter cannot make the database run without limit. Both numbers can be changed (see Server configuration) and apply per gdotv replica.
  • Locked values win. On a link locked to the default values, whatever the page or the address sends is ignored, on every panel; hidden dashboard parameters keep theirs as always.
  • A new version shows at once. Publishing the dashboard again drops the results its links reused, so visitors see its new queries and defaults on their next run.
  • Audit. Every run is recorded on the EMBED channel with SYSTEM as the actor type and anonymous as the actor, with the link id and the page's site. A reused result is recorded too, as embed-link.cached-view, naming the panel and who made the link. See Embedded views in the audit trail. Making, changing, regenerating and revoking a link are recorded as the administrator who did it.

What people can do in an embedded view ​

An embedded dashboard or panel is a read-only view of what is published:

  • Charts, tables, labels, markdown, images, iframes, JSON and console panels behave as on the dashboard, every chart type included (from bar and pie to radar, heatmap, treemap and tree). JSON and console panels show their result as text. Raw HTML in a markdown panel is not rendered in an embed.
  • An embedded dashboard has its filter bar, applying values at once or with an Apply button as the dashboard is set. Values can also come from your page (parameters, setParameters). A panel waiting for a required value says which.
  • Graph panels draw their graph with its legend: see Graph panels.
  • Vertex, edge, result and map panels show a placeholder.
  • Editing, deleting and styling are not available.

Graph panels ​

An embedded graph panel draws the graph as gdotv does, in the look of the panel's stylesheet (or the connection's default one): each label's colour, icon, size and caption, and each edge type's.

It shows what the panel shows on its dashboard:

  • The legend, in the top-right corner, with a button to hide it. It lists every label and edge type in the graph with its count. A click on an entry hides or shows that type; the funnel on an entry filters it by a property's values, or by a range for numbers. The legend says what is hidden and has show all to bring everything back.
  • The graph controls, when Show graph controls is on in the panel's appearance settings: the search bar (which also suggests legend filters), the layout picker (force directed, circular, tree) and the view controls (fit, zoom, fullscreen). They are off by default, as on a dashboard. Fullscreen needs the framing page's permission, which the <gdotv-panel> and <gdotv-dashboard> elements give.

An embedded Graph panel with its graph controls, a device's card open and its neighbours highlightedAn embedded Graph panel with its graph controls, a device's card open and its neighbours highlighted

Clicking a node or an edge opens a card with its properties and its edges, and tells your page with a gdotv:selection event:

js
panel.addEventListener('gdotv:selection', (event) => {
  const [element] = event.detail.elements;
  if (element?.isVertex && element.label === 'Customer') {
    showCustomer(element.id);
  }
});

The graph is read-only. It cannot be edited or expanded from the page: it holds the elements the panel's query returned, and nothing else is loaded from the database. What the legend hides and the layout chosen are kept for the visit only: the next visit starts from the whole graph.

Security ​

  • Who sees what. The view acts for the person your application signed in, with their gdotv role on the connection. Someone without access to the connection's dashboards sees an error, not the view. A guest acts with the business role.
  • The guest secret. Anyone holding it can vouch for anyone on that connection's dashboards, so it belongs on your server only. One secret per connection; replace it from the same page if it leaks.
  • Only what is embedded. An embedded dashboard's session reaches that dashboard and its panels; an embedded panel's, that panel only. Neither reaches anything else in gdotv: not the connection's other dashboards, saved queries or schema. Value lists are those of the embedded panels' own variables. Panels always run their saved queries on the graph they were saved for, and the page never receives the query text, its plan or its profile. The page sends parameter values and nothing else; hidden dashboard parameters keep their values whatever it sends.
  • Values your page sets are not a restriction. parameters and setParameters choose what a view shows first, and the person looking at it can change them. To hold a value for everyone, make it a hidden dashboard parameter, or lock an anonymous link to the default values.
  • Which sites. Only the sites an administrator listed can display the view. The embedded page runs scripts from your gdotv server only.
  • No tokens in addresses. Access tokens and sessions are kept in memory in the page, never in an address, a cookie or browser storage. Sessions last at most ten minutes, or less if the access token expires sooner, and are renewed through fetchToken.
  • Audit. Runs are recorded with the person as the actor and EMBED as the channel; an anonymous link's runs name the link instead, under the SYSTEM actor type.
  • Anonymous links. The address is the only thing between a visitor and the view, so make one only for data that may be public, lock it to the default values unless visitors should choose, and revoke it when the page is retired. Administrators can forbid anonymous links on the whole server with GDOTV_EMBED_ANONYMOUS_ENABLED=false.

Server configuration ​

PropertyDefaultMeaning
gdotv.embed.oauth.audiencegdotv-embedThe audience access tokens must carry.
gdotv.embed.session.ttl-seconds600The longest an embed session lasts before the view asks for a fresh token.
gdotv.embed.anonymous.enabledtrueWhether administrators may turn anonymous links on for a connection at all.
gdotv.embed.anonymous.cache-ttl-seconds300How long a result is reused for anonymous visitors when the connection does not say.
gdotv.embed.anonymous.max-runs-per-minute60How many database runs one anonymous link may cause per minute. Reused results do not count. 0 removes the limit.
gdotv.embed.anonymous.max-sessions-per-minute600How many new sessions one anonymous link may open per minute (one per view opened, and one about every nine minutes while it stays open: a minute before each session ends). 0 removes the limit.

Each property can also be set as an environment variable, in capitals with underscores: GDOTV_EMBED_SESSION_TTL_SECONDS, GDOTV_EMBED_ANONYMOUS_ENABLED, and so on.

When several gdotv replicas run in cluster mode, embed sessions are shared through the database automatically. See Running Several Replicas.