Embed Dashboard > Embed Builder

Use the Draxlr dashboard embed builder to preview the embed and set allowed domains, row-level security, filters, drill downs, exports and appearance, then copy the code.

The embed builder is where you set up a dashboard embed. It shows a live preview of what your customers will see and generates the code for your settings.

Here is a short interactive demo:

Embed button at the top right of the KPIs dashboard

Open the dashboard and click Embed at the top right.


Open the builder

1

Open a dashboard

Go to Dashboard and open the dashboard you want to embed.

2

Click Embed

Click Embed at the top right. A window opens with two options: Single Dashboard Embed and Full App Embed.

3

Choose Single Dashboard Embed

Click Configure dashboard embed.

The builder opens with a live preview on the left and Embed Settings on the right. Use Desktop and Mobile at the top to preview both layouts.

Changes apply when you click Apply:

Dashboard filters, Configure drill down, Exports, Appearance and Row-level security open a panel. Changes take effect only when you click Apply. Going back without applying discards them. The preview and the code update after you apply.


Allowed domains

List the sites allowed to load the embed, such as app.example.com. Leave the list empty to allow any site.

  • Domains are saved to the dashboard as soon as you add or remove one.
  • Enter the host only, such as example.com, without https:// or a path. Add each subdomain separately.
  • Draxlr is always allowed, so the builder preview keeps working.
  • On any other site, the embed shows Access Denied.
  • With the backend API, the list is written into each embed URL when it's generated, so a change applies to embed URLs generated after it. Frontend-only embeds check the list each time they load.

Row-level security

Pick an RLS group to limit each customer to their own rows. Leave it empty to show every row.

After you pick a group, the builder lists the attributes the group's rules filter on, such as an account ID. Enter values to preview the embed as a specific customer. In production, your backend sends these values for each customer. Click View group to open the group's settings.

Selecting a group turns on Use backend API, and it stays on while a group is selected. See Row-level Security.


Show dashboard header

Shows the dashboard's name at the top of the embed. It's off by default.


Dashboard filters

Lists the dashboard's filters with three columns:

ColumnWhat it does
VisibleClick the eye icon to hide the filter. A hidden filter isn't shown to viewers, but its default value still applies.
FilterThe filter's name.
Default valueThe operator and value applied when the embed opens. Filters with a Dropdown List show its values here.

After you pick an operator, Hide operator appears. Check it to show viewers only the value, so they can change the value but not the operator.

Viewers can change visible filters in the embed. To keep a value fixed, set it and hide the filter.

Tip: build your own filter UI:

Hide every filter, then drive the dashboard from your own inputs by passing filter values when you generate the embed URL.


Configure drill down

Choose what viewers can do when they click a data point. Each element on the dashboard has a row:

ColumnWhat it does
Group by fieldsThe fields viewers can group a data point by. Leave it empty to turn off Group by.
View dataLets viewers see the rows behind a data point.
Drill downLets viewers use the element's custom drill downs.

View data and Drill down are on for every element that supports them. Elements that don't support an option show Not supported:

ElementGroup byView dataDrill down
GraphYesYesYes
Pivot TableNoYesYes
Computed CardNoYesOnly with View data on
Result and TableNoNoYes

Group by and View data also aren't available for Raw SQL elements whose SQL Draxlr can't parse.


Exports

OptionWhat it does
PDF exportDownload the whole dashboard as a PDF.
Excel exportDownload the dashboard's data as an Excel file.
CSV exportDownload data from individual elements.

All three are on by default.


Appearance

Set the embed's colors, fonts and custom CSS. See Appearance.


Copy the code

Click Open embed code at the bottom of the settings. The Embed Code window shows the code for your current settings.

With the backend API

Use backend API is on by default. The window shows two parts:

  1. Backend - request an embed URL: a curl request to the Generate Embed URL API with your API key, API secret and settings. Call it from your server each time a signed-in user opens the page.
  2. Frontend - render with the embed URL: the code that renders the embed, for HTML, React or Vue. Replace INSERT_embedUrl_FROM_API_HERE with the embedUrl from the API.
AttributeDescription
data-embedUrlThe embedUrl from the Generate Embed URL API
data-idThe dashboard's ID. Also used in the id as draxlr-YOUR_DASHBOARD_ID
data-widthWidth of the embed. Default: 100%
data-minHeightMinimum height. Default: 600px
data-maxHeightMaximum height. Default: 2000px. The embed grows to fit the dashboard up to this height
data-heightFixed height, used for single element embeds. Default: 600px

Add the <script> tag once per page, even if you embed several dashboards or elements.

Frontend only

Turn off Use backend API to get code that works without a backend. The snippet includes your API key and secret and your settings, and requests an embed URL from the browser each time the page loads. To re-render the embed after changing its filters, call draxlr.render().

Your API secret is visible:

Frontend-only code puts your API key and secret in your page's HTML. Use it only for internal pages. Row-level security isn't available without the backend API.


Embed a single element

To embed one element instead of the whole dashboard, open the element's menu (⋮) on the dashboard and choose Embed. The builder opens with a preview of that element, and some settings change. See Embed Dashboard Element.


Tips

  • Keep customers in their own data: turn on row-level security and pass the signed-in customer's attributes. Every element, filter, drill down and export is then limited to their rows.
  • Restrict where it loads: add your production domains under Allowed domains so the embed only renders on sites you own.
  • Copy the code again after changes: settings aren't saved in Draxlr, only in the code you copy.